# OclAny

## `OclAny`

The number of elements in the collection `self`.essions. 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[1]` precedence: `EQUALITY`

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

`post: result = self = object2
`

`<>(object2 : OclSelf[?]) : Boolean[1]` precedence: `EQUALITY`

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

`post: result = not (self = object2)
`

`oclAsSet() : Set(OclSelf)[*|1]`

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

`oclAsType(TT)(type : TT[?]) : TT[1] invalidating`

Evaluates to `self`, where `self` is of the type identified by `TT`. The type `TT` may be any classifier defined by OCL or a user metamodel; if the actual type of `self` at evaluation time does not conform to `TT`, then the oclAsType operation evaluates to `invalid`.

If `self` is a multiply classified instance, the current classification used for OCL navigation is changed to the classification to which `TT` conforms. The oclAsType call is not well-formed if the classification is ambiguous.

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
`

`oclIsInState(statespec : OclState[?]) : Boolean[1]`

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

`oclIsInvalid() : Boolean[1] validating`

Evaluates to `true` if the `self` is equal to OclInvalid.

`oclIsKindOf(type : OclType[?]) : Boolean[1]`

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

`oclIsNew() : Boolean[1]`

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(type : OclType[?]) : Boolean[1]`

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

`oclIsUndefined() : Boolean[1] validating`

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

`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() : OclSelf[1]`

Evaluates to the most derived type of which `self` is currently an instance. If `self` is an instance of a multiply classified type, the return is the most derived type of the current classification which is established when the instance is passed to OCL, or re-established by an `oclAsType()` call.

`oclTypes() : Set(OclSelf)`

Evaluates to all of the most derived type of which `self` is an instance. The return from `oclTypes()` is normally equivalent to that from `oclType()` unless `self` is an instance of multiply classified type.

`toString() : String[1]`

Returns a string representation of `self`.