OCLOperators excluding
No edit summary
No edit summary
Line 1: Line 1:
=== excluding ( object : T ) : Collection(T) ===
=== excluding ( object : T ) : Collection(T) ===
Returns a collection containing all elements of ''self'' minus all occurences of ''object''. **Note** : at the time of writing, the OCL standard library sports a bug which changes *OrderedSets* in *Sets* when excluding elements.
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.
{| class="wikitable"
{| class="wikitable"
!Expression
!Expression
Line 17: Line 17:
|Set{'c', 'a'}
|Set{'c', 'a'}
|}
|}
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]].
[[Category:OCLOperators]]
[[Category:OCLOperators]]

Revision as of 08:38, 2 March 2023

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.

This page was edited 89 days ago on 02/10/2024. What links here