SPIN Constraints provide support for validating the values of data entries
Example of Constraint Checking
The following screenshot provides an example of a SPIN constraint definition. Constraints are conditions or unit tests that all instances of a class (and its subclasses) must fulfill at any time. Constraint violations can be useful to guide input and to verify a model's state.
The constraint shown above is an ASK query that checks whether the values of the property age are within a reasonable range. If a Person has an age less than 0 or greater than 120, a constraint violation will be issued and TopBraid Composer will display warnings at suitable places on the form, as shown below. Note that SPIN uses the system variable ?this to refer to the current instance of the class to check.