The OclAny, OclVoid, and OclMessage types

OclAny

The type OclAny is the supertype of all types in the UML model and the primitive types in the OCL Standard Library. The collection types from the OCL Standard Library are not subtypes of OclAny. Properties of OclAny are available on each object in all OCL expressions. OclAny is itself an instance of the metatype Classifier.

All classes in a UML model inherit all operations defined on OclAny. To avoid name conflicts between properties in the model and the properties inherited from OclAny, all names on the properties of OclAny start with `ocl.' Although theoretically there may still be name conflicts, they can be avoided. One can also use the oclAsType() operation to explicitly refer to the OclAny properties.

Operations of OclAny, where the instance of OclAny is called object.
 


OclMessage

This section contains the definition of the standard type OclMessage. As defined in this section, each ocl message type is ctually a template type with one parameter. `T' denotes the parameter. A concrete ocl message type is created by substituting an operation or signal for the T.

The predefined type OclMessage is an instance of OclMessageType. Every OclMessage is fully determined by either the
operation, or signal given as parameter. Note that there is conceptually an undefined (infinite) number of these types, as each is determined by a different operation or signal. These types are unnamed. Every type has as attributes the name of the operation or signal, and either all formal parameters of the operation, or all attributes of the signal. OclMessage is itself an instance of the metatype OclMessageType.

OclMessage has a number of predefined operations, as shown in the OCL Standard Library.
 

OclVoid

The type OclVoid is a type that conforms to all other types. It has one single instance called OclUndefined. Any propertycall applied on OclUndefined results in OclUndefined, except for the operation oclIsUndefined(). OclVoid is itself an instance of the metatype Classifier.

Operations and well-formedness rules

OclAny
= (object2 : OclAny) : Boolean

True if self is the same object as object2. Infix operator.

post: result = (self = object2)

<> (object2 : OclAny) : Boolean

True if self is a different object from object2. Infix operator.

post: result = not (self = object2)

oclIsNew() : Boolean

Can only be used in a postcondition. Evaluates to true if the self is created during performing the operation. I.e. it didn't exist at precondition time.

post: self@pre.oclIsUndefined()

oclIsUndefined() : Boolean

Evaluates to true if the self is equal to OclUndefined.

post: result = self.isTypeOf( OclVoid )

oclAsType(typename : OclType) : T

Evaluates to self, where self is of the type identified by typename. Typename may be in the format Package::subPackage::classifier.

post: (result = self) and result.oclIsTypeOf( typeName )

oclIsTypeOf(typename : OclType) : Boolean

Evaluates to true if the self is of the type identified by typename. Typename may be in the format Package::subPackage::classifier.

post: -- TBD

oclIsKindOf(typename : OclType) : Boolean

Evaluates to true if the self conforms to the type identified by typename. Typename may be in the format
Package::subPackage::classifier.

post: -- TBD

oclIsInState(statename : OclState) : Boolean

Evaluates to true if the self is in the state indentified by statename. Statename may be in the format Class::State::subState.

post: -- TBD

allInstances() : Set( T )

Returns all instances of self. Type T is equal to self. May only be used for classifiers that have a finite number of instances. This is the case for, for instance, user defined classes because instances need to be created explicitly. This is not the case for, for instance, the standard String, Integer, and Real types.

pre: self.isKindOf( Classifier ) -- self must be a Classifier
    and -- TBD -- self must have a finite number of instances
    -- it depends on the UML 2.0 metamodel how this can be
    -- expressed
post: -- TBD
 

OclMessage


hasReturned() : Boolean

True if type of template parameter is an operation call, and the called operation has returned a value. This implies the fact that the message has been sent. False in all other cases.

post: --

result() : <<The return type of the called operation>>

Returns the result of the called operation, if type of template parameter is an operation call, and the called operation has returned a value. Otherwise the undefined value is returned.

pre: hasReturned()

isSignalSent() : Boolean

Returns true if the OclMessage represents the sending of a UML Signal.

isOperationCall() : Boolean

Returns true if the OclMessage represents the sending of a UML Operation call.
 

OclVoid

oclIsUndefined() : Boolean

Evaluates to true if the object is equal to OclUndefined.

post: result = true

[1] OclVoid has only one instance
.
context OclVoid inv:
OclVoid.allinstances()->size() = 1