org.eclipse.emf.ocl.expressions.util
Class EvalEnvironment

java.lang.Object
  extended by org.eclipse.emf.ocl.expressions.util.EvalEnvironment
All Implemented Interfaces:
EvaluationEnvironment

Deprecated. Use the AbstractEvaluationEnvironment or EcoreEvaluationEnvironment class, instead.

@Deprecated
public class EvalEnvironment
extends Object
implements EvaluationEnvironment

A mapping of names to objects used in the evaluation of expressions.


Constructor Summary
EvalEnvironment()
          Deprecated.  
EvalEnvironment(EvaluationEnvironment parent)
          Deprecated.  
 
Method Summary
 void add(String name, Object value)
          Deprecated. Adds the supplied name and value binding to the environment
 boolean canEvaluate(EOperation operation, int opcode)
          Deprecated. Always returns false, because by default only the operations defined by the OCL itself and the particular EMF metamodel are supported.
 void clear()
          Deprecated. Clears the environment of variables.
 Object evaluate(EOperation operation, int opcode, Object target, Object[] args)
          Deprecated. Implements the interface method by just throwing, as I do not by default provide any implementation of any additional operations.
 Object getValueOf(String name)
          Deprecated. Returns the value associated with the supplied name
 Object remove(String name)
          Deprecated. Removes the supplied name and binding from the environment (if it exists) and returns it.
 void replace(String name, Object value)
          Deprecated. Replaces the current value of the supplied name with the supplied value.
 String toString()
          Deprecated. Returns a string representation of the bindings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EvalEnvironment

public EvalEnvironment()
Deprecated. 

EvalEnvironment

public EvalEnvironment(EvaluationEnvironment parent)
Deprecated. 
Method Detail

getValueOf

public Object getValueOf(String name)
Deprecated. 
Returns the value associated with the supplied name

Specified by:
getValueOf in interface EvaluationEnvironment
Parameters:
name - the name whose value is to be returned
Returns:
the value associated with the name

replace

public void replace(String name,
                    Object value)
Deprecated. 
Replaces the current value of the supplied name with the supplied value.

Specified by:
replace in interface EvaluationEnvironment
Parameters:
name - the name
value - the new value

add

public void add(String name,
                Object value)
Deprecated. 
Adds the supplied name and value binding to the environment

Specified by:
add in interface EvaluationEnvironment
Parameters:
name - the name to add
value - the associated binding
See Also:
EvaluationEnvironment.replace(String, Object)

remove

public Object remove(String name)
Deprecated. 
Removes the supplied name and binding from the environment (if it exists) and returns it.

Specified by:
remove in interface EvaluationEnvironment
Parameters:
name - the name to remove
Returns:
the value associated with the removed name

clear

public void clear()
Deprecated. 
Clears the environment of variables.

Specified by:
clear in interface EvaluationEnvironment

toString

public String toString()
Deprecated. 
Returns a string representation of the bindings

Overrides:
toString in class Object

canEvaluate

public boolean canEvaluate(EOperation operation,
                           int opcode)
Deprecated. 
Always returns false, because by default only the operations defined by the OCL itself and the particular EMF metamodel are supported. Subclasses can override to override existing operation implementations or to add operations not defined by either OCL or the metamodel.

Specified by:
canEvaluate in interface EvaluationEnvironment
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.evaluate(EOperation, int, Object, Object[])

evaluate

public Object evaluate(EOperation operation,
                       int opcode,
                       Object target,
                       Object[] args)
                throws UnsupportedOperationException
Deprecated. 
Implements the interface method by just throwing, as I do not by default provide any implementation of any additional operations.

Specified by:
evaluate in interface EvaluationEnvironment
Parameters:
operation - the operation to evaluate
opcode - the operation code, if one of the operations pre-defined by OCL. Otherwise, -1
target - the object on which to apply the operation. the target may be an EObject or it may not, depending on the EClassifier type
args - the arguments passed to the operation. Will be an empty array if there are none (not null)
Returns:
the value of the operation, or null if the operation has no return result
Throws:
UnsupportedOperationException - if the specified operation is not implemented by this environment
See Also:
EvaluationEnvironment.canEvaluate(EOperation, int)

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