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

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

public final class ModelType
extends Type

OCL 1.5 paragraph 6.4.1 Types from the (UML) Model: Each OCL expression is written in the context of a (UML) Model, a number of classifiers ..., their features ans associations, and their generalizations. All classifiers from the (UML) model are types in the OCL expressions that are attached to the model. These types are expressed through this class. Each instance of a ModelType therefore represents an instance of a model's classifier.


Field Summary
 
Fields inherited from class de.tuberlin.cs.cis.ocl.type.Type
ABoolean, AnEnumeration, AnInteger, AnOclAny, AnOclState, AReal, AString
 
Constructor Summary
ModelType(ClassifierDescriptor descriptor)
          Constructs a model type, whose behavior is defined via a ClassifierDescriptor.
 
Method Summary
 boolean conforms(Type type)
          Uses the contract inherited from Type.
 boolean definesState(java.lang.String state)
          Tests if this model type defines the specified state.
 boolean equals(java.lang.Object o)
           
 Type getAlternativeCollectionType()
          If this model type has been navigated (isNavigated() == true) over an association with multiplicity zero or one, this method returns the alternative collection type that can be used instead of this model type (for more information refer OCL1.5 6.5.4.2 Navigation over Associations with Multiplicity Zero or One).
 ClassifierDescriptor getDescriptor()
          Returns the descriptor of this model type.
 Property getOperation(java.lang.String name, Type[] params)
          Uses the contract inherited from Type.
 Property getOperation(java.lang.String name, Type[] params, boolean classScoped)
          Uses the contract from getOperation(String, Type[]) on either the instance-level of a model type or on its classifier-level.
 Type getPredefinedSupertype()
           
 Property getStructuralFeature(java.lang.String name, Type[] qualifiers)
          Uses the contract inherited from Type.
 Property getStructuralFeature(java.lang.String name, Type[] qualifiers, boolean classScoped)
          Uses the contract from getStructuralFeature(String, Type[]) on either the instance-level of a model type or on its classifier-level.
 boolean isDescribedBy(ClassifierDescriptor descriptor)
          Tests if this model type is described by the specified ClassifierDescriptor.
 boolean isModelType()
          uses the inherited contract from Type.
 boolean isNavigated()
          Provides the information whether this model type has been addressed in an ocl expression via an navigation.
 java.lang.String toString()
           
 
Methods inherited from class de.tuberlin.cs.cis.ocl.type.Type
ABag, ACollection, ASequence, ASet, getClassifier, getCollectionOfType, getElementType, isClassifier, isCollectionType, isEnumerationType, isExpressionType, isInstanceOf
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModelType

public ModelType(ClassifierDescriptor descriptor)
Constructs a model type, whose behavior is defined via a ClassifierDescriptor.

Parameters:
descriptor - the description of the model type (and its behaviour) this instance should represent.
See Also:
ClassifierDescriptor
Method Detail

conforms

public boolean conforms(Type type)
Uses the contract inherited from Type.

Overrides:
conforms in class Type
Parameters:
type - 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.

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[])

getStructuralFeature

public Property getStructuralFeature(java.lang.String name,
                                     Type[] qualifiers)
                              throws UndefinedFeatureException
Uses the contract inherited from Type.

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

getOperation

public Property getOperation(java.lang.String name,
                             Type[] params,
                             boolean classScoped)
                      throws UndefinedFeatureException
Uses the contract from getOperation(String, Type[]) on either the instance-level of a model type or on its classifier-level.

Parameters:
classScoped - if the operation is class scoped or not.
UndefinedFeatureException
See Also:
Type.getOperation(java.lang.String, Type[])

getStructuralFeature

public Property getStructuralFeature(java.lang.String name,
                                     Type[] qualifiers,
                                     boolean classScoped)
                              throws UndefinedFeatureException
Uses the contract from getStructuralFeature(String, Type[]) on either the instance-level of a model type or on its classifier-level.

Parameters:
classScoped - if the stuctural feature is class scoped or not.
UndefinedFeatureException
See Also:
Type.getStructuralFeature(java.lang.String, Type[])

isModelType

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

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

getPredefinedSupertype

public Type getPredefinedSupertype()

isNavigated

public boolean isNavigated()
Provides the information whether this model type has been addressed in an ocl expression via an navigation.

Returns:
true if this type has been addressed via an naviation, false otherwise.

getAlternativeCollectionType

public Type getAlternativeCollectionType()
If this model type has been navigated (isNavigated() == true) over an association with multiplicity zero or one, this method returns the alternative collection type that can be used instead of this model type (for more information refer OCL1.5 6.5.4.2 Navigation over Associations with Multiplicity Zero or One). Otherwise the result type is undefined.

Returns:
if the result type is defined, the alternative collection type or null otherwise.
See Also:
isNavigated()

definesState

public boolean definesState(java.lang.String state)
Tests if this model type defines the specified state.

Parameters:
state - a state specified through the qualified name as defined in (6.5.10 Predefined properties on All Objects)
Returns:
true if the state is defined for this type in the model, false otherwise.

isDescribedBy

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

Overrides:
isDescribedBy in class Type
Parameters:
descriptor - an arbitrary ClassifierDescriptor, not equal null.
Returns:
true if the state is defined for this type in the model, false otherwise.
See Also:
ClassifierDescriptor, ClassifierDescriptor.equals(java.lang.Object)

equals

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

toString

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

getDescriptor

public ClassifierDescriptor getDescriptor()
Returns the descriptor of this model type.

Returns:
the descriptor describing this model type.