A sequence is a collection where the elements are ordered. An element may be part of a sequence more than once. Sequence is itself an instance of the metatype SequenceType. A Sentence is not a subtype of Bag. The common supertype of Sentence and Bags is Collection.
conformsTo
OrderedCollection(T)
Operations
=(object2 : OclSelf[?]) : Boolean[1]
precedence:
EQUALITY
True if
self
contains the same elements as s in the same order.
<>(object2 : OclSelf[?]) : Boolean[1]
precedence:
EQUALITY
append(object : T[?]) : Sequence(T)
The sequence of elements, consisting of all elements of
self
, followed by object.
appendAll(objects : OrderedCollection(T)) : Sequence(T)
The sequence of elements, consisting of all elements of
self
, followed by objects.
excluding(object : OclAny[?]) : Sequence(T)
The sequence containing all elements of
self
apart from all occurrences of object.
The order of the remaining elements is not changed.
excludingAll(objects : Collection(OclAny)) : Sequence(T)
The sequence containing all elements of
self
apart from all occurrences of all objects.
flatten(T2)() : Sequence(T2)
Redefines the Collection operation. If the element type is not a collection type, this results in the same sequence as
self
.
If the element type is a collection type, the result is the sequence containing all the elements
of all the recursively flattened elements of
self
. The order of the elements is partial.
including(object : T[?]) : Sequence(T)
The sequence containing all elements of
self
plus object added as the last element.
includingAll(objects : Collection(T)) : Sequence(T)
The sequence containing all elements of
self
plus objects added as the last elements.
insertAt(index : Integer[?], object : T[?]) : Sequence(T) invalidating
The sequence consisting of
self
with object inserted at position index.
prepend(object : T[?]) : Sequence(T)
The sequence consisting of object, followed by all elements in
self
.
prependAll(objects : OrderedCollection(T)) : Sequence(T)
The sequence consisting of objects, followed by all elements in
self
.
reverse() : Sequence(T)
The sequence containing the same elements but with the opposite order.
selectByKind(TT)(type : TT[?]) : Sequence(TT)
selectByType(TT)(type : TT[?]) : Sequence(TT)
subSequence(lower : Integer[?], upper : Integer[?]) : Sequence(T) invalidating
The sub-sequence 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]) : Sequence(T)
The subsequence of the source sequence for which body is
false
.
select(i : T[?] | lambda : Lambda T() : Boolean[1]) : Sequence(T)
The subsequence of the source sequence for which body is
true
.
sortedBy(i : T[?] | lambda : Lambda T() : OclAny[?]) : Sequence(T)
Results in the Sequence 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).