# OclElement

## `OclElement`

The type OclElement is the implicit supertype of any user-defined type that has no explicit supertypes. Operations defined for OclElement are therefore applicable to all user-defined types.

conformsTo `OclAny`

Attributes

`OclElement : Bag(OclElement[*|?])`

`OclElement : Bag(OclElement[*|?])`

`oclContents : Set(OclElement)`

The composed contents of self.

Associations

`oclContainer : OclElement[?]`

The object for which self is a composed content or null if there is no such object.

Operations

`allInstances() : Set(OclSelf)`

Return a set of all instances of the type and derived types of self.

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

Evaluates to `self`, where `self` is of the model type identified by `TT`.

Most model elements have metamodel types for use with oclAsType, but no model type and so the return is `invalid`.

Model elements such as UML’s InstnaceSpecification that do support distinct model and metamodel types return `self` with the cast type `TT` that may be used for further navigation. If the actual model 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 oclAsModelType call is not well-formed if the classification is ambiguous.

`post IsSelf: result = self
`

`oclContainer() : OclElement[?]`

Returns the object for which self is a composed content or null if there is no such object.

`oclContents() : Set(OclElement)`

Returns the composed contents of self.

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

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

The return is normally `false` since few model elements have model types. UML’s InstanceSpecification::classifier provides a multiple classification for a model type.

`oclModelType() : OclSelf[1]`

Evaluates to the most derived model type of which `self` is currently an instance. If `self` is an instance of a multiply classified model type, the return is the most derived type of the current classification which is established by an `oclAsModelType()` call.

The return is normally `invalid` since few model elements have model types. UML’s InstanceSpecification::classifier provides a multiple classification for a model type.

`oclModelTypes() : Set(OclSelf[*|?])`

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

The return is normally `invalid` since few model elements have model types. UML’s InstanceSpecification::classifier provides a multiple classification for a model type.