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

java.lang.Object
  |
  +--de.tuberlin.cs.cis.ocl.eval.instance.PredefinedInstance
All Implemented Interfaces:
Instance
Direct Known Subclasses:
CollectionInstance, OclAnyInstance, OclExpressionInstance, OclTypeInstance

public abstract class PredefinedInstance
extends java.lang.Object
implements Instance

Represents instances of OCL predefined types.

Author:
fchabar

Constructor Summary
PredefinedInstance(Type type, java.lang.Object representation)
          Constructs a predefined OCL instance.
 
Method Summary
 java.lang.Object getRepresentation()
          Returns the Java representation of this instance.
 Type getRuntimeType()
          Returns the OCL runtime type of this instance.
 Instance getValue(Property attr)
          Returns the value of an attribut of this instance.
 int hashCode()
           
 Instance invoke(Property operation, Instance[] args)
          Invokes an operation on this instance.
 Instance navigate(Property assoc, Instance[] qualifiers)
          Navigates an association of this instance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PredefinedInstance

public PredefinedInstance(Type type,
                          java.lang.Object representation)
Constructs a predefined OCL instance. The instance is specified by its OCL runtime type and a Java representation.

Parameters:
type - the OCL runtime type of the predefined instance
representation - the Java representation of the instance.
Method Detail

getRepresentation

public java.lang.Object getRepresentation()
Returns the Java representation of this instance.

Returns:
this instance's Java representation

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRuntimeType

public Type getRuntimeType()
Description copied from interface: Instance
Returns the OCL runtime type of this instance.

Specified by:
getRuntimeType in interface Instance
Returns:
the OCL runtime type of this instance.

getValue

public Instance getValue(Property attr)
                  throws FeatureInvocationException,
                         UndefinedValueException
Description copied from interface: Instance
Returns the value of an attribut of this instance.

Specified by:
getValue in interface Instance
Parameters:
attr - the attribute to access
Returns:
the value of the accessed attribute
Throws:
UndefinedValueException - thrown if the specified feature is undefined on this instance.
FeatureInvocationException - thrown if an exception occurs during the property call.

invoke

public Instance invoke(Property operation,
                       Instance[] args)
                throws FeatureInvocationException,
                       UndefinedValueException
Description copied from interface: Instance
Invokes an operation on this instance.

Specified by:
invoke in interface Instance
Parameters:
operation - the operation to invoke
args - the arguments the operation is called with
Returns:
the return value of the invokation
Throws:
UndefinedValueException - thrown if the specified feature is undefined on this instance.
FeatureInvocationException - thrown if an exception occurs during the property call.

navigate

public Instance navigate(Property assoc,
                         Instance[] qualifiers)
                  throws FeatureInvocationException,
                         UndefinedValueException
Description copied from interface: Instance
Navigates an association of this instance.

Specified by:
navigate in interface Instance
Parameters:
assoc - the association to navigate
qualifiers - the evaluated denotation the navigation is qualified with.
Returns:
the navigated instance
Throws:
FeatureInvocationException - thrown if an exception occurs during the property call.
UndefinedValueException - thrown if the specified feature is undefined on this instance.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object