public abstract class AbstractTracebackStep<E extends OCLExpression> extends java.lang.Object implements TracebackStep
Modifier and Type | Class and Description |
---|---|
static class |
AbstractTracebackStep.TracebackStepAndScopeChange
Encapsulates the scope change that has to happen before invoking a subsequent traceback step.
|
protected static class |
AbstractTracebackStep.TracebackStepAndScopeChangeWithOperationCallExp
When executed using the
AbstractTracebackStep.TracebackStepAndScopeChangeWithOperationCallExp.traceback(AnnotatedEObject, UnusedEvaluationRequestSet, TracebackCache, Notification) method,
results will be keyed with AbstractTracebackStep.TracebackStepAndScopeChangeWithOperationCallExp.callToWhichResultsAreSpecific because the TracebackStep encapsulated by this object
navigates back to the specified call expression, and there either to the source or an argument expression. |
Modifier and Type | Field and Description |
---|---|
protected OCLFactory |
oclFactory |
static int |
provenUnused |
protected org.eclipse.emf.ecore.EClass |
requiredType
If set to a non-
null class, this step asserts that if the source objects passed to its
traceback(AnnotatedEObject, UnusedEvaluationRequestSet, org.eclipse.ocl.examples.impactanalyzer.instanceScope.traceback.TracebackCache, Notification) or
#traceback(Set, UnusedEvaluationRequestSet, org.eclipse.ocl.examples.impactanalyzer.instanceScope.traceback.TracebackCache, Notification) operation are not compatible to that
type, then the result set will be empty. |
static int |
tracebackExecutions |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTracebackStep(E sourceExpression,
java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor,
OppositeEndFinder oppositeEndFinder,
OperationBodyToCallMapper operationBodyToCallMapper,
UnusedEvaluationRequestFactory unusedEvaluationRequestFactory,
OCLFactory oclFactory)
If the expression's type for which this traceback step is constructed is class-like,
requiredType is set to the
expression's type. |
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<AnnotatedEObject> |
annotate(AnnotatedEObject fromObject,
java.util.Set<AnnotatedEObject> newResults)
If in
debug mode , creates a new AnnotatedEObject for each
one in newResults , assuming that there is no "from" object; as an alibi "from" object, the
annotated objects from newResults are used. |
protected AnnotatedEObject |
annotateEObject(AnnotatedEObject object)
Annotates a non-navigation where
object is forwarded unchanged from this step to another. |
protected AnnotatedEObject |
annotateEObject(AnnotatedEObject fromObject,
org.eclipse.emf.ecore.EObject next)
Annotates a navigation from
fromObject to next by taking over fromObject 's annotation,
adding a description of this step and telling at which object the navigation arrived. |
protected java.util.Stack<java.lang.String> |
cloneWithTypeCheck(java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor) |
protected AbstractTracebackStep.TracebackStepAndScopeChange |
createTracebackStepAndScopeChange(OCLExpression sourceExpression,
OCLExpression targetExpression,
org.eclipse.emf.ecore.EClass context,
OperationBodyToCallMapper operationBodyToCallMapper,
java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor,
TracebackStepCache tracebackStepCache)
Creates a new
AbstractTracebackStep.TracebackStepAndScopeChange } object. |
protected AbstractTracebackStep.TracebackStepAndScopeChangeWithOperationCallExp |
createTracebackStepAndScopeChange(OCLExpression sourceExpression,
OCLExpression targetExpression,
OperationCallExp call,
org.eclipse.emf.ecore.EClass context,
OperationBodyToCallMapper operationBodyToCallMapper,
java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor,
TracebackStepCache tracebackStepCache)
Creates a new
AbstractTracebackStep.TracebackStepAndScopeChange } object, remembering an OperationCallExp to which the
results produced by this step are specific. |
protected static java.util.Set<Variable> |
getAllVariablesInScope(OCLExpression e,
OperationBodyToCallMapper operationBodyToCallMapper)
Starting from
e and ascending its containment hierarchy, adds to the resulting set all variables that are scoped by
any of the expressions visited. |
E |
getExpression() |
protected org.eclipse.emf.ecore.EClass |
getInnermostClass(org.eclipse.emf.ecore.EClassifier type)
We assume a collection, possibly nested, that eventually has elements of a class-like type inside.
|
protected org.eclipse.emf.ecore.EClassifier |
getInnermostElementType(org.eclipse.emf.ecore.EClassifier type)
We assume a collection, possibly nested, that eventually has elements of a class-like type inside.
|
protected org.eclipse.emf.ecore.EClass |
getInnermostTypeConsideringTupleLiteralsLookedFor(java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor,
org.eclipse.emf.ecore.EClassifier type) |
protected OppositeEndFinder |
getOppositeEndFinder() |
protected static java.util.Set<Variable> |
getVariablesScopedByExpression(OCLExpression e,
OperationBodyToCallMapper operationBodyToCallMapper) |
protected abstract OperationCallExpKeyedSet |
performSubsequentTraceback(AnnotatedEObject source,
UnusedEvaluationRequestSet pendingUnusedEvalRequests,
TracebackCache tracebackCache,
org.eclipse.emf.common.notify.Notification changeEvent)
This method is used to invoke the
TracebackStep#traceback(AnnotatedEObject, Set, org.eclipse.ocl.examples.impactanalyzer.instanceScope.traceback.TracebackCache, Notification) method on all necessary subsequent TracebackStep s and return their results. |
OperationCallExpKeyedSet |
traceback(AnnotatedEObject source,
UnusedEvaluationRequestSet pendingUnusedEvalRequests,
TracebackCache tracebackCache,
org.eclipse.emf.common.notify.Notification changeEvent)
When being executed, the step computes a conservative superset of the objects that, when used as the context for the
overall
OCLExpression , may cause the expression for which this TracebackStep was created to evaluate to
source . |
protected org.eclipse.emf.ecore.EClass requiredType
null
class, this step asserts that if the source objects passed to its
traceback(AnnotatedEObject, UnusedEvaluationRequestSet, org.eclipse.ocl.examples.impactanalyzer.instanceScope.traceback.TracebackCache, Notification)
or
#traceback(Set, UnusedEvaluationRequestSet, org.eclipse.ocl.examples.impactanalyzer.instanceScope.traceback.TracebackCache, Notification)
operation are not compatible to that
type, then the result set will be empty.protected final OCLFactory oclFactory
public static int tracebackExecutions
public static int provenUnused
protected AbstractTracebackStep(E sourceExpression, java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor, OppositeEndFinder oppositeEndFinder, OperationBodyToCallMapper operationBodyToCallMapper, UnusedEvaluationRequestFactory unusedEvaluationRequestFactory, OCLFactory oclFactory)
requiredType
is set to the
expression's type.tupleLiteralNamesToLookFor
- if a tuple part is being sought, the expression type will be a tuple type; in this case, extract the sought
part's type as the requiredType
.public E getExpression()
protected org.eclipse.emf.ecore.EClass getInnermostTypeConsideringTupleLiteralsLookedFor(java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor, org.eclipse.emf.ecore.EClassifier type)
public OperationCallExpKeyedSet traceback(AnnotatedEObject source, UnusedEvaluationRequestSet pendingUnusedEvalRequests, TracebackCache tracebackCache, org.eclipse.emf.common.notify.Notification changeEvent)
TracebackStep
OCLExpression
, may cause the expression for which this TracebackStep
was created to evaluate to
source
.traceback
in interface TracebackStep
source
- the object to which the expression, for which this step was created, shall evaluatependingUnusedEvalRequests
- When tracing back a VariableExp
expression, this infers a value for the variable referred to by the
expression. This may trigger a previously delayed "unused" evaluation to be triggered. Those triggerable
"unused" evaluation requests are passed using this parameter. When triggering one of them proves the location of
the original change to be unused, an empty set will result from this call. May be null
, having the
same effect as passing a set that contains no requests.tracebackCache
- cache in which previous results of
TracebackStep.traceback(AnnotatedEObject, UnusedEvaluationRequestSet, org.eclipse.ocl.examples.impactanalyzer.instanceScope.traceback.TracebackCache, Notification)
executions can be foundchangeEvent
- the original change event; used for performing pre/post evaluationssource
. The resulting objects may additionally be keyed by OperationCallExp
expressions in case
their inference left an operation body through a self
or parameter variable. These keys are
removed again in the OperationCallTracebackStep
, keying the results specific to the call being traced
by the null
key. All object reached without leaving an operation body through a self
or parameter variable are also keyed by the null
key.protected abstract OperationCallExpKeyedSet performSubsequentTraceback(AnnotatedEObject source, UnusedEvaluationRequestSet pendingUnusedEvalRequests, TracebackCache tracebackCache, org.eclipse.emf.common.notify.Notification changeEvent)
TracebackStep#traceback(AnnotatedEObject, Set, org.eclipse.ocl.examples.impactanalyzer.instanceScope.traceback.TracebackCache, Notification)
method on all necessary subsequent TracebackStep
s and return their results.
Which subsequent steps are necessary depends on the respective source
OCLExpression
the TracebackStep
was created for.protected static java.util.Set<Variable> getVariablesScopedByExpression(OCLExpression e, OperationBodyToCallMapper operationBodyToCallMapper)
protected static java.util.Set<Variable> getAllVariablesInScope(OCLExpression e, OperationBodyToCallMapper operationBodyToCallMapper)
e
and ascending its containment hierarchy, adds to the resulting set all variables that are scoped by
any of the expressions visited.protected AbstractTracebackStep.TracebackStepAndScopeChange createTracebackStepAndScopeChange(OCLExpression sourceExpression, OCLExpression targetExpression, org.eclipse.emf.ecore.EClass context, OperationBodyToCallMapper operationBodyToCallMapper, java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor, TracebackStepCache tracebackStepCache)
AbstractTracebackStep.TracebackStepAndScopeChange
} object. Fetches from the cache or produces the TracebackStep
}
and computes the variable scope changes (see getVariablesChangingScope(OCLExpression, OCLExpression, OperationBodyToCallMapper)
.
The results of these two operations are used for the AbstractTracebackStep.TracebackStepAndScopeChange
constructor.protected AbstractTracebackStep.TracebackStepAndScopeChangeWithOperationCallExp createTracebackStepAndScopeChange(OCLExpression sourceExpression, OCLExpression targetExpression, OperationCallExp call, org.eclipse.emf.ecore.EClass context, OperationBodyToCallMapper operationBodyToCallMapper, java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor, TracebackStepCache tracebackStepCache)
AbstractTracebackStep.TracebackStepAndScopeChange
} object, remembering an OperationCallExp
to which the
results produced by this step are specific. The results produced by the step returned will all be keyed
by the call
. Fetches from the cache or produces the TracebackStep
}
and computes the variable scope changes (see getVariablesChangingScope(OCLExpression, OCLExpression, OperationBodyToCallMapper)
.
The results of these two operations are used for the AbstractTracebackStep.TracebackStepAndScopeChange
constructor.protected org.eclipse.emf.ecore.EClass getInnermostClass(org.eclipse.emf.ecore.EClassifier type)
EClass
, null
is returned.protected org.eclipse.emf.ecore.EClassifier getInnermostElementType(org.eclipse.emf.ecore.EClassifier type)
EClass
, null
is returned.protected java.util.Stack<java.lang.String> cloneWithTypeCheck(java.util.Stack<java.lang.String> tupleLiteralNamesToLookFor)
protected AnnotatedEObject annotateEObject(AnnotatedEObject fromObject, org.eclipse.emf.ecore.EObject next)
fromObject
to next
by taking over fromObject
's annotation,
adding a description of this step and telling at which object the navigation arrived. In case we're not in
debug mode
, a default message (see AnnotatedEObject.NOT_IN_DEBUG_MODE_MESSAGE
)
is used instead to save memory.protected AnnotatedEObject annotateEObject(AnnotatedEObject object)
object
is forwarded unchanged from this step to another. The result is an
AnnotatedEObject
with its from-object and reached object both being set to object
, adding a
description of this step and telling at which object the navigation arrived. In case we're not in
debug mode
, a default message (see
AnnotatedEObject.NOT_IN_DEBUG_MODE_MESSAGE
) is used instead to save memory.protected java.util.Set<AnnotatedEObject> annotate(AnnotatedEObject fromObject, java.util.Set<AnnotatedEObject> newResults)
debug mode
, creates a new AnnotatedEObject
for each
one in newResults
, assuming that there is no "from" object; as an alibi "from" object, the
annotated objects from newResults
are used.protected OppositeEndFinder getOppositeEndFinder()