The OrderedSet is a Set, the elements of which are ordered. It contains no duplicates. OrderedSet is itself an instance of the metatype OrderedSetType. An OrderedSet is not a subtype of Set, neither a subtype of Sequence. The common supertype of Sets and OrderedSets is Collection.
conformsTo
Sequence(T)
,
UniqueCollection(T)
Operations
=(object2 : OclSelf) : Boolean
precedence:
EQUALITY
<>(object2 : OclSelf) : Boolean
precedence:
EQUALITY
-(s : UniqueCollection(OclAny)) : OrderedSet(T)
precedence:
ADDITIVE
The elements of
self
, which are not in s.
append(object : T) : OrderedSet(T)
The set of elements, consisting of all elements of
self
, followed by object.
excluding(object : OclAny) : OrderedSet(T)
The ordered set containing all elements of
self
apart from object.
The order of the remaining elements is not changed.
flatten(T2)() : OrderedSet(T2)
including(object : T) : OrderedSet(T)
The ordered set containing all elements of
self
plus object added as the last element if not already present.
insertAt(index : Integer, object : T) : OrderedSet(T)
The ordered set consisting of
self
with object present at position index.
intersection(o : Collection(T)) : OrderedSet(T)
prepend(object : T) : OrderedSet(T)
The sequence consisting of object, followed by all elements in
self
.
post IsAtStart: result->at(1) = object
post IsShiftedAlong: Sequence{1..self->size()}->forAll(index : Integer | self->at(index) = result->at(index + 1))
post IsSizePlusOne: result->size() = self->size() + 1
reverse() : OrderedSet(T)
The ordered set of elements with same elements but with the opposite order.
selectByKind(TT)(type : AnyClassifier(TT)) : OrderedSet(TT)
selectByType(TT)(type : AnyClassifier(TT)) : OrderedSet(TT)
subOrderedSet(lower : Integer, upper : Integer) : OrderedSet(T)
The sub-set of
self
starting at number lower, up to and including element number upper.
union(o : Sequence(T)) : OrderedSet(T)
The ordered set consisting of all elements in
self
and all elements in o.
Iterations
reject(i : T | body : Lambda T() : Boolean) : OrderedSet(T)
The ordered set of the source ordered set for which body is
false
.
select(i : T | body : Lambda T() : Boolean) : OrderedSet(T)
The ordered set of the source ordered set for which body is
true
sortedBy(i : T | body : Lambda T() : OclAny) : OrderedSet(T)
Results in the ordered set containing all elements of the source collection. The element for which body has the lowest value comes first, and so on. The type of the body expression must have the < operation defined. The < operation must return a Boolean value and must be transitive (i.e., if a < b and b < c, then a < c).