|
||||||||||
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(VariableDeclaration referredVariable,
Value value)
Adds the supplied variable declaration and value binding to the environment. |
void |
clear()
Clears the environment of variables. |
ModelManager |
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. |
Type |
getType(java.lang.Object object)
Deprecated. |
TypeManager |
getTypeManager()
Obtains the Java-language value of the specified enumeration literal. |
ValueFactory |
getValueFactory()
|
Value |
getValueOf(VariableDeclaration referredVariable)
Returns the value associated with the supplied variable declaration |
Value |
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 . |
Value |
remove(VariableDeclaration referredVariable)
Deprecated. let expiry of a nested evaluation environment remove automatically |
void |
replace(VariableDeclaration referredVariable,
Value value)
Replaces the current value of the supplied variable declaration with the supplied value. |
NullValue |
throwInvalidEvaluation(InvalidValueException e)
|
NullValue |
throwInvalidEvaluation(java.lang.String message)
|
NullValue |
throwInvalidEvaluation(java.lang.String message,
OclExpression expression)
|
NullValue |
throwInvalidEvaluation(java.lang.String message,
OclExpression expression,
java.lang.Object context)
|
NullValue |
throwInvalidEvaluation(java.lang.Throwable e,
OclExpression expression,
java.lang.Object context,
java.lang.String message,
java.lang.Object... bindings)
|
Method Detail |
---|
Value getValueOf(VariableDeclaration referredVariable)
referredVariable
- the name whose value is to be returned
void replace(VariableDeclaration referredVariable, Value value)
referredVariable
- the variable declarationvalue
- the new valuevoid add(VariableDeclaration referredVariable, Value value)
referredVariable
- the variable declaration to addvalue
- the associated binding#replace(String, Object)
@Deprecated Value remove(VariableDeclaration referredVariable)
referredVariable
- the variable declaration to remove
void clear()
boolean overrides(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
Value 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
environmentModelManager createModelManager(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
TypeManager getTypeManager()
enumerationLiteral
- the enumeration literal model element
ValueFactory getValueFactory()
NullValue throwInvalidEvaluation(InvalidValueException e) throws InvalidEvaluationException
InvalidEvaluationException
NullValue throwInvalidEvaluation(java.lang.String message) throws InvalidEvaluationException
InvalidEvaluationException
NullValue throwInvalidEvaluation(java.lang.String message, OclExpression expression) throws InvalidEvaluationException
InvalidEvaluationException
NullValue throwInvalidEvaluation(java.lang.String message, OclExpression expression, java.lang.Object context) throws InvalidEvaluationException
InvalidEvaluationException
NullValue throwInvalidEvaluation(java.lang.Throwable e, OclExpression expression, java.lang.Object context, java.lang.String message, java.lang.Object... bindings) throws InvalidEvaluationException
InvalidEvaluationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |