OrderedSet(T)

OrderedSet(T)

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 OrderedCollection(T) , UniqueCollection(T)

Operations

=(object2 : OclSelf[?]) : Boolean[1] precedence: EQUALITY

<>(object2 : OclSelf[?]) : Boolean[1] 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.

appendAll(objects : OrderedCollection(T)) : OrderedSet(T)

The set of elements, consisting of all elements of self, followed by objects.

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.

excludingAll(objects : Collection(OclAny)) : OrderedSet(T)

The ordered set containing all elements of self apart from all occurrences of all objects.

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.

includingAll(objects : Collection(T)) : OrderedSet(T)

The ordered set containing all elements of self plus objects added as the last elements.

insertAt(index : Integer[?], object : T[?]) : OrderedSet(T) invalidating

The ordered set consisting of self with object present at position index.

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 | self->at(index) = result->at(index + 1))

post IsSizePlusOne: result->size() = self->size() + 1

prependAll(objects : OrderedCollection(T)) : OrderedSet(T)

The sequence consisting of objects, followed by all elements in self.

reverse() : OrderedSet(T)

The ordered set of elements with same elements but with the opposite order.

selectByKind(TT)(type : TT[?]) : OrderedSet(TT)

selectByType(TT)(type : TT[?]) : OrderedSet(TT)

subOrderedSet(lower : Integer[?], upper : Integer[?]) : OrderedSet(T) invalidating

The sub-set of self starting at number lower, up to and including element number upper.

Iterations

closure(i : T[1] | lambda : Lambda T() : OrderedSet(T)[?]) : OrderedSet(T)

The closure of applying body transitively to every distinct element of the source collection.

collect(V)(i : T[?] | lambda : Lambda T() : V[?]) : Sequence(V)

collectNested(V)(i : T[?] | lambda : Lambda T() : V[?]) : Sequence(V)

The sequence of elements that results from applying body to every member of the source ordered collection.

reject(i : T[?] | lambda : Lambda T() : Boolean[1]) : OrderedSet(T)

The ordered set of the source ordered set for which body is false.

select(i : T[?] | lambda : Lambda T() : Boolean[1]) : OrderedSet(T)

The ordered set of the source ordered set for which body is true

sortedBy(i : T[?] | lambda : 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).