de.tuberlin.cs.cis.ocl.type
Class Type

java.lang.Object
  |
  +--de.tuberlin.cs.cis.ocl.type.Type
Direct Known Subclasses:
Classifier, ExpressionType, ModelType

public class Type
extends java.lang.Object

OCL 1.5 defines a classifier and an instance-level (refer 6.5.11 Features on Classes Themselves). All types defined in a model, or predefined whithin OCL, have a type. An instance of this class represents an general instance of such a type for type checking purposes. For more information about properties of types refer to chapter 6.8 Predefined OCL Types of the OCL 1.5 Standard. Note: The class Type should not be further extended, without a descent investigation of side effects. The current known subtypes are: Classifier, ExpressionType and ModelType. Expressed in UML-Notation the gerneralization is expected to be complete.

Author:
fchabar

Field Summary
static Type ABoolean
          An arbitrary instance of the predefined Type Boolean
static Type AnEnumeration
          An arbitrary instance of the predefined Type Enumeration
static Type AnInteger
          An arbitrary instance of the predefined Type Integer
static Type AnOclAny
          An arbitrary instance of the predefined Type OclAny
static Type AnOclState
          An arbitrary instance of the predefined Type OclState
static Type AReal
          An arbitrary instance of the predefined Type Real
static Type AString
          An arbitrary instance of the predefined Type String
 
Method Summary
static Type ABag(Type elemType)
          An arbitrary instance of the predefined type Bag(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).
static Type ACollection(Type elemType)
          An arbitrary instance of the predefined type Collection(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).
static Type ASequence(Type elemType)
          An arbitrary instance of the predefined type Sequence(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).
static Type ASet(Type elemType)
          An arbitrary instance of the predefined type Set(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).
 boolean conforms(Type type)
          A general instance of a type conforms to another general instance if its type conforms to the type of the other general instance.
 boolean equals(java.lang.Object object)
           
 Classifier getClassifier()
          Returns the classifier of this type.
static Type getCollectionOfType(Type type, Type elemType)
          Returns a general instance of/or a collection type with the specified element type.
 Type getElementType()
          Returns the parameter of a collection.
 Property getOperation(java.lang.String name, Type[] params)
          Resolves a operation on this type.
 Property getStructuralFeature(java.lang.String name, Type[] qualifiers)
          Resolves a structural feature on this type (e.g. an attribute or an association).
 boolean isClassifier()
          Provides the information if this instance is a classifier.
 boolean isCollectionType()
          Tests if this is an general instance of a predefined collection type (i.e.
 boolean isDescribedBy(ClassifierDescriptor descriptor)
          Tests if this instance's type is described by the specified model type descriptor.
 boolean isEnumerationType()
          Tests if this type is an enumeration type.
 boolean isExpressionType()
          Tests if this type is derived from the OclExpression-type.
 boolean isInstanceOf(Classifier type)
          Tests if this is an instance of the specified type.
 boolean isModelType()
          Tests if this type is a model type.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ABoolean

public static Type ABoolean
An arbitrary instance of the predefined Type Boolean


AReal

public static Type AReal
An arbitrary instance of the predefined Type Real


AnInteger

public static Type AnInteger
An arbitrary instance of the predefined Type Integer


AString

public static Type AString
An arbitrary instance of the predefined Type String


AnOclState

public static Type AnOclState
An arbitrary instance of the predefined Type OclState


AnEnumeration

public static Type AnEnumeration
An arbitrary instance of the predefined Type Enumeration


AnOclAny

public static Type AnOclAny
An arbitrary instance of the predefined Type OclAny

Method Detail

ACollection

public static Type ACollection(Type elemType)
An arbitrary instance of the predefined type Collection(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).


ASet

public static Type ASet(Type elemType)
An arbitrary instance of the predefined type Set(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).


ABag

public static Type ABag(Type elemType)
An arbitrary instance of the predefined type Bag(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).


ASequence

public static Type ASequence(Type elemType)
An arbitrary instance of the predefined type Sequence(T), where T is a type or an instance of a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).


getCollectionOfType

public static Type getCollectionOfType(Type type,
                                       Type elemType)
Returns a general instance of/or a collection type with the specified element type. The type of the collection is determined through the specified type. Actually this method sets the element type of the specified type.

Parameters:
type - an arbitrary type, where type.isCollectionType() == true
elemType - an arbitrary type, not equal null. The type is used as the new element type of the returned collection.
Returns:
type with elemType as its element type.

getOperation

public Property getOperation(java.lang.String name,
                             Type[] params)
                      throws UndefinedFeatureException
Resolves a operation on this type. The operation is specified and differed through its method name and its parameters.

Parameters:
name - the name of the operation
params - the instance-types of the operation's parameters. If no parameters are defined the parameter can be null.
Returns:
The general instance of the return type of the operation.
Throws:
UndefinedFeatureException - thrown if the operation is not defined on the specified type.

getStructuralFeature

public Property getStructuralFeature(java.lang.String name,
                                     Type[] qualifiers)
                              throws UndefinedFeatureException
Resolves a structural feature on this type (e.g. an attribute or an association). A structural feature is specified via its name. In case of an association qualifiers can be specified as described in OCL 1.5 (6.4.7 Navigation through Qualified Associations). Predefined simple types do not define any structural features. Collection types define via its shorthand notation for collect, the collect operation as structural feature (refer 6.6.2.1 Shorthand for Collect)

Parameters:
name - the name of the feature
qualifiers - the qualifiers of an association. If qualifiers are not defined this parameter can be null.
Throws:
UndefinedFeatureException - thrown if this type does not define the searched feature.

conforms

public boolean conforms(Type type)
A general instance of a type conforms to another general instance if its type conforms to the type of the other general instance. For more information refer to 6.4.4: Type Conformance.

Parameters:
type - an arbitrary instance or type not equal null.
Returns:
true if this type conforms to the parameter.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

isCollectionType

public boolean isCollectionType()
Tests if this is an general instance of a predefined collection type (i.e. Collection(T), Set(T), Bag(T) or Sequence(T), where T is an arbitrary instance of OclType.

Returns:
true if this is an collection type, false otherwise.

getElementType

public Type getElementType()
Returns the parameter of a collection. If this instance is not of type collection type, the type returned is undefined.

Returns:
If this is an instance of a collection type, the parameter is returned, null otherwise.

isExpressionType

public boolean isExpressionType()
Tests if this type is derived from the OclExpression-type.

Returns:
true if this type-instance is derived from an expression type, false otherwise.

isModelType

public boolean isModelType()
Tests if this type is a model type.

Returns:
true if this type is derived from a model type, false otherwise.

isClassifier

public boolean isClassifier()
Provides the information if this instance is a classifier.

Returns:
true if this instance is a classifier, false otherwise.

isEnumerationType

public boolean isEnumerationType()
Tests if this type is an enumeration type.

Returns:
true if this is an enumeration type, false otherwise.

isInstanceOf

public boolean isInstanceOf(Classifier type)
Tests if this is an instance of the specified type.

Parameters:
type - an arbitrary instance of OclType.
Returns:
true if this is an instance of the parameter, false otherwise.

getClassifier

public Classifier getClassifier()
Returns the classifier of this type.

Returns:
the type this type/generell instance is derived from.

isDescribedBy

public boolean isDescribedBy(ClassifierDescriptor descriptor)
Tests if this instance's type is described by the specified model type descriptor.

Returns:
true if this instance's type is described by the specified model type descriptor, otherwise false.

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object