OCLOperators excluding
(Replacing message template with parser tag) |
No edit summary |
||
Line 19: | Line 19: | ||
|} | |} | ||
The opposite - to add an object to a collection - is [[OCLOperators append|Append]]. | The opposite - to add an object to a collection - is [[OCLOperators append|Append]]. | ||
Video: https://youtu.be/nKJ4HInnaDE?si=fod79HGQZO4sf35y | |||
[[Category:OCL Collection Operators]] | [[Category:OCL Collection Operators]] | ||
{{Edited|July|12|2024}} | {{Edited|July|12|2024}} |
Revision as of 08:24, 4 December 2024
This page was created by Alexandra on 2017-08-13. Last edited by Stephanie on 2025-02-10.
excluding ( object : T ) : Collection(T)
Returns a collection containing all elements of self minus all occurrences of object. Note: at the time of writing, the OCL standard library sports a bug that changes *OrderedSets* in *Sets* when excluding elements.
Expression | Result |
---|---|
Sequence{'b', 'a', 'b', 'c'}->excluding('b') | Sequence{'a', 'c'} |
Bag{'b', 'a', 'b', 'c'}->excluding('b') | Bag{'c', 'a'} |
OrderedSet{'b', 'a', 'b', 'c'}->excluding('b') | Set{'c', 'a'} |
Set{'b', 'a', 'b', 'c'}->excluding('b') | Set{'c', 'a'} |
The opposite - to add an object to a collection - is Append.