| Referencing to OCL constraint [message #898426] |
Thu, 26 July 2012 07:27  |
Wouter Schaekers Messages: 17 Registered: July 2012 |
Junior Member |
|
|
Hi.
I was wondering whether it is possible to reference to an OCL constraint in a derivation property/attribute. To give a simple example:
Invariant Bigger:
self.num > 5;
Now I want to use 'Bigger' in a derivation. Eg:
derivation: if Bigger then ... else ... endif
Is this possible or do I have to do double work?
Thanks.
|
|
|
|
| Re: Referencing to OCL constraint [message #898474 is a reply to message #898463] |
Thu, 26 July 2012 08:52  |
Wouter Schaekers Messages: 17 Registered: July 2012 |
Junior Member |
|
|
Ed Willink wrote on Thu, 26 July 2012 08:21But an invariant is always/true/false on a valid/invalid model, so it
makes no sense to use it in an if.
That sounds very logical.
Ed Willink wrote on Thu, 26 July 2012 08:21If you want a re-useable expression, warp it as an operation or property.
property isBigger : Boolean {transient, volatile} { derivation:
self.num > 5; }
invariant Bigger: isBigger;
This works. Thanks.
[Updated on: Thu, 26 July 2012 08:52] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01516 seconds