Collection(T)

The type Collection is the abstract base type of the collection types Set, OrderedSet, Bag and Sequence.

Operations

size(): Integer
The number of elements contained in self.
includes(t: T): Boolean
True if self contains t.
excludes(t: T): Boolean
True if self does not contain t.
count(t: T): Integer
Returns the number of occurences of t in self.
includesAll(c: Collection(T)): Boolean
True if self contains all elements of c.
excludesAll(c: Collection(T)): Boolean
True if self contains none of the elements of c.
isEmpty(): Boolean
True if self does not contain any elements.
notEmpty(): Boolean
True if self contains at least one element.
sum(): T
Returns the sum of the elements. T must support the + operation.
exists(e: OclExpression): Boolean
Returns true if e holds for at least one of the elements contained in self.
forAll(e: OclExpression): Boolean
True if e holds for all elements in self.
isUnique(e: OclExpression): Boolean
True if e evaluates to a different value for each element in self.
sortedBy(e: OclExpression): T2
Returns a sequence, containing all elements of self. The ordering of the sequence is determined by the < operation, applied to the results of e.
iterate(e: OclExpression): T2
Applies e to elements of self and returns the value of e for the last visited element of self. If self is a sequence, the elements are iterated in the order of the sequence.
any(e: OclExpression): T
Returns any element of self for which e evaluates to true.
one(e: OclExpression): Boolean
True if e evaluates to true for exactly one element in self.
min(): T
Returns the minimum of all elements in self.
max(): T
Returns the maximum of all elements in self.
asBag(): Bag(T)
Returns a bag containing all elements of self.
asSet(): Set(T)
Returns a set containing all elements of self withou duplicates.
asSequence(): Sequence(T)
Returns self if self is a sequence, otherwise a sequence containing all elements of self. The order is undefined if self is a set or bag.