Methods
(Created page with "'''Methods''' You may define methods in classes to and implement these with OCL: frameless|419x419px You will in the OCL implementation in the Body-p...")
 
No edit summary
Line 1: Line 1:
'''Methods'''
You may define methods in classes to and implement these with OCL:
You may define methods in classes to and implement these with OCL:



Revision as of 01:34, 21 August 2017

You may define methods in classes to and implement these with OCL:

My method.png

You will in the OCL implementation in the Body-property:

Method ocl.png

Notice that since this was a method MDriven will treat you OCL as EAL – something that is allowed to have side effects. In this case our method do not have any side effects and I may want to be able to use this method in OCL. But trying to use it in OCL will not succeed. Methods with side effects are not recognized by OCL . There is a flag on the Method definition called IsQuery and if this is set we “promise” that it does not have intentional side effects. Now it is seen by OCL:

Method ocl2.png

We can then use our IsQuery method in any expression in OCL. Thing.allinstances- >select(x|x.MyMethod(x.SomeInt))

This page was edited 69 days ago on 02/10/2024. What links here