Log in


From MDrivenWiki

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))