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.
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.
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
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.
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