public interface PartialEvaluatorFactory
PartialEvaluator
objects. A partial evaluator can
evaluate an OCL expression in the "pre"-state of a model before a given
change, described by an EMF Notification
object, was performed. This
is similar to the OCL @pre
evaluation, only that it applies to
the entire expression. This is similar to undoing the change described by the
notification, only that the model doesn't need to be changed for this.
A second use for a partial evaluator is that of a CallExp
whose
source
expression's value is known up-front. This
value can be passed to the partial evaluator's
PartialEvaluator.evaluate(Object, CallExp, Object)
method.
A partial evaluator may also be used to attempt an expression's evaluation
if not all variable values required by the expression are known. For example,
if an operation body expression needs to be evaluated but for some reason not
all argument values have yet been determined, an evaluation attempt may still
succeed if the nature of the expressions leads to the unknown variables not
being accessed. However, if a variable with unknown value is accessed during
expression evaluation, a ValueNotFoundException
is thrown.
A default factory instance can be obtained using the INSTANCE
field.
Modifier and Type | Field and Description |
---|---|
static PartialEvaluatorFactory |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
PartialEvaluator |
createPartialEvaluator(org.eclipse.emf.common.notify.Notification atPre,
OppositeEndFinder oppositeEndFinder,
OCLFactory oclFactory)
Taking a
Notification object such that an evaluation will be
based on the state *before* the notification. |
PartialEvaluator |
createPartialEvaluator(OppositeEndFinder oppositeEndFinder,
OCLFactory oclFactory)
Constructs the OCL instance using
OCLFactory.createOCL(OppositeEndFinder) , passing the
oppositeEndFinder provided. |
static final PartialEvaluatorFactory INSTANCE
PartialEvaluator createPartialEvaluator(org.eclipse.emf.common.notify.Notification atPre, OppositeEndFinder oppositeEndFinder, OCLFactory oclFactory)
Notification
object such that an evaluation will be
based on the state *before* the notification. For example, if the
notification indicates the removal of a reference from an element
e1 to an element e2 across reference r then
when during partial evaluation r is traversed starting from
e1 then e2 will show in the results although in the
current version of the model it would not.
atPre
- if null
, the constructor behaves the same as
createPartialEvaluator(OppositeEndFinder, OCLFactory)
PartialEvaluator createPartialEvaluator(OppositeEndFinder oppositeEndFinder, OCLFactory oclFactory)
OCLFactory.createOCL(OppositeEndFinder)
, passing the
oppositeEndFinder
provided. A default PartialEcoreEnvironmentFactory
is
used, configured as well with the oppositeEndFinder
provided here.