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

Introduction

Constraints are relations among attribute variables or components. They can appear in component and attribute declarations, and can also appear in classes as member declarations themselves. Reconsider our HelloWorld example. We can write the constraint on bt separately from the component declaration as follows:

       main class HelloWorld {
            component Button bt;        // component declaration
            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
Sat Apr 18 16:14:29 JST 1998