de.tuberlin.cs.cis.ocl.type.reflect
Interface OclCollection

All Known Subinterfaces:
OclBag, OclSequence, OclSet
All Known Implementing Classes:
BagInstance, CollectionInstance, SequenceInstance, SetInstance

public interface OclCollection

Represents and identifies the OCL 1.5 type Collection. It is used by the context checker to reflect operations of and to identify the collection type within the OCL-context. The element type of the collection and the type of the evaluation of an expression parameter can not be represented. These types must be remapped to the specified type. Each instance of this interface is handled as an OCL instance of the type Collection during the evaluation process. Its methods are used to describe the predefined properties of the type. For a complete description of the type and its properties (to be specific for this class and its methods) refer to the type description of OCL 1.5.

Author:
fchabar
See Also:
OCL 1.5 Standard, de.tuberlin.cs.cis.ocl.type, de.tuberlin.cs.cis.ocl.eval.instance

Method Summary
 java.lang.Object any(OclExpression expr)
          Returns any element in this collection for which expr evaluates to True.
 OclInteger count(OclAny object)
          The number of times that object occurs in this collection.
 OclBoolean excludes(OclAny object)
          True if object is not an element of collection, False otherwise.
 OclBoolean excludesAll(OclCollection c2)
          Does this collection contains none of the elements of c2 ?
 OclBoolean exists(OclExpression expr)
          Results in True if expr evaluates to True for at least one element in this collection.
 OclBoolean forAll(OclExpression expr)
          Results in True if expr evaluates to True for each element in this collection; otherwise, result is False.
 OclBoolean includes(OclAny object)
          Results in True if object is an element of this collection, False otherwise.
 OclBoolean includesAll(OclCollection c2)
          Does this collection contains all the elements of c2 ?
 OclBoolean isEmpty()
          Is this collection the empty collection?
 OclBoolean isUnique(OclExpression expr)
          Results in True if expr evaluates to a different value for each element in this collection; otherwise, result is False.
 java.lang.Object iterate(OclExpression expr)
          Iterates over the collection.
 OclBoolean notEmpty()
          Is this collection not the empty collection?
 OclBoolean one(OclExpression expr)
          Results in True if there is exactly one element in this collection for which expr is True.
 OclInteger size()
          Results in the number of elements in this collection.
 OclSequence sortedBy(OclExpression expr)
          Results in the Sequence containing all elements of this collection.
 java.lang.Object sum()
          The addition of all elements in this collection.
 

Method Detail

size

public OclInteger size()
Results in the number of elements in this collection.

Returns:
the number of elements in this collection.

includes

public OclBoolean includes(OclAny object)
Results in True if object is an element of this collection, False otherwise.

Parameters:
object - an instance of OclAny (!= null)
Returns:
True if object is an element of this collection, False otherwise.

excludes

public OclBoolean excludes(OclAny object)
True if object is not an element of collection, False otherwise.

Parameters:
object - an instance of OclAny (!= null)
Returns:
True if object is not an element of collection, False otherwise.

count

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

Parameters:
object - an instance of OclAny (!= null)
Returns:
The number of times that object occurs in this collection.

includesAll

public OclBoolean includesAll(OclCollection c2)
Does this collection contains all the elements of c2 ?

Parameters:
c2 -
Returns:
True if this collection contains all the elements of c2, False otherwise.

excludesAll

public OclBoolean excludesAll(OclCollection c2)
Does this collection contains none of the elements of c2 ?

Parameters:
c2 -
Returns:
True if this collection contains none of the elements of c2, False otherwise.

isEmpty

public OclBoolean isEmpty()
Is this collection the empty collection?

Returns:
True if this collection is the empty collection, False otherwise.

notEmpty

public OclBoolean notEmpty()
Is this collection not the empty collection?

Returns:
True if this is not the empty collection, False otherwise.

sum

public java.lang.Object 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 condition.

Returns:
the addition of all elements in this collection.

exists

public OclBoolean exists(OclExpression expr)
Results in True if expr evaluates to True for at least one element in this collection.

Parameters:
expr - an instance of OclExpression (!= null)
Returns:
True if expr evaluates to True for at least one element in this collection, False otherwise.

forAll

public OclBoolean forAll(OclExpression expr)
Results in True if expr evaluates to True for each element in this collection; otherwise, result is False.

Parameters:
expr - an instance of OclExpression (!= null)
Returns:
True if expr evaluates to True for each element in this collection; False otherwise.

isUnique

public OclBoolean isUnique(OclExpression expr)
Results in True if expr evaluates to a different value for each element in this collection; otherwise, result is False.

Parameters:
expr - an instance of OclExpression (!= null)
Returns:
True if expr evaluates to a different value for each element in this collection; False otherwise.

sortedBy

public OclSequence sortedBy(OclExpression expr)
Results in the Sequence containing all elements of this collection. The element for which expr has the lowest value comes first, and so on. The type of the expr 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). pre: expr.evaluationType().operations()->includes(‘<‘)

Parameters:
expr - an instance of OclExpression (!= null)
Returns:
the Sequence containing all elements of this collection

iterate

public java.lang.Object iterate(OclExpression expr)
Iterates over the collection.

Note: it is not neseccary to implement this method. It will soley be used for reflection purposes in the type system.

Parameters:
expr - an instance of OclExpression (!= null)
Returns:
the iteration over this collection.

any

public java.lang.Object any(OclExpression expr)
Returns any element in this collection for which expr evaluates to True. If there is more than one element for which expr is True, one of them is returned. The precondition states that there must be at least one element fulfilling expr; otherwise, the result of this operation is Undefined. pre: self->exists( expr )

Parameters:
expr - an instance of OclExpression (!= null)
Returns:
any element in this collection for which expr evaluates to True.

one

public OclBoolean one(OclExpression expr)
Results in True if there is exactly one element in this collection for which expr is True.

Parameters:
expr - an instance of OclExpression (!= null)
Returns:
True if there is exactly one element in this collection for which expr is True.