|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface EvaluationEnvironment
The evaluation environment keeps track of the current values of variables in the evaluation of an OCL expression. It also knows how to navigate properties and association classes, etc. in M0 instances described by models conformant to the metamodel supported by the environment implementation.
See the Environment class for a description of the
generic type parameters of this class.
As of the 1.2 release, evaluation environments are encouraged to implement
the Adaptable interface to provide optional interfaces such as
Customizable for specifying evaluation options. Moreover, the
(AbstractEvaluationEnvironment) class implements the Adaptable
protocol. Use the OCLUtil.getAdapter(EvaluationEnvironment, Class)
method to obtain adapters for any evaluation environment instance.
| Method Summary | |
|---|---|
void |
add(DomainTypedElement referredVariable,
java.lang.Object value)
Adds the supplied variable declaration and value binding to the environment. |
void |
clear()
Clears the environment of variables. |
DomainModelManager |
createModelManager(java.lang.Object object)
Creates an extent map for invocation of OclType.allInstances() using the specified object as a context from which to find
the scope in which OCL classifier extents are defined. |
MetaModelManager |
getMetaModelManager()
Obtains the Java-language value of the specified enumeration literal. |
Type |
getType(java.lang.Object object)
Deprecated. |
java.lang.Object |
getValueOf(DomainTypedElement referredVariable)
Returns the value associated with the supplied variable declaration |
java.util.Set<DomainTypedElement> |
getVariables()
Return the set of all locally registered variables. |
java.lang.Object |
navigateAssociationClass(Type associationClass,
Property navigationSource,
java.lang.Object source)
Obtains the instance of the specified association class that links the specified source element, optionally via the specified property. |
boolean |
overrides(Operation operation,
int opcode)
Queries whether this evaluation environment provides a custom implementation of the specified pre-defined OCL operation. |
java.lang.Object |
remove(DomainTypedElement referredVariable)
Removes the supplied variable declaration and binding from the environment (if it exists) and returns it. |
void |
replace(DomainTypedElement referredVariable,
java.lang.Object value)
Replaces the current value of the supplied variable declaration with the supplied value. |
| Methods inherited from interface org.eclipse.ocl.examples.domain.evaluation.DomainEvaluationEnvironment |
|---|
createVariable |
| Methods inherited from interface org.eclipse.ocl.examples.pivot.Adaptable |
|---|
getAdapter |
| Methods inherited from interface org.eclipse.ocl.examples.pivot.Customizable |
|---|
clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption |
| Method Detail |
|---|
java.lang.Object getValueOf(@NonNull
DomainTypedElement referredVariable)
referredVariable - the name whose value is to be returned
@NonNull java.util.Set<DomainTypedElement> getVariables()
void replace(@NonNull
DomainTypedElement referredVariable,
java.lang.Object value)
replace in interface DomainEvaluationEnvironmentreferredVariable - the variable declarationvalue - the new value
void add(@NonNull
DomainTypedElement referredVariable,
java.lang.Object value)
add in interface DomainEvaluationEnvironmentreferredVariable - the variable declaration to addvalue - the associated binding#replace(String, Object)
java.lang.Object remove(@NonNull
DomainTypedElement referredVariable)
referredVariable - the variable declaration to remove
void clear()
boolean overrides(@NonNull
Operation operation,
int opcode)
operation.
In the case that the receiver does, then it must implement the
#callOperation method to apply the operation.
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,
otherwise#callOperation
java.lang.Object navigateAssociationClass(Type associationClass,
Property navigationSource,
java.lang.Object source)
throws java.lang.IllegalArgumentException
associationClass - the association class to navigate tonavigationSource - in case of ambiguity, the property of the
source element's classifier through which to navigate to the
association classsource - the source element from which to navigate
java.lang.IllegalArgumentException - if the association class is not
associated with the source element, or is not supported by this
environment
@NonNull
DomainModelManager createModelManager(@Nullable
java.lang.Object object)
object as a context from which to find
the scope in which OCL classifier extents are defined. This scope may
be a resource, resource set, or some metamodel-specific scope. Note that
in the case that the object is not an
EObject but is, instead, some primitive
type, then this may be difficult to determine.
Clients are encouraged to do what they can to optimize this mapping, by
lazy initialization of key-value pairs, workspace indices, or whatever
means is available. Note that the map will only ever be accessed by
key (Map.get(java.lang.Object)); it will never be queried for
all entries, all keys, all values, etc. This knowledge could help
optimization.
object - a context object in the scope that covers the OCL
classifier extents
@Deprecated Type getType(java.lang.Object object)
object - an object
@NonNull MetaModelManager getMetaModelManager()
enumerationLiteral - the enumeration literal model element
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||