OCLOperators collectNested
No edit summary
(Replacing message template with parser tag)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<message>Write the content here to display this box</message>
=== collectNested ( expr : OclExpression ) : Collection(T2) ===
=== collectNested ( expr : OclExpression ) : Collection(T2) ===
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.
Line 11: Line 12:
|}
|}
[[Category:OCL Collection Operators]]
[[Category:OCL Collection Operators]]
{{Edited|July|12|2024}}

Latest revision as of 07:50, 17 June 2024

collectNested ( expr : OclExpression ) : Collection(T2)

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 95 days ago on 06/17/2024. What links here