public abstract class AbstractEvaluationEnvironment<C,O,P,CLS,E> extends Object implements EvaluationEnvironment<C,O,P,CLS,E>, Adaptable, Customizable
EvaluationEnvironment interface,
providing some useful common behaviors. Implementors of metamodel-specific
environments are encourage to extend this class rather than implement
an evaluation environment "from scratch."
See the Environment class for a description of the
generic type parameters of this class.
Since the 1.2 release, this interface is Adaptable to support the
optional adapter protocols such as EvaluationEnvironment.Enumerations
and Customizable.
EvaluationEnvironment.Enumerations<EL>| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEvaluationEnvironment() |
protected |
AbstractEvaluationEnvironment(EvaluationEnvironment<C,O,P,CLS,E> parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String name,
Object value)
Adds the supplied name and value binding to the environment
|
protected Map<Option<?>,Object> |
basicGetOptions() |
Object |
callOperation(O 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.
|
Map<Option<?>,Object> |
clearOptions()
Clears all options.
|
<T> T |
getAdapter(Class<T> adapterType)
Implements the interface method by testing whether I am an instance of
the requested adapter type.
|
protected abstract Object |
getInvalidResult()
Obtains the language-binding-specific representation of the predefined
OclInvalid object.
|
protected abstract Method |
getJavaMethodFor(O operation,
Object receiver)
Returns the java method that corresponds to the supplied
EOperation |
Map<Option<?>,Object> |
getOptions()
Obtains a copy of my map of options.
|
protected EvaluationEnvironment<C,O,P,CLS,E> |
getParent()
Obtains my parent (nesting) environment.
|
<T> T |
getValue(Option<T> option)
Obtains the value of the specified option's setting in the my
options map.
|
Object |
getValueOf(String name)
Returns the value associated with the supplied name
|
boolean |
isEnabled(Option<Boolean> option)
Queries whether the specified boolean-valued option is enabled.
|
boolean |
overrides(O operation,
int opcode)
By default, a subclass will not support overriding the operations defined
by the OCL Standard Library.
|
<T> void |
putOptions(Map<? extends Option<T>,? extends T> options)
Adds options to apply to my behaviour.
|
Object |
remove(String name)
Removes the supplied name and binding from the environment (if it exists)
and returns it.
|
<T> T |
removeOption(Option<T> option)
Removes the specified option.
|
<T> Map<Option<T>,T> |
removeOptions(Collection<Option<T>> options)
Removes the specified options.
|
void |
replace(String name,
Object value)
Replaces the current value of the supplied name with the supplied value.
|
<T> void |
setOption(Option<T> option,
T value)
Add an option to apply to my behaviour.
|
String |
toString()
Returns a string representation of the bindings
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateExtentMap, createTuple, getType, isKindOf, isTypeOf, navigateAssociationClass, navigatePropertyprotected EvaluationEnvironment<C,O,P,CLS,E> getParent()
null if nonepublic Object getValueOf(String name)
getValueOf in interface EvaluationEnvironment<C,O,P,CLS,E>name - the name whose value is to be returnedpublic void replace(String name, Object value)
public void add(String name, Object value)
add in interface EvaluationEnvironment<C,O,P,CLS,E>name - the name to addvalue - the associated bindingEvaluationEnvironment.replace(String, Object)public Object remove(String name)
public void clear()
public String toString()
public boolean overrides(O operation, int opcode)
false.overrides in interface EvaluationEnvironment<C,O,P,CLS,E>operation - an OCL operationopcode - the operation code, if one of the operations pre-defined
by OCL. Otherwise, -1true if this evaluation environment provides an
implementation of this operation; false,
otherwiseEvaluationEnvironment.callOperation(O, int, java.lang.Object, java.lang.Object[])public Object callOperation(O operation, int opcode, Object source, Object[] args) throws IllegalArgumentException
callOperation in interface EvaluationEnvironment<C,O,P,CLS,E>operation - the operation to invokeopcode - the operation code, if this is an OCL Standard Library
operation (which this environment overrides)source - the source element on which the operation is invokedargs - the arguments, or an empty array if noneIllegalArgumentException - if the operation is not supported
by this environmentprotected abstract Method getJavaMethodFor(O operation, Object receiver)
EOperationoperation - the operationprotected abstract Object getInvalidResult()
public <T> T getAdapter(Class<T> adapterType)
getAdapter in interface AdaptableT - the requested adapter interfaceadapterType - the requested adapter interfacenull
if this environment does not adapt to itpublic Map<Option<?>,Object> getOptions()
CustomizablegetOptions in interface Customizablepublic <T> void setOption(Option<T> option, T value)
CustomizablesetOption in interface Customizableoption - the optionvalue - the option's valuepublic <T> void putOptions(Map<? extends Option<T>,? extends T> options)
CustomizableputOptions in interface Customizableoptions - the optionspublic <T> T removeOption(Option<T> option)
CustomizableremoveOption in interface Customizableoption - the option to removepublic <T> Map<Option<T>,T> removeOptions(Collection<Option<T>> options)
CustomizableremoveOptions in interface Customizableoptions - the options to removepublic Map<Option<?>,Object> clearOptions()
CustomizableclearOptions in interface Customizablepublic boolean isEnabled(Option<Boolean> option)
CustomizableisEnabled in interface Customizableoption - an optionpublic <T> T getValue(Option<T> option)
CustomizablegetValue in interface Customizableoption - the option to queryCopyright © 2015 Open eHealth Foundation. All rights reserved.