|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.examples.impactanalyzer.instanceScope.AbstractTracer<T>
public abstract class AbstractTracer<T extends org.eclipse.emf.ecore.EObject>
Field Summary | |
---|---|
protected OCLFactory |
oclFactory
|
Constructor Summary | |
---|---|
protected |
AbstractTracer(T expression,
AbstractTracer<?> caller,
java.lang.String additionalTuplePartNameToLookFor,
OCLFactory oclFactory)
Creates a tracer for OCL expression expression and adding another tuple part name to the list of tuple parts to look for as already defined for the caller tracer. |
protected |
AbstractTracer(T expression,
OCLFactory oclFactory)
Creates a tracer with a null tuplePartNames array, meaninig that this tracer is not looking for
TupleLiteralPart expressions on which to unroll a part access. |
protected |
AbstractTracer(T expression,
java.util.Stack<java.lang.String> tuplePartNames,
OCLFactory oclFactory)
Specifies an explicit list of tuple part names to look for. |
Method Summary | |
---|---|
protected void |
applyScopesOnNavigationStep(NavigationStep step,
OperationBodyToCallMapper operationBodyToCallMapper)
|
protected java.util.Set<Variable> |
calculateEnteringScope(OperationBodyToCallMapper operationBodyToCallMapper)
Calculates the scopes the NavigationStep this Tracer creates will enter when navigated. |
protected java.util.Set<Variable> |
calculateLeavingScopes(OperationBodyToCallMapper operationBodyToCallMapper)
Calculates which scopes the NavigationStep this Tracer creates will leave when navigated. |
protected OCLExpression |
commonCompositionParent(OCLExpression second)
This method is a shortcut for commonCompositionParent(OCLExpression, OCLExpression) that uses getExpression() as the origin. |
protected static OCLExpression |
commonCompositionParent(OCLExpression first,
OCLExpression second)
This method finds the common composition parent of the two given OCLExpression s. |
static boolean |
doesTypeMatch(org.eclipse.emf.ecore.EClass sourceType,
AnnotatedEObject fromObject)
|
protected boolean |
doesTypeMatch(org.eclipse.emf.ecore.EObject s)
Checks if s conforms to the type of the expression managed by this tracer. |
protected static java.util.Set<Variable> |
getAllVariablesInScope(OCLExpression e,
OperationBodyToCallMapper operationBodyToCallMapper)
|
protected T |
getExpression()
|
java.util.Stack<java.lang.String> |
getExtendedListOfTuplePartNames(java.lang.String toAdd)
|
protected org.eclipse.emf.ecore.EClass |
getInnermostElementType(org.eclipse.emf.ecore.EClassifier type)
We assume a collection, possibly nested, that eventually has elements of a class-like type inside. |
protected java.util.Stack<java.lang.String> |
getListOfTuplePartNamesWithFoundRemoved()
Returns tuplePartNames with the first element at index 0 removed. |
protected OCLExpression |
getRootExpression()
There are a few known idiosyncrasies in the OCL "composition" hierarchy. |
java.util.Stack<java.lang.String> |
getTupleLiteralPartNamesToLookFor()
|
protected java.lang.String |
getTuplePartNameLookedFor()
|
protected java.util.Set<Variable> |
getVariablesIntroducedBetweenHereAnd(OCLExpression parent,
OperationBodyToCallMapper operationBodyToCallMapper)
This method is a shortcut for variablesIntroducedBetween(OCLExpression, OCLExpression, OperationBodyToCallMapper) that uses getExpression() as the origin. |
protected static java.util.Set<Variable> |
getVariablesScopedByExpression(OCLExpression e,
OperationBodyToCallMapper operationBodyToCallMapper)
|
protected boolean |
isLookingForTuplePart()
|
NavigationStep |
traceback(org.eclipse.emf.ecore.EClass context,
PathCache pathCache,
OperationBodyToCallMapper operationBodyToCallMapper)
By default, many expression types which, e.g., result in a primitive result, return an EmptyResultNavigationStep
which is what this default implementation does. |
protected java.util.Set<Variable> |
variablesIntroducedBetween(OCLExpression origin,
OCLExpression parent,
OperationBodyToCallMapper operationBodyToCallMapper)
This method returns all variables introduced by parent or any contained expression along the containment
hierarchy, down to origin . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final OCLFactory oclFactory
Constructor Detail |
---|
protected AbstractTracer(T expression, OCLFactory oclFactory)
tuplePartNames
array, meaninig that this tracer is not looking for
TupleLiteralPart
expressions on which to unroll a part access.
expression
- the OCL expression for which this tracer shall determine a navigation stepprotected AbstractTracer(T expression, java.util.Stack<java.lang.String> tuplePartNames, OCLFactory oclFactory)
getListOfTuplePartNamesWithFoundRemoved()
.
protected AbstractTracer(T expression, AbstractTracer<?> caller, java.lang.String additionalTuplePartNameToLookFor, OCLFactory oclFactory)
getExtendedListOfTuplePartNames(String)
.
additionalTuplePartNameToLookFor
- if along the chain of sub-expressions traversed there was an attribute access on a source expression of a tuple
type that needs to be unwound when at some point a TupleLiteralPart
is found. Must not be null.Method Detail |
---|
protected T getExpression()
protected boolean isLookingForTuplePart()
protected java.lang.String getTuplePartNameLookedFor()
public java.util.Stack<java.lang.String> getExtendedListOfTuplePartNames(java.lang.String toAdd)
protected java.util.Stack<java.lang.String> getListOfTuplePartNamesWithFoundRemoved()
tuplePartNames
with the first element at index 0 removed. If tuplePartNames
is null or
contains one or no element, null is returned.
public java.util.Stack<java.lang.String> getTupleLiteralPartNamesToLookFor()
protected OCLExpression getRootExpression()
TupleLiteralExp
does not contain its
tuple parts
which are variable declarations, a CollectionLiteralExp
does not
contain its parts
, and of those parts, none of CollectionRange
nor
CollectionItem
contains the expressions that it uses to describe itself.
We still need to be able to determine the scope of, e.g., self or operation parameters and therefore need to ascend what may be called the "logical composition hierarchy" of an OCL expression. Therefore, this operation ascends the real composition hierarchy until it finds a null parent or a parent of type constraint or EAnnotation. In this case, it tries the aforementioned "logical compositions" one after the other. If for one such association another element is found, ascending continues there.
protected boolean doesTypeMatch(org.eclipse.emf.ecore.EObject s)
type
of the expression
managed by this tracer. A mismatch may occur because of "reverse polymorphic traversal." In other
words, if an expression with a source
traces back
to its source in order to find out the possible values for self that may have produced a specific value,
the actual source object may be of a more general type than the static type of the source expression of the
specific expression analyzed. This can happen because there may be multiple occurrences of attribute or
association end call expressions for the same attribute/association that occur in different expressions, where
navigation back to self is not always possible because of the actual type constraints.
All implementations of Tracer.traceback(EClass, PathCache, OperationBodyToCallMapper)
must call this
operation to ensure they don't try to continue on a trace that type-wise is impossible.
public static boolean doesTypeMatch(org.eclipse.emf.ecore.EClass sourceType, AnnotatedEObject fromObject)
public NavigationStep traceback(org.eclipse.emf.ecore.EClass context, PathCache pathCache, OperationBodyToCallMapper operationBodyToCallMapper)
EmptyResultNavigationStep
which is what this default implementation does.
traceback
in interface Tracer
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 org.eclipse.emf.ecore.EClass getInnermostElementType(org.eclipse.emf.ecore.EClassifier type)
protected java.util.Set<Variable> calculateLeavingScopes(OperationBodyToCallMapper operationBodyToCallMapper)
NavigationStep
this Tracer
creates will leave when navigated.
OCLExpression
s representing the scopes the created NavigationStep
will leave when navigated.protected java.util.Set<Variable> calculateEnteringScope(OperationBodyToCallMapper operationBodyToCallMapper)
NavigationStep
this Tracer
creates will enter when navigated.
OCLExpression
s representing the scope the created NavigationStep
will enter when navigated. Always
non-null
, but possibly emptyprotected void applyScopesOnNavigationStep(NavigationStep step, OperationBodyToCallMapper operationBodyToCallMapper)
protected java.util.Set<Variable> variablesIntroducedBetween(OCLExpression origin, OCLExpression parent, OperationBodyToCallMapper operationBodyToCallMapper)
parent
or any contained expression along the containment
hierarchy, down to origin
.
origin
- The OCLExpression
used as the origin of the search.parent
- The OCLExpression
that is a immediate or transitive containment parent of the origin (see
EObject.eContainer()
)
Set
of OCLExpression
s containing all scope creating expressions in the containment hierarchy
between origin and parent.protected static java.util.Set<Variable> getVariablesScopedByExpression(OCLExpression e, OperationBodyToCallMapper operationBodyToCallMapper)
protected static java.util.Set<Variable> getAllVariablesInScope(OCLExpression e, OperationBodyToCallMapper operationBodyToCallMapper)
protected java.util.Set<Variable> getVariablesIntroducedBetweenHereAnd(OCLExpression parent, OperationBodyToCallMapper operationBodyToCallMapper)
variablesIntroducedBetween(OCLExpression, OCLExpression, OperationBodyToCallMapper)
that uses getExpression()
as the origin.
See variablesIntroducedBetween(OCLExpression, OCLExpression, OperationBodyToCallMapper)
for description.
parent
-
null
set, possibly emptyprotected static OCLExpression commonCompositionParent(OCLExpression first, OCLExpression second)
OCLExpression
s. If the two expressions
don't have a common container, null
is returned.
first
- The first OCLExpression
.second
- The second OCLExpression
.
protected OCLExpression commonCompositionParent(OCLExpression second)
commonCompositionParent(OCLExpression, OCLExpression)
that uses getExpression()
as the origin.
See commonCompositionParent(OCLExpression, OCLExpression)
for description.
second
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |