OCLOperators excluding
No edit summary
No edit summary
Line 1: Line 1:
The collection except this single object
=== 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.
{| class="wikitable"
!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'}
|}
[[Category:OCLOperators]]
[[Category:OCLOperators]]

Revision as of 14:31, 18 November 2019

This page was created by Alexandra on 2017-08-13. Last edited by Stephanie@mdriven.net on 2025-02-10.

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.

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'}
MDriven Chat

How would you like to chat today?

Setting up your conversation…

This may take a few moments