public class VariableExpTracer extends AbstractTracer<VariableExp>
NavigationStep
for a VariableExp
which, given an element constituting a value the variable
shall assume, infers a set of elements which, when used as the value of the outermost expression's self
variable,
may lead the variable considered here to assume the expected value.OCL knows occurrences of different "stereotypes" of variables, depending on where/how the variable is defined:
self
variable occurring within the body of an operationself
variable occurring outside the body of an operationIterateExp
LetExp
unused
function, trying to prove for each expression visited by traceback,
whether or not it is used, given what is known about variable values.oclFactory
Constructor and Description |
---|
VariableExpTracer(VariableExp expression,
java.util.Stack<java.lang.String> tuplePartNames,
OCLFactory oclFactory) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<Variable> |
calculateLeavingScopes(OperationBodyToCallMapper operationBodyToCallMapper)
Calculates which scopes the
NavigationStep this Tracer creates will leave when navigated. |
NavigationStep |
traceback(org.eclipse.emf.ecore.EClass context,
PathCache pathCache,
OperationBodyToCallMapper operationBodyToCallMapper)
The step produced will be invoked with the value for the variable.
|
applyScopesOnNavigationStep, calculateEnteringScope, commonCompositionParent, commonCompositionParent, doesTypeMatch, doesTypeMatch, getAllVariablesInScope, getExpression, getExtendedListOfTuplePartNames, getInnermostElementType, getListOfTuplePartNamesWithFoundRemoved, getRootExpression, getTupleLiteralPartNamesToLookFor, getTuplePartNameLookedFor, getVariablesIntroducedBetweenHereAnd, getVariablesScopedByExpression, isLookingForTuplePart, variablesIntroducedBetween
public VariableExpTracer(VariableExp expression, java.util.Stack<java.lang.String> tuplePartNames, OCLFactory oclFactory)
public NavigationStep traceback(org.eclipse.emf.ecore.EClass context, PathCache pathCache, OperationBodyToCallMapper operationBodyToCallMapper)
OCLExpression
as their scope. For example, a let-variable has the
in
expression as its static scope. Additionally, scopes are dynamically instantiated during
expression evaluation. For example, during evaluation of an IterateExp
, the body expression forms the static scope
for the result variable
. During each iteration, a new dynamic scope is created and the same
static result variable may have a different value in each dynamic scope. It is important to understand that the navigation
step learns about the value of the variable only in one particular dynamic scope.
Dynamic scopes are identified by the OCLExpression
object forming the static scope, combined with a unique
identifier, implemented as a simple counter.
It is also important to understand that variables of a collection type cannot have their value fully inferred by the traceback process as only single elements are visited during the trace.
traceback
in interface Tracer
traceback
in class AbstractTracer<VariableExp>
context
- the context type that defines the type of any self occurrence outside of operation bodiespathCache
- a global cache that remembers the navigation steps already computed for some OCL expressionsoperationBodyToCallMapper
- the filter synthesizer that analyzed an overall expression that contains the expression to be handled by this
tracerprotected java.util.Set<Variable> calculateLeavingScopes(OperationBodyToCallMapper operationBodyToCallMapper)
AbstractTracer
NavigationStep
this Tracer
creates will leave when navigated.calculateLeavingScopes
in class AbstractTracer<VariableExp>
OCLExpression
s representing the scopes the created NavigationStep
will leave when navigated.