Class VariableExpTracer

  extended by org.eclipse.ocl.examples.impactanalyzer.instanceScope.AbstractTracer<VariableExp>
      extended by org.eclipse.ocl.examples.impactanalyzer.instanceScope.VariableExpTracer
All Implemented Interfaces:

public class VariableExpTracer
extends AbstractTracer<VariableExp>

Computes a 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:

In all cases, traceback continues with the expression defining the possible values that the variable may assume. In all cases, this leaves the scope in which the variable is visible. This becomes important when considering how variable values travel through the computation of the unused function, trying to prove for each expression visited by traceback, whether or not it is used, given what is known about variable values.

Axel Uhl (D043530)

Field Summary
Fields inherited from class org.eclipse.ocl.examples.impactanalyzer.instanceScope.AbstractTracer
Constructor Summary
VariableExpTracer(VariableExp expression, java.util.Stack<java.lang.String> tuplePartNames, OCLFactory oclFactory)
Method Summary
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.
Methods inherited from class org.eclipse.ocl.examples.impactanalyzer.instanceScope.AbstractTracer
applyScopesOnNavigationStep, calculateEnteringScope, commonCompositionParent, commonCompositionParent, doesTypeMatch, doesTypeMatch, getAllVariablesInScope, getExpression, getExtendedListOfTuplePartNames, getInnermostElementType, getListOfTuplePartNamesWithFoundRemoved, getRootExpression, getTupleLiteralPartNamesToLookFor, getTuplePartNameLookedFor, getVariablesIntroducedBetweenHereAnd, getVariablesScopedByExpression, isLookingForTuplePart, variablesIntroducedBetween
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public VariableExpTracer(VariableExp expression,
                         java.util.Stack<java.lang.String> tuplePartNames,
                         OCLFactory oclFactory)
Method Detail


public NavigationStep traceback(org.eclipse.emf.ecore.EClass context,
                                PathCache pathCache,
                                OperationBodyToCallMapper operationBodyToCallMapper)
The step produced will be invoked with the value for the variable. This knowledge can be helpful when trying to perform partial evaluations. Variables have an 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.

Specified by:
traceback in interface Tracer
traceback in class AbstractTracer<VariableExp>
context - the context type that defines the type of any self occurrence outside of operation bodies
pathCache - a global cache that remembers the navigation steps already computed for some OCL expressions
operationBodyToCallMapper - the filter synthesizer that analyzed an overall expression that contains the expression to be handled by this tracer


protected java.util.Set<Variable> calculateLeavingScopes(OperationBodyToCallMapper operationBodyToCallMapper)
Description copied from class: AbstractTracer
Calculates which scopes the NavigationStep this Tracer creates will leave when navigated.

calculateLeavingScopes in class AbstractTracer<VariableExp>
the set of OCLExpressions representing the scopes the created NavigationStep will leave when navigated.