Dresden OCL Toolkit

tudresden.ocl.check.types
Interface Type

All Known Subinterfaces:
Any, Type2
All Known Implementing Classes:
Any.VoidAny, BankClassifier, Basic, ClassAny, Collection, ModelClass, OclState, OclType, TestClassifier

public interface Type

This interface is used by the type checker to handle type representations. Classes implementing this interface will have their navigate methods return the type representation of the type of the association end with the name name or the type of the property name. In both cases the result can either be a application-defined type or a predefined type (basic type like Integer or collection type). Take care to return Sequences for navigation over ordered associations. If the type has no association end or property with the given name, a OclTypeException is thrown.

Classes implementing this interface should also overwrite equals, toString and hashCode appropriately. The toString method should return the type name as it would be expected in an OCL expression (e.g. "Person" and not things like "application defined type: Person").

Note: This interface has been augmented by a new version Type2. Implementing Type2 is strongly recommended, though not mandatory.

Author:
Frank Finger
See Also:
Basic, Collection, OclTypeException

Method Summary
 boolean conformsTo(Type t)
           
 boolean equals(Object o)
           
 int hashCode()
          It will be nessary to redefine the hashCode if equality of types is not equality of representation objects.
 boolean hasState(String name)
           
 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)
 String toString()
           
 

Method Detail

navigateQualified

public Type navigateQualified(String name,
                              Type[] qualifiers)
                       throws OclTypeException
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)

Parameters:
qualifiers - the qualifier types; may (and will in most cases) be null, but never an array with length 0
Throws:
OclTypeException

navigateParameterized

public Type navigateParameterized(String name,
                                  Type[] params)
                           throws OclTypeException
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.

Parameters:
params - the actual argument types
Throws:
OclTypeException

hasState

public boolean hasState(String name)
Returns:
true if this type has a state with the given name

conformsTo

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

equals

public boolean equals(Object o)

hashCode

public int hashCode()
It will be nessary to redefine the hashCode if equality of types is not equality of representation objects.

See Also:
Object.hashCode()

toString

public String toString()

Dresden OCL Toolkit

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