de.tuberlin.cs.cis.ocl.eval.instance
Class OclAnyInstance

java.lang.Object
  |
  +--de.tuberlin.cs.cis.ocl.eval.instance.PredefinedInstance
        |
        +--de.tuberlin.cs.cis.ocl.eval.instance.OclAnyInstance
All Implemented Interfaces:
Instance, OclAny
Direct Known Subclasses:
BooleanInstance, EnumerationInstance, ModelInstance, OclStateInstance, RealInstance, StringInstance

public class OclAnyInstance
extends PredefinedInstance
implements OclAny

Author:
fchabar Represents an instance of the OCL type OclAny.

Constructor Summary
OclAnyInstance(Type runtimeType, java.lang.Object representation)
          Constructs an instance of the OCL type OclAny.
 
Method Summary
 OclBoolean eq(OclAny object2)
          Represents the '='-operation of the type OclAny.
 boolean equals(java.lang.Object o)
           
 OclBoolean neq(OclAny object2)
          Represents the '<>'-operation of the type OclAny.
 OclAny oclAsType(OclType type)
          Results in this instance, but of known type type.
 OclBoolean oclInState(OclState state)
          Results in true if this instance is in the state state, otherwise results in false.
 OclBoolean oclIsKindOf(OclType type)
          True if type is one of the types of object, or one of the supertypes (transitive) of the types of object.
 OclBoolean oclIsNew()
          Can only be used in a postcondition.
 OclBoolean oclIsTypeOf(OclType type)
          True if type is equal to one of the types of object.
 
Methods inherited from class de.tuberlin.cs.cis.ocl.eval.instance.PredefinedInstance
getRepresentation, getRuntimeType, getValue, hashCode, invoke, navigate, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OclAnyInstance

public OclAnyInstance(Type runtimeType,
                      java.lang.Object representation)
Constructs an instance of the OCL type OclAny. The runtime type and the Java representation must be specified.

Parameters:
runtimeType - the runtime type of the constructed OclAny value
representation - the Java representation of the constructed value
Method Detail

eq

public OclBoolean eq(OclAny object2)
Description copied from interface: OclAny
Represents the '='-operation of the type OclAny.

Note: The type OclAny is rather an abstract supertype. Therefore it is convenient to return true if this instance is equal to object2 (Object#equals(Object)).

Specified by:
eq in interface OclAny
Parameters:
object2 - an instance of OclAny (!= null)
Returns:
True if this instance is the same object as object2, False otherwise.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

neq

public OclBoolean neq(OclAny object2)
Description copied from interface: OclAny
Represents the '<>'-operation of the type OclAny.

Specified by:
neq in interface OclAny
Parameters:
object2 - an instance of OclAny (!= null)
Returns:
True if this instance is a different object from object2, False otherwise.

oclIsKindOf

public OclBoolean oclIsKindOf(OclType type)
Description copied from interface: OclAny
True if type is one of the types of object, or one of the supertypes (transitive) of the types of object.

Specified by:
oclIsKindOf in interface OclAny
Parameters:
type - an OCL type (!= null)
Returns:
True if type is one of the types of this instance, or one of the supertypes (transitive) of the types of this instance, False otherwise.

oclIsTypeOf

public OclBoolean oclIsTypeOf(OclType type)
Description copied from interface: OclAny
True if type is equal to one of the types of object.

Specified by:
oclIsTypeOf in interface OclAny
Parameters:
type - an OCL type (!= null)
Returns:
True if type is equal to one of the types of this instance, False otherwise.

oclAsType

public OclAny oclAsType(OclType type)
Description copied from interface: OclAny
Results in this instance, but of known type type. Results in Undefined if the actual type of this instance is not type or one of its subtypes. pre : self.oclIsKindOf(type)

Specified by:
oclAsType in interface OclAny
Parameters:
type - an OCL type (!= null)
Returns:
Results in this instance, but of known type type.

oclInState

public OclBoolean oclInState(OclState state)
Description copied from interface: OclAny
Results in true if this instance is in the state state, otherwise results in false. The argument is a name of a state in the state machine corresponding with the class of this instance.

Specified by:
oclInState in interface OclAny
Parameters:
state - a state (!= null)
Returns:
True if object is in the state state, False otherwise.

oclIsNew

public OclBoolean oclIsNew()
Description copied from interface: OclAny
Can only be used in a postcondition. Evaluates to true if the this instance is created during performing the operation. That is it didn’t exist at precondition time.

Note: Each operation in the OCL-Context is a query. Therefore the state of the model can not be changed. That is this operation should always result in False.

Specified by:
oclIsNew in interface OclAny
Returns:
True if the this instance is created during performing the operation, False otherwise.