org.eclipse.emf.ocl.internal.parser
Class CompatibilityEvaluationEnvironment

java.lang.Object
  extended by org.eclipse.ocl.AbstractEvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
      extended by org.eclipse.ocl.ecore.EcoreEvaluationEnvironment
          extended by org.eclipse.emf.ocl.internal.parser.CompatibilityEvaluationEnvironment
All Implemented Interfaces:
EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>, EvaluationEnvironment.Enumerations<EEnumLiteral>, Customizable, Adaptable

public class CompatibilityEvaluationEnvironment
extends EcoreEvaluationEnvironment


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.EvaluationEnvironment
EvaluationEnvironment.Enumerations<EL>
 
Method Summary
 void add(String name, Object value)
          Adds the supplied name and value binding to the environment
 Object callOperation(EOperation operation, int opcode, Object source, Object[] args)
          Implements the inherited method by attempting to find an appropriate Java method in the actual type of the source object and invoking it.
 void clear()
          Clears the environment of variables.
 Object getValueOf(String name)
          Returns the value associated with the supplied name
 boolean overrides(EOperation operation, int opcode)
          By default, a subclass will not support overriding the operations defined by the OCL Standard Library.
 Object remove(String name)
          Removes the supplied name and binding from the environment (if it exists) and returns it.
 void replace(String name, Object value)
          Replaces the current value of the supplied name with the supplied value.
 
Methods inherited from class org.eclipse.ocl.ecore.EcoreEvaluationEnvironment
createExtentMap, createTuple, getInvalidResult, getJavaMethodFor, getType, getValue, isKindOf, isTypeOf, navigateAssociationClass, navigateProperty
 
Methods inherited from class org.eclipse.ocl.AbstractEvaluationEnvironment
basicGetOptions, clearOptions, getAdapter, getOptions, getParent, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getValueOf

public Object getValueOf(String name)
Description copied from class: AbstractEvaluationEnvironment
Returns the value associated with the supplied name

Specified by:
getValueOf in interface EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Overrides:
getValueOf in class AbstractEvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Parameters:
name - the name whose value is to be returned
Returns:
the value associated with the name

add

public void add(String name,
                Object value)
Description copied from class: AbstractEvaluationEnvironment
Adds the supplied name and value binding to the environment

Specified by:
add in interface EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Overrides:
add in class AbstractEvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Parameters:
name - the name to add
value - the associated binding
See Also:
EvaluationEnvironment.replace(String, Object)

replace

public void replace(String name,
                    Object value)
Description copied from class: AbstractEvaluationEnvironment
Replaces the current value of the supplied name with the supplied value.

Specified by:
replace in interface EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Overrides:
replace in class AbstractEvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Parameters:
name - the name
value - the new value

remove

public Object remove(String name)
Description copied from class: AbstractEvaluationEnvironment
Removes the supplied name and binding from the environment (if it exists) and returns it.

Specified by:
remove in interface EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Overrides:
remove in class AbstractEvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Parameters:
name - the name to remove
Returns:
the value associated with the removed name

clear

public void clear()
Description copied from class: AbstractEvaluationEnvironment
Clears the environment of variables.

Specified by:
clear in interface EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Overrides:
clear in class AbstractEvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>

overrides

public boolean overrides(EOperation operation,
                         int opcode)
Description copied from class: AbstractEvaluationEnvironment
By default, a subclass will not support overriding the operations defined by the OCL Standard Library. This implementation delegates to the parent environment (if any), otherwise returns false.

Specified by:
overrides in interface EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Overrides:
overrides in class AbstractEvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Parameters:
operation - an OCL operation
opcode - the operation code, if one of the operations pre-defined by OCL. Otherwise, -1
Returns:
true if this evaluation environment provides an implementation of this operation; false, otherwise
See Also:
EvaluationEnvironment.callOperation(O, int, java.lang.Object, java.lang.Object[])

callOperation

public Object callOperation(EOperation operation,
                            int opcode,
                            Object source,
                            Object[] args)
                     throws IllegalArgumentException
Description copied from class: AbstractEvaluationEnvironment
Implements the inherited method by attempting to find an appropriate Java method in the actual type of the source object and invoking it. On failure to find or invoke the method (e.g., an exception), the OclInvalid result is returned.

Specified by:
callOperation in interface EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject>
Overrides:
callOperation in class EcoreEvaluationEnvironment
Parameters:
operation - the operation to invoke
opcode - the operation code, if this is an OCL Standard Library operation (which this environment overrides)
source - the source element on which the operation is invoked
args - the arguments, or an empty array if none
Returns:
the result of the Java method invocation, or OclInvalid on failure of the method invocation
Throws:
IllegalArgumentException - if the operation is not supported by this environment

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.