Domanda

Let suppose I have this class diagram in UML:

recursion in OCL

How can I do, in OCL, to specify that an instance of A is not included in list_of_As recursively ? In other words, an instance of A may not be included in A.list_of_As and not be included in all list_of_As of all instances of A in A.list_of_As etc... ?

È stato utile?

Soluzione

You can use the transitive closure operator, closure(), to get a list of A. Then, simply check for the non-existence of the element you don't want to see in that list.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top