Type Collection

All Subtypes:
Bag, Sequence, Set

Predefined type Collection

Collection is the abstract supertype of all collections types. Each occurence of an object in a collection is called an element. If an object occurs twice in a collection, there are two elements. A collection cannot have another collection as an element.


Operation Summary
 Integer count(OclAny object)
          The number of times that object occurs in this collection.
 Boolean excludes(OclAny object)
          True if object is not an element of this collection.
 Boolean excludesAll(Collection collection)
          True if this collection contains none of the elements of collection.
 Boolean exists(Boolean_Expression expr)
          True if the expression expr applied on each element in this collection evaluates to true at least one time.
 Boolean forAll(Boolean_Expression expr)
          True if the expression expr applied on each element in this collection evaluates to true each time.
 OclAny getOne
          Returns an element of this collection.
 Boolean includes(OclAny object)
          True if object is an element of collection, false otherwise.
 Boolean includesAll(Collection collection)
          True if this collection contains all the elements of collection.
 Boolean isEmpty
          True if this collection contains no elements.
 Boolean isUnique(Boolean_Expression expr)
          True if the expression expr applied on each element in this collection evaluates to true once.
 Boolean notEmpty
          True if this collection contains at least one element.
 Integer size
          The number of elements in this collection.
 Sequence sortedBy(OclAny_Expression expr)
          Results to a sequence containing all elements in this collection.
 Sequence sortedBy(OclAny_Expression expr, Boolean desc)
          Results to a sequence containing all elements in this collection.
 Real sum
          The addition of all elements in this collection.
 

Operations Detail

size

 public Integer size
The number of elements in this collection.

includes

 public Boolean includes(OclAny object)
True if object is an element of collection, false otherwise.

excludes

 public Boolean excludes(OclAny object)
True if object is not an element of this collection.

count

 public Integer count(OclAny object)
The number of times that object occurs in this collection.

includesAll

 public Boolean includesAll(Collection collection)
True if this collection contains all the elements of collection.

excludesAll

 public Boolean excludesAll(Collection collection)
True if this collection contains none of the elements of collection.

isEmpty

 public Boolean isEmpty
True if this collection contains no elements.

notEmpty

 public Boolean notEmpty
True if this collection contains at least one element.

getOne

 public OclAny getOne
Returns an element of this collection. Returns null if this collection is empty.

sum

 public Real sum
The addition of all elements in this collection. Elements must be of a type supporting the + operation. The + operation must take one parameter of type T and be both associative: (a+b)+c = a+(b+c), and commutative: a+b = b+a. Integer and Real fulfill this contition.

exists

 public Boolean exists(Boolean_Expression expr)
True if the expression expr applied on each element in this collection evaluates to true at least one time.

forAll

 public Boolean forAll(Boolean_Expression expr)
True if the expression expr applied on each element in this collection evaluates to true each time.

isUnique

 public Boolean isUnique(Boolean_Expression expr)
True if the expression expr applied on each element in this collection evaluates to true once.

sortedBy

 public Sequence sortedBy(OclAny_Expression expr)
Results to a sequence containing all elements in this collection. The element for which the expression expr has the lowest value comes first, and so on. The type of the expr expression must have the < operation defined. The < operation must be transitive i.e. if a < b and b < c then a < c.

sortedBy

 public Sequence sortedBy(OclAny_Expression expr, Boolean desc)
Results to a sequence containing all elements in this collection. The element for which the expression expr has the lowest value comes first if desc is false or last otherwise, and so on. The type of the expr expression must have the < operation defined. The < operation must be transitive i.e. if a < b and b < c then a < c.


Copyright 1999-2002 ObjeXion Software SA. All rights reserved.