|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.ocl.expressions.util.EvalEnvironment
A mapping of names to objects used in the evaluation of expressions.
Constructor Summary | |
---|---|
EvalEnvironment()
|
|
EvalEnvironment(EvaluationEnvironment parent)
|
Method Summary | |
---|---|
void |
add(java.lang.String name,
java.lang.Object value)
Adds the supplied name and value binding to the environment |
boolean |
canEvaluate(org.eclipse.emf.ecore.EOperation operation,
int opcode)
Always returns false , because by default only the operations
defined by the OCL itself and the particular EMF metamodel are supported.
|
void |
clear()
Clears the environment of variables. |
java.lang.Object |
evaluate(org.eclipse.emf.ecore.EOperation operation,
int opcode,
java.lang.Object target,
java.lang.Object[] args)
Implements the interface method by just throwing, as I do not by default provide any implementation of any additional operations. |
java.lang.Object |
getValueOf(java.lang.String name)
Returns the value associated with the supplied name |
java.lang.Object |
remove(java.lang.String name)
Removes the supplied name and binding from the environment (if it exists) and returns it. |
void |
replace(java.lang.String name,
java.lang.Object value)
Replaces the current value of the supplied name with the supplied value. |
java.lang.String |
toString()
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 |
public EvalEnvironment()
public EvalEnvironment(EvaluationEnvironment parent)
Method Detail |
public java.lang.Object getValueOf(java.lang.String name)
getValueOf
in interface EvaluationEnvironment
name
- the name whose value is to be returned
public void replace(java.lang.String name, java.lang.Object value)
replace
in interface EvaluationEnvironment
name
- the namevalue
- the new valuepublic void add(java.lang.String name, java.lang.Object value)
add
in interface EvaluationEnvironment
name
- the name to addvalue
- the associated bindingEvaluationEnvironment.replace(String, Object)
public java.lang.Object remove(java.lang.String name)
remove
in interface EvaluationEnvironment
name
- the name to remove
public void clear()
clear
in interface EvaluationEnvironment
public java.lang.String toString()
public boolean canEvaluate(org.eclipse.emf.ecore.EOperation operation, int opcode)
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.
canEvaluate
in interface EvaluationEnvironment
operation
- an OCL operationopcode
- the operation code, if one of the operations pre-defined
by OCL. Otherwise, -1
true
if this evaluation environment provides an
implementation of this operation
; false
,
otherwiseEvaluationEnvironment.evaluate(EOperation, int, Object, Object[])
public java.lang.Object evaluate(org.eclipse.emf.ecore.EOperation operation, int opcode, java.lang.Object target, java.lang.Object[] args) throws java.lang.UnsupportedOperationException
evaluate
in interface EvaluationEnvironment
operation
- the operation to evaluateopcode
- 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
typeargs
- the arguments passed to the operation
. Will
be an empty array if there are none (not null
)
null
if the operation
has no return result
java.lang.UnsupportedOperationException
- if the specified
operation
is not implemented by this environmentEvaluationEnvironment.canEvaluate(EOperation, int)
|
Copyright 2002, 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |