condition Option

The condition method option indicates that the method is a condition, which is a declarative restricted method that returns a Boolean result. Conditions cannot be reimplemented from a superschema or superclass. You can define constant parameters for a condition that is not a constraint. Only if and return instructions can be used in condition methods.

Constraints are used in conditions to maintain automatic inverse references when the specified conditions are satisfied. Only automatic references can have a constraint. When the manual side of the inverse reference is set, the condition used as the constraint is evaluated and the automatic inverse is set only if the value of the condition is true. If the automatic reference is a Collection type, the condition is applied to the members of the collection.

For details about defining conditions, see "Adding Conditions to Classes or Primitive Types", in Chapter 4 of the Development Environment User's Guide. See also "Parameters", earlier in this chapter.

The following example shows the use of the condition option in a method signature.

isMultipleOf(d : Integer): Boolean condition;
begin
    return 1 div d = 0;
end;