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

java.lang.Object
  |
  +--de.tuberlin.cs.cis.ocl.type.Type
        |
        +--de.tuberlin.cs.cis.ocl.type.ExpressionType

public final class ExpressionType
extends Type

Each OCL expression itself is an object in the context of OCL. The type of the type of the expression is OCLExpression. An instance of ExpressionType represents an instance of that type. Each ExpressionType is parameterized with an evaluation type and or the included iterator and accumulator type. For more information refer to OCL 1.5 6.8.1.6 OclExpression. Note: Although not specified in the standard an OclExpression as implemented in this class is regarded as conforment to its evaluation type.

Author:
fchabar

Field Summary
 
Fields inherited from class de.tuberlin.cs.cis.ocl.type.Type
ABoolean, AnEnumeration, AnInteger, AnOclAny, AnOclState, AReal, AString
 
Constructor Summary
ExpressionType(Type evaluationType)
          Constructs an OclExpression type that evaluates to the specified evaluation type.
ExpressionType(Type iteratorType, Type evaluationType)
          Constructs an OclExpression with an optional iterator.
ExpressionType(Type iteratorType, Type accumulatorType, Type evaluationType)
          Constructs an OclExpression with an optional iterator and accumulator type.
 
Method Summary
 boolean conforms(Type t)
          Uses the inherited contract from Type.
 boolean equals(java.lang.Object o)
           
static Type evaluateType(Type type)
          Evaluates the non expression type of a type.
 Type getAccumulatorType()
          Returns the optional accumulator type of this OclExpression.
 Type getElementType()
          uses the inherited contract from Type.
 Type getEvaluationType()
          Returns the type this expression evaluates to.
 Type getIteratorType()
          Returns the optional iterator type of this OclExpression.
 Property getOperation(java.lang.String name, Type[] params)
          Uses the contract inherited from Type.
 boolean isCollectionType()
          uses the inherited contract from Type.
 boolean isExpressionType()
          uses the inherited contract from Type.
 boolean isModelType()
          uses the inherited contract from Type.
 java.lang.String toString()
           
 
Methods inherited from class de.tuberlin.cs.cis.ocl.type.Type
ABag, ACollection, ASequence, ASet, getClassifier, getCollectionOfType, getStructuralFeature, isClassifier, isDescribedBy, isEnumerationType, isInstanceOf
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpressionType

public ExpressionType(Type evaluationType)
Constructs an OclExpression type that evaluates to the specified evaluation type.


ExpressionType

public ExpressionType(Type iteratorType,
                      Type evaluationType)
Constructs an OclExpression with an optional iterator. The constructed expression evaluates to evaluation type.

Parameters:
evaluationType - the evaluation type of the constructed OclExpression
iteratorType - the optional included iterator type of the OclExpression.

ExpressionType

public ExpressionType(Type iteratorType,
                      Type accumulatorType,
                      Type evaluationType)
Constructs an OclExpression with an optional iterator and accumulator type. The constructed expression evaluates to evaluation type.

Parameters:
iteratorType - the optional included iterator type of the OclExpression.
accumulatorType - the optional included accumumulator type of the OclExpression.
evaluationType - the evaluation type of the constructed OclExpression
Method Detail

evaluateType

public static Type evaluateType(Type type)
Evaluates the non expression type of a type.

Parameters:
type - an arbitrary type, not equal null.
Returns:
if the specified type is an expression type, type the expression evaluates to, otherwise the type itself.

getEvaluationType

public Type getEvaluationType()
Returns the type this expression evaluates to.

Returns:
this OclExpression's evaluation type.

conforms

public boolean conforms(Type t)
Uses the inherited contract from Type. Additionally each OclExpression is regarded as conforment to its evaluation type.

Overrides:
conforms in class Type
Parameters:
t - an arbitrary instance or type not equal null.
Returns:
true if this type conforms to the parameter.
See Also:
Type.conforms(Type)

getOperation

public Property getOperation(java.lang.String name,
                             Type[] params)
                      throws UndefinedFeatureException
Uses the contract inherited from Type. According to the assumed conformance principle of an OclExpression to its evaluation type, an operation is resolved not only on OclExpression but rather on its evaluation type.

Overrides:
getOperation in class Type
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.
See Also:
Type.getOperation(java.lang.String, Type[])

getIteratorType

public Type getIteratorType()
Returns the optional iterator type of this OclExpression.

Returns:
the optional iterator type or if not specified null

getAccumulatorType

public Type getAccumulatorType()
Returns the optional accumulator type of this OclExpression.

Returns:
the optional accumulator type or if not specified null

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Type
See Also:
Object.equals(Object)

isExpressionType

public boolean isExpressionType()
uses the inherited contract from Type.

Overrides:
isExpressionType in class Type
Returns:
true
See Also:
Type.isExpressionType().

isModelType

public boolean isModelType()
uses the inherited contract from Type. An expression type is regarded as a model type, if its evaluation type is a model type.

Overrides:
isModelType in class Type
Returns:
true if this type is derived from a model type, false otherwise.
See Also:
Type.isModelType()

isCollectionType

public boolean isCollectionType()
uses the inherited contract from Type. An expression type is regarded as a collection type, if its evaluation type is a collection type.

Overrides:
isCollectionType in class Type
Returns:
true if this is an collection type, false otherwise.
See Also:
Type.isCollectionType()

getElementType

public Type getElementType()
uses the inherited contract from Type.

Overrides:
getElementType in class Type
Returns:
the element type of the evaluation type.
See Also:
Type.getElementType()

toString

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