next up previous contents index
Next: Domain constraints Up: Constraints Previous: Constraints

Introduction

Constraints are relations among attribute variables or components. They can occur in component and attribute declarations, and can also occur in classes as member declarations themselves. Reconsider our HelloWorld example. We can write the constraint on bt separately from the component declaration as follows:
       class HelloWorld {
            dj Button bt;        
            bt.text == "Hello World!";  // constraint
       }
   

In general, constraints have the same form as conditional expressions in Java. The DJ compile can distinguish constraints from conditional expressions from the context in which they appear. A constraint is either a basic one or a composite one. A basic constraint is a domain, an arithmetic, a symbolic, or a call to a user defined constraint. A composite constraint is made up of basic constraints and various connectives.



Neng-Fa Zhou
1999-02-16