OclAny

OclAny

All types in the UML model and the primitive and collection types in the OCL standard library conforms to the type OclAny. Conceptually, OclAny behaves as a supertype for all the types. Features of OclAny are available on each object in all OCL expressions. OclAny is itself an instance of the metatype AnyType.

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 qualification by OclAny (name of the type) to explicitly refer to the OclAny properties.

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

Operations

=(object2 : OclSelf) : Boolean precedence: EQUALITY

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

post: result = self = object2

<>(object2 : OclSelf) : Boolean precedence: EQUALITY

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

post: result = not (self = object2)

oclAsSet() : Set(OclSelf)

Returns a Set with self as the sole content, unless self is null in which case returns an empty set,

oclAsType(TT)(type : Metaclass(TT)) : TT[?]

Evaluates to self, where self is of the type identified by T. The type T may be any classifier defined in the UML model; if the actual type of self at evaluation time does not conform to T, then the oclAsType operation evaluates to invalid.

In the case of feature redefinition, casting an object to a supertype of its actual type does not access the supertype’s definition of the feature; according to the semantics of redefinition, the redefined feature simply does not exist for the object. However, when casting to a supertype, any features additionally defined by the subtype are suppressed.

post IsSelf: result = self

post IsType: result.oclIsKindOf(type)

oclIsInState(statespec : OclState) : Boolean

Evaluates to true if the self is in the state indentified by statespec.

oclIsInvalid() : Boolean validating

Evaluates to true if the self is equal to OclInvalid.

post: result = self.oclIsTypeOf(OclInvalid)

oclIsKindOf(T)(type : Metaclass(T)) : Boolean

Evaluates to true if the type of self conforms to t. That is, self is of type t or a subtype of t.

oclIsNew() : Boolean

Can only be used in a postcondition. Evaluates to true if the self is created during performing the operation (for instance, it didn’t exist at precondition time).

oclIsTypeOf(T)(type : Metaclass(T)) : Boolean

Evaluates to true if self is of the type t but not a subtype of t

oclIsUndefined() : Boolean validating

Evaluates to true if the self is equal to invalid or equal to null.

post: result = self.oclIsTypeOf(OclVoid) or self.oclIsTypeOf(OclInvalid)

oclLog() : OclSelf

Evaluates to the self, with the side effect of generating a log message comprising self.

oclLog(message : String) : OclSelf

Evaluates to the self, with the side effect of generating a log message comprising message followed by self.

oclType() : Metaclass(OclSelf)

Evaluates to the type of which self is an instance.

toString() : String

Returns a string representation of self.