OCLOperators constraints
No edit summary |
|||
Line 17: | Line 17: | ||
This operator earlier resulted in a array of booleans with the constraint result. To get the same functionality now, add '''.broken=false''' to the end of the previous expression. | This operator earlier resulted in a array of booleans with the constraint result. To get the same functionality now, add '''.broken=false''' to the end of the previous expression. | ||
Like this; | Like this, used with forAll; | ||
self.constraints.broken=false | self.constraints->forAll(c|c.broken=false) | ||
[[Category:OCLOperators]] | [[Category:OCLOperators]] | ||
See also: [[Constraints]], [[OCLOperators brokenConstraints]] | See also: [[Constraints]], [[OCLOperators brokenConstraints]] |
Revision as of 18:44, 14 December 2018
This page was created by Alexandra on 2017-08-13. Last edited by Stephanie on 2025-02-10.
The operator return both meta information about a class's constraints and if it's currently broken.
The return value is a collection of Tuple containing the following
- Name
- Description
- IsDeleteConstraint: True/False
- ErrorLevel: #Information, #Warning or #Error
- Broken:Evaluated and Subscribed state of the constraint
Examples
To check if any constraint with error level Error is broken;
self.constraints->select(c|(c.ErrorLevel = #Error) and c.Broken)->isEmpty -- Returns True if no errors
Returning a collection of Descriptions of broken Warning constraints;
self.constraints->select(c|(c.ErrorLevel = #Warning) and c.Broken)->collect(c|c.Description)
Please note
This operator earlier resulted in a array of booleans with the constraint result. To get the same functionality now, add .broken=false to the end of the previous expression.
Like this, used with forAll;
self.constraints->forAll(c|c.broken=false)
See also: Constraints, OCLOperators brokenConstraints