de.tuberlin.cs.cis.ocl.model.check
Interface ClassifierDescriptor

All Known Subinterfaces:
EnumerationTypeDescriptor
All Known Implementing Classes:
DescAdapter, ExampleEnumDesc, ExampleTypeDesc, MofClassifier, MofEnumerationType, StateModel

public interface ClassifierDescriptor

Describes a classifier of the model. All classifiers in the model are types in the OCL-context. A type in OCL is defined via its properties and the state of its instances.

Note: "The evaluation of an OCL expression is instanceous. This means that the states of objects in a model cannot change during evaluation." [OCL1.5 6-3] That is the types cannot either.

Author:
fchabar
See Also:
  • OCL 1.5 Standard

  • Method Summary
     boolean equals(java.lang.Object type)
              Returns true if the specified Object is a ClassifierDescriptor describing the same classifier as this ClassifierDescriptor.
     TypedAssociation getAssociation(java.lang.String roleName, Type[] qualifiers)
              Resolves and returns the specified association qualifiable by the specified qualifier parameters on this type.
     TypedProperty getAttribute(java.lang.String attrName, boolean classScoped)
              Resolves and returns the specified attribute on this type.
     java.lang.String getName()
              Returns the name of the type.
     Classifier getOclSupertype()
              Returns the predefined OCL 1.5 supertype of this type.
     TypedProperty getOperation(java.lang.String operationName, ClassifierDescriptor[] params, boolean classScoped)
              Resolves and returns the specified operation on this type.
     boolean isStateDefined(java.lang.String state)
              Returns true if the specified state is defined on the statemachine attached to this type.
     boolean isSubtypeOf(ClassifierDescriptor type)
              Returns true if this type is a subtype of the specified type.
     

    Method Detail

    equals

    public boolean equals(java.lang.Object type)
    Returns true if the specified Object is a ClassifierDescriptor describing the same classifier as this ClassifierDescriptor.

    Overrides:
    equals in class java.lang.Object
    Returns:
    true if the specified Object is a ClassifierDescriptor describing the same classifier as this ClassifierDescriptor, false otherwise.

    getName

    public java.lang.String getName()
    Returns the name of the type. The name is mainly used for feedback purposes. It is recommanded to specify the name qualified.

    Returns:
    the name of the type.

    isSubtypeOf

    public boolean isSubtypeOf(ClassifierDescriptor type)
    Returns true if this type is a subtype of the specified type. This relation will be used to build up a type conformance hierarchy within OCL, which will be used in either the type check (for example in oclAsType(OclType)) - and evaluation process (for example in oclIsKindOf(OclType)).

    Parameters:
    type - a possible supertype of the model.
    Returns:
    true if this type is a suptype of the specified type, otherwise false.

    getOperation

    public TypedProperty getOperation(java.lang.String operationName,
                                      ClassifierDescriptor[] params,
                                      boolean classScoped)
                               throws UndefinedFeatureException
    Resolves and returns the specified operation on this type. The operation is specified via its name, its paremeter and if its classifier scoped or not. The identity and equality of operations can be determined through the model implementor. It is assumed that the model is self-contained. Thus the parmeters will all be model classifier.

    Parameters:
    operationName - the name of the operation.
    params - the parameters of the operation.
    classScoped - true if the operation is called on the classifier itself.
    Returns:
    the specified operation.
    Throws:
    UndefinedFeatureException - if the operation could not be resolved on this type.

    getAssociation

    public TypedAssociation getAssociation(java.lang.String roleName,
                                           Type[] qualifiers)
                                    throws UndefinedFeatureException
    Resolves and returns the specified association qualifiable by the specified qualifier parameters on this type. The association is specified via its role-name. The qualifiers can be used denotationally so that the type can also be predefined (for example an integer). If the qualifier is a model type the qualifiers will be instances of de.tuberlin.cs.cis.ocl.type.ModelType.

    Parameters:
    roleName - the role-name of the association/navigation.
    Returns:
    the specified association
    UndefinedFeatureException
    See Also:
    ModelType.isDescribedBy(ClassifierDescriptor)

    getAttribute

    public TypedProperty getAttribute(java.lang.String attrName,
                                      boolean classScoped)
                               throws UndefinedFeatureException
    Resolves and returns the specified attribute on this type. The attribute is specified via its name.

    Parameters:
    attrName - the name of the attribute
    classScoped - true if the attribute is called on the classifier itself.
    Returns:
    the attribute on this type.
    Throws:
    UndefinedFeatureException - if the attribute is not defined on this type.

    getOclSupertype

    public Classifier getOclSupertype()
    Returns the predefined OCL 1.5 supertype of this type. Within the OCL 1.5 context, the type OclAny is the supertype of all types in the model. Thus each subtype of OclAny and OclAny itself can be the predefined supertype of this type (that is Boolean, Integer, Real, String, Enumeration and OclState; the type OclExpression is not supported). The declaration of the predefined supertype will then be used to continue the conformance hierarchy within OCL.

    Note: Virtually the predefined supertype is used to import each model type into the OCL context. Especially the model primitive types should extend its natural supertype in order to use the OCL-functionality in its full extents.

    Example (from OCL 1.5 - 6.2.2 Example Class Diagram): context Company inv:
      self.numberOfEmployees > 50

    1) The UML-Type Integer does not extend the predefined type Integer: The expression self.numberOfEmployees would result in an UML-Integer. Sinse neither the UML-Integer nor its supertype OclAny define the Operation >(UML-Integer, OCL-Integer), the expression would be undefined.

    2) The UML-Type Integer extends the predefined type Integer: The same expression would result in an UML-Integer that inherits the operation >(OCL-Integer, OCL-Integer). Sinse the UML-Integer would be a subtype of OCL-Integer, the operation would result in the expected OCL-Boolean.

    Returns:
    the predefined supertype of this model type in order to import the model type into the OCL context.

    isStateDefined

    public boolean isStateDefined(java.lang.String state)
    Returns true if the specified state is defined on the statemachine attached to this type. The state will be used for the predefined Operation oclInState(OclState). The argument state will be represented as a String. The form of the String is described in the Standard itself.

    Parameters:
    state - a state of this type's statemachine.
    Returns:
    true if this type has at least one statemachine attached to itself which defines the specified state, false otherwise.