OCL 2.0 Reference Card Author: Fernando Brito e Abreu (fba@iscte-iul.pt) Affiliation: ISTAR-IUL / ISCTE-IUL Collection type operations Set Bag OrderedSet Sequence Description collection->size(): Integer V V V V Number of elements in the self collection collection->isEmpty(): Boolean V V V V True if the self collection is empty collection->notEmpty(): Boolean V V V V True if the self collection is not empty collection1 = collection2 : Boolean V V V V True if the first collection is equal to the second collection collection1 <> collection2 : Boolean V V V V True if the first collection is different to the second collection collection->isUnique(expr: T): Boolean V V V V True if the argument expression is unique within the self collection collection->select(expr: Boolean): Collection(T) V V V V Elements of the self collection that match the argument condition collection->reject(expr: Boolean): Collection(T) V V V V Elements of the self collection that do not match the argument condition collection->sortedBy(OclBasicType): Sequence(T) V V V V Elements of the self collection sorted by the argument expression collection->collect(expr: T): Collection(T) V V V V Flattened collection of expression values obtained from the self collection members collection->collectNested(expr: T): Collection(T) V V V V Nested collection of expression values obtained from the self collection members collection->iterate(x:I [; acc:J=init]|expr: T|Collection(T)): T|Collection(T) V V V V Iterator that allows defining its logic collection->forAll(expr: Boolean): Boolean V V V V True if the argument expression holds for all members of the self collection collection->exists(expr: Boolean): Boolean V V V V True if the argument holds for at least one member of the self collection collection->one(expr: Boolean): Boolean V V V V True if the argument holds for only one member of the self collection collection->includes(element: T): Boolean V V V V True if the argument is part of the self collection collection->excludes(element: T): Boolean V V V V True if the argument is not part of the self collection collection->includesAll(collection: Collection(T)): Boolean V V V V True if all members of the argument collection belong to the self collection collection->excludesAll(collection: Collection(T)): Boolean V V V V True if none of the members of the argument collection belong to the self collection collection->including(element: T): Collection(T) V V V V The self collection with the argument added to it collection->excluding(element: T): Collection(T) V V V V The self collection with the argument removed from it collection->union(collection: Collection(T)): Collection(T) V V V V The union of the self collection with the argument collection collection->intersection(collection: Set(T) | Bag(T)): Set(T) | Bag(T) V V The intersection of the self collection with the argument collection collection1 - collection2: Set(T) V The first set excluding all elements of the second set collection->symmetricDifference(collection: Set(T)): Set(T) V Union of the self collection with the argument collection, minus their intersection collection->prepend(element: T): OrderedSet(T) | Sequence(T) V V The self (ordered) collection prepended with the argument collection->insertAt(pos:Integer,element:T):OrderedSet(T)|Sequence(T) V V The self (ordered) collection with the argument inserted at the position collection->reverse(): OrderedSet(T) | Sequence(T) V V The self (ordered) collection in reverse order collection->append(element: T): OrderedSet(T) | Sequence(T) V V The self (ordered) collection appended with the argument collection->flatten(): Collection(T) V V V V The self collection flattened; only produces effect if the self collection is nested collection->sum(): Integer | Real V V V V The addition of all elements of an Integer or Real collection collection->max(): Integer | Real V V V V The largest element of an Integer or Real collection collection->min(): Integer | Real V V V V The smal