|Re: OCL Invariant to find cycle in inheritance tree interface [message #541689 is a reply to message #539181]
||Tue, 22 June 2010 07:20
| Esteban Dugueperoux
Registered: July 2009
Thanks for your answer, I have found how to use closure iterator :
inv interfaceNotPresentInAllSuperInterfaces : not
On 09/06/2010 23:23, Ed Willink wrote:
> On 09/06/2010 12:44, Esteban DUGUEPEROUX wrote:
>> I have a metaclass 'Interface' which can have * superInterfaces, and I
>> would like to write a OCL constraint or query to check/find cycle in
>> inheritance tree, but I don't know how to implement a cycle detection
>> algorithm in OCL. Someone have experienced this already?
> OCL like any other language can encounter a stack overflow for a poorly
> programmed traversal of a loop. You need to maintain a Set of interfaces
> so far, to bound the recursion.
> MDT/OCL 1.3.0 implements an additional closure() iterator for exactly
> this kind of problem. My proposed specification change is attached.
> N.B the attached is a draft and has not yet been approved for OCL 2.3.
> Ed Willink
Powered by FUDForum
. Page generated in 0.01862 seconds