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

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

public final class Classifier
extends Type

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 within OCL, have a type. This type is an instance of the OCL Type called OclType, which is represented through this class. An instance of Classifier therefore represents a type itself. Refer for more detail chapter 6.8 Predefined OclTypes especially paragraph 6.8.1.1 OclType.

Author:
fchabar

Field Summary
static Classifier Boolean
          The predefined type Boolean as defined in OCL 1.5 (6.8.1.10)
static Classifier Enumeration
          The predefined type Enumeration as defined in OCL 1.5 (6.8.1.11)
static Classifier Integer
          The predefined type Integer as defined in OCL 1.5 (6.8.1.8)
static Classifier OclAny
          The predefined type OclAny as defined in OCL 1.5 (6.8.1.2)
static Classifier OclState
          The predefined type OclState as defined in OCL 1.5 (6.8.1.5)
static Classifier OclType
          The metatype OclType as defined in OCL 1.5 (6.8.1.1)
static Classifier Real
          The predefined type Real as defined in OCL 1.5 (6.8.1.7)
static Classifier String
          The predefined type String as defined in OCL 1.5 (6.8.1.9)
 
Fields inherited from class de.tuberlin.cs.cis.ocl.type.Type
ABoolean, AnEnumeration, AnInteger, AnOclAny, AnOclState, AReal, AString
 
Method Summary
static Classifier Bag(Classifier T)
          The predefined type Bag(T), where T is a type that parameterizes the bag as defined in OCL 1.5 (6.8.2.3).
static Classifier Collection(Classifier T)
          The predefined type Collection(T), where T is a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).
 boolean conforms(Type t)
          Test if this type conforms to the parameter.
 Classifier getClassifier()
          Returns the classifier of this type.
 Type getElementType()
          Returns the Type a collection is parameterized with.
 Type getInstanceType()
          Since OCL 1.5 is a declarative language a type specified exaclty one type.
 Property getOperation(java.lang.String name, Type[] params)
          Resolves a operation on this classifier.
 Property getStructuralFeature(java.lang.String name, Type[] qualifiers)
          Resolves a structural feature on this classifier (e.g. an attribute or an association).
 boolean isClassifier()
          Provides the information that this type is a classifier.
 boolean isCollectionType()
          Tests if this is a collection type (e.g.
 boolean isInstanceOf(Classifier type)
          Tests if this is an instance of the specified type.
static Classifier OclType(Type type)
          Constructs an OclType with a specified instance-type.
static Classifier Sequence(Classifier T)
          The predefined type Sequence(T), where T is a type that parameterizes the sequence as defined in OCL 1.5 (6.8.2.4).
static Classifier Set(Classifier T)
          The predefined type Set(T), where T is a type that parameterizes the set as defined in OCL 1.5 (6.8.2.2).
 java.lang.String toString()
           
 
Methods inherited from class de.tuberlin.cs.cis.ocl.type.Type
ABag, ACollection, ASequence, ASet, equals, getCollectionOfType, isDescribedBy, isEnumerationType, isExpressionType, isModelType
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OclType

public static Classifier OclType
The metatype OclType as defined in OCL 1.5 (6.8.1.1)


OclAny

public static Classifier OclAny
The predefined type OclAny as defined in OCL 1.5 (6.8.1.2)


OclState

public static Classifier OclState
The predefined type OclState as defined in OCL 1.5 (6.8.1.5)


Real

public static Classifier Real
The predefined type Real as defined in OCL 1.5 (6.8.1.7)


Integer

public static Classifier Integer
The predefined type Integer as defined in OCL 1.5 (6.8.1.8)


String

public static Classifier String
The predefined type String as defined in OCL 1.5 (6.8.1.9)


Boolean

public static Classifier Boolean
The predefined type Boolean as defined in OCL 1.5 (6.8.1.10)


Enumeration

public static Classifier Enumeration
The predefined type Enumeration as defined in OCL 1.5 (6.8.1.11)

Method Detail

Collection

public static Classifier Collection(Classifier T)
The predefined type Collection(T), where T is a type that parameterizes the collection as defined in OCL 1.5 (6.8.2.1).

Parameters:
T - The element type of the parameterized collection:

Set

public static Classifier Set(Classifier T)
The predefined type Set(T), where T is a type that parameterizes the set as defined in OCL 1.5 (6.8.2.2).

Parameters:
T - The element type of the parameterized set:

Bag

public static Classifier Bag(Classifier T)
The predefined type Bag(T), where T is a type that parameterizes the bag as defined in OCL 1.5 (6.8.2.3).

Parameters:
T - The element type of the parameterized bag:

Sequence

public static Classifier Sequence(Classifier T)
The predefined type Sequence(T), where T is a type that parameterizes the sequence as defined in OCL 1.5 (6.8.2.4).

Parameters:
T - The element type of the parameterized sequence:

OclType

public static Classifier OclType(Type type)
Constructs an OclType with a specified instance-type. The returned Classifier is settled in the classifier-level, an instance will have the specified type in the instance-level. This method is useful to describe classifier settled in the model or new types.

Parameters:
type - an instance described through its type.
Returns:
The OclType classifier of the instance.

getInstanceType

public Type getInstanceType()
Since OCL 1.5 is a declarative language a type specified exaclty one type. This type is represented through the returned type that is defined in the OCL instance-level.

Returns:
null if this == OclType

isClassifier

public boolean isClassifier()
Provides the information that this type is a classifier.

Overrides:
isClassifier in class Type
Returns:
true

isInstanceOf

public boolean isInstanceOf(Classifier type)
Tests if this is an instance of the specified type. All instances of Classifier are instances of OclType, except OclType itself.

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

isCollectionType

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

Overrides:
isCollectionType in class Type
Returns:
true if this is an collection classifier, false otherwise.

conforms

public boolean conforms(Type t)
Test if this type conforms to the parameter. A Classifier conforms to its supertypes. The conformance is transitive (refer to OCL 1.5 6.4.4: Type Conformance).

Overrides:
conforms in class Type
Parameters:
t - an arbitrary Type not equal to null.
Returns:
true if t is a supertype of this type, false otherwise.

getClassifier

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

Overrides:
getClassifier in class Type
Returns:
Since each classifier is derived from OclType, OclType with this as explicite instance type is returned.

getElementType

public Type getElementType()
Returns the Type a collection is parameterized with. If this type is not a collection type, the type returned is undefined.

Overrides:
getElementType in class Type
Returns:
If this is a collection type, the parameter is returned, null otherwise.

getOperation

public Property getOperation(java.lang.String name,
                             Type[] params)
                      throws UndefinedFeatureException
Resolves a operation on this classifier. The operation is specified and differed through its method name and its parameters. A Classifier specifies all methods defined on OclType. This specification can be supplemented with operations defined on the classifier-level in the model.

Overrides:
getOperation in class Type
Parameters:
name - the name of the operation
params - the instance-level types the parameters of the operation have. If no parameters are defined the parameter can be null.
Returns:
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 classifier (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). OclType itself does not define any structural features. Thus the model must define the searched feature or it is not defined.

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

toString

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