OCLOperators collectNested
(Created page with "Returns a collection containing all the elements contained in self on which we applied the OclExpression expr. The results won't be flattened. The type of the resulting collec...")
 
No edit summary
Line 1: Line 1:
Returns a collection containing all the elements contained in self on which we applied the OclExpression expr. The results won't be flattened. The type of the resulting collection depends on the type of self.
Returns a collection containing all the elements contained in self on which we applied the OclExpression expr. The results won't be flattened. The type of the resulting collection depends on the type of self.


For the purpose of these examples we'll assume here that we have a Class *Person* with a reference *children*. Our model contains two persons such as *person1.children = {James, Jane}* and *person2.children = {John}*.
For the purpose of this example, we'll assume here that we have a Class *Person* with a reference *children*. Our model contains two persons such as *person1.children = {James, Jane}* and *person2.children = {John}*.
{| class="wikitable"
!Expression
!Result
|-
|self.persons->collectNested(children.firstname)
|<nowiki>Sequence{Sequence{James, Jane}, Sequence{John}}</nowiki>
|}

Revision as of 08:24, 27 March 2023

Returns a collection containing all the elements contained in self on which we applied the OclExpression expr. The results won't be flattened. The type of the resulting collection depends on the type of self.

For the purpose of this example, we'll assume here that we have a Class *Person* with a reference *children*. Our model contains two persons such as *person1.children = {James, Jane}* and *person2.children = {John}*.

Expression Result
self.persons->collectNested(children.firstname) Sequence{Sequence{James, Jane}, Sequence{John}}
This page was edited 100 days ago on 02/10/2024. What links here