Dresden OCL Toolkit

tudresden.ocl.check.types
Class Collection

java.lang.Object
  extended bytudresden.ocl.check.types.Collection
All Implemented Interfaces:
Type

public class Collection
extends Object
implements Type

This class is the representation of OCL collection types. The kind of the collection (Bag, Set, Sequence, Collection) is determined by an int constant. An Collection object needs to know the element type of the represented OCL collection, otherwise iterating methods without declarator type declaration can not be type-checked.

Author:
Frank Finger

Field Summary
static int BAG
           
static int COLLECTION
           
protected  int collectionKind
           
protected  Any elementType
           
static int SEQUENCE
           
static int SET
           
 
Constructor Summary
Collection(int collectionKind, Type elementType)
           
 
Method Summary
protected  boolean conformsElement(Any otherElementType)
           
protected  boolean conformsKind(int otherKind)
           
 boolean conformsTo(Type t)
           
 boolean equals(Object o)
           
 int getCollectionKind()
           
protected  Type getCommonType(Type t1, Type t2)
           
 Any getElementType()
          returns null for unrestricted collections
 boolean hasState(String stateName)
           
protected  Type navigateBag(String name)
           
protected  Type navigateBag(String name, Type[] params)
           
protected  Type navigateCollection(String name)
           
protected  Type navigateCollection(String name, Type[] params)
           
 Type navigateParameterized(String name, Type[] params)
          Navigate to the result type of the operation name.
 Type navigateQualified(String name, Type[] qualifiers)
          navigate to the association end or attribute name, possibly with qualifier types; unnamed association ends must by made available by implementing methods with the name of the association end's type, but beginning with a lower case character (see OCL specification for more details)
protected  Type navigateSequence(String name)
           
protected  Type navigateSequence(String name, Type[] params)
           
protected  Type navigateSet(String name)
           
protected  Type navigateSet(String name, Type[] params)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface tudresden.ocl.check.types.Type
hashCode
 

Field Detail

collectionKind

protected int collectionKind

elementType

protected Any elementType

COLLECTION

public static final int COLLECTION
See Also:
Constant Field Values

SET

public static final int SET
See Also:
Constant Field Values

BAG

public static final int BAG
See Also:
Constant Field Values

SEQUENCE

public static final int SEQUENCE
See Also:
Constant Field Values
Constructor Detail

Collection

public Collection(int collectionKind,
                  Type elementType)
           throws OclTypeException
Method Detail

getElementType

public Any getElementType()
returns null for unrestricted collections


getCollectionKind

public int getCollectionKind()

navigateQualified

public Type navigateQualified(String name,
                              Type[] qualifiers)
Description copied from interface: Type
navigate to the association end or attribute name, possibly with qualifier types; unnamed association ends must by made available by implementing methods with the name of the association end's type, but beginning with a lower case character (see OCL specification for more details)

Specified by:
navigateQualified in interface Type
Parameters:
qualifiers - the qualifier types; may (and will in most cases) be null, but never an array with length 0

navigateParameterized

public Type navigateParameterized(String name,
                                  Type[] params)
Description copied from interface: Type
Navigate to the result type of the operation name. This must return a valid type whether the specified operation is a query or not.

Implement Type2 to check for query operations.

Specified by:
navigateParameterized in interface Type
Parameters:
params - the actual argument types

hasState

public boolean hasState(String stateName)
Specified by:
hasState in interface Type
Returns:
true if this type has a state with the given name

conformsTo

public boolean conformsTo(Type t)
Specified by:
conformsTo in interface Type
Returns:
true if an instance of the type represented by the called object can replace an instance of the type given as parameter

conformsKind

protected boolean conformsKind(int otherKind)

equals

public boolean equals(Object o)
Specified by:
equals in interface Type

conformsElement

protected boolean conformsElement(Any otherElementType)

toString

public String toString()
Specified by:
toString in interface Type

navigateCollection

protected Type navigateCollection(String name)

navigateCollection

protected Type navigateCollection(String name,
                                  Type[] params)

navigateSet

protected Type navigateSet(String name)

navigateSet

protected Type navigateSet(String name,
                           Type[] params)

navigateBag

protected Type navigateBag(String name)

navigateBag

protected Type navigateBag(String name,
                           Type[] params)

navigateSequence

protected Type navigateSequence(String name)

navigateSequence

protected Type navigateSequence(String name,
                                Type[] params)

getCommonType

protected Type getCommonType(Type t1,
                             Type t2)

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.