Interface PartialEvaluator

All Known Implementing Classes:
PartialEvaluatorImpl, PartialEvaluatorNoAllInstances

public interface PartialEvaluator

A partial evaluator can be used to evaluate an expression at a hypothetical model state as it has been before a change, as described by an EMF Notification, has taken place. A partial evaluator can also attempt an expression evaluation without all variables being set. If an undefined variable is accessed, a ValueNotFoundException is thrown, indicating the offending variable.

With a partial evaluator it is also possible to evaluate a CallExp whose source expression's evaluation result is already known, in such a way that the source expression is not evaluated again but the value known in advanced is used instead.

Instances of the default implementation to this interface can be created using the PartialEvaluatorFactory.

Axel Uhl

Method Summary
 java.lang.Object evaluate(java.lang.Object context, CallExp e, java.lang.Object valueOfSourceExpression)
          Evaluates e, assuming valueOfSourceExpression is the value to which e's source expression evaluates.
 java.lang.Object evaluate(java.lang.Object context, OCLExpression e)
          Performs a normal OCL evaluation of expression c.
 OCL.Helper getHelper()
 OCL getOcl()

Method Detail


java.lang.Object evaluate(java.lang.Object context,
                          OCLExpression e)
Performs a normal OCL evaluation of expression c. If the context object is not currently known, it's ok to pass null for context. The evaluation may fail with a ValueNotFoundException in case a variable that is accessed hasn't been defined yet. The e expression may therefore be some subexpression of a containing expression. To set variable values for the initial evaluation scope, use getOcl(). OCL.getEvaluationEnvironment(). EvaluationEnvironment.add(String, Object).


java.lang.Object evaluate(java.lang.Object context,
                          CallExp e,
                          java.lang.Object valueOfSourceExpression)
Evaluates e, assuming valueOfSourceExpression is the value to which e's source expression evaluates. This means that during e's evaluation the evaluator won't attempt to evaluate the source expression but uses the value provided in valueOfSourceExpression instead.

context - a value for self can optionally be provided here. If null is specified, a ValueNotFoundException will be thrown upon trying to fetch the self value.
ValueNotFoundException - in case a variable is accessed that hasn't previously been defined. This can happen during partial evaluation when a variable would have been defined by a superior expression of which e is only a subexpression.


OCL.Helper getHelper()


OCL getOcl()