|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NavigationStep
During instance scope analysis, starting from an event's source element, by navigation the analyzer is trying to find a small superset of those context elements for which re-evaluating the OCL expression may yield a different value after the event compared to the value the OCL expression would have returned before the event. This navigation is performed by following a set of pre-computed paths. The paths are precomputed because many subexpressions in an OCL expression do not reasonably contribute to the finding of those contexts and should therefore be pruned during an analysis that is performend only once per expression.
Navigation steps are generally able to navigate from one or more EObject
s to zero or more EObject
s. Each
navigation step knows its static start and end type. If the source element's type doesn't conform to the step's start type, the
navigation is not performed and an empty set is returned immediately. If the target type is not matched, an empty set is
returned, too.
Navigation steps may form a possibly cyclic (in case of recursive operations) graph. Steps may navigate, e.g., along
associations or ascend the composition hierarchy, using RefObject#refImmediateComposite()
.
A navigation step object may change its #hashCode()
over its life time. This particularly has to do with
the propagation of information taking place after an IndirectingStep
has its actual step set. This can lead
to a ripple effect regarding source and target type settings as well as isAlwaysEmpty()
changes, all
affecting a step's hash code and equality definition. Whenever you insert a navigation step into a hashing
structure such as a HashMap
or a HashSet
, ensure that you use addHashCodeChangeListener(HashCodeChangeListener)
to register yourself as a listener for hash code changes. Whenever such a change is signalled, take this as an
opportunity to first remove (before the change) the navigation step object from the hashing structure and then
insert it again with the new hash code after the change. See also HashCodeChangeListener
.
Method Summary | |
---|---|
void |
addAlwaysEmptyChangeListener(AlwaysEmptyChangeListener listener)
Whenever the result of isAlwaysEmpty() changes, registered listeners will be informed by calling their
ChangeListener#alwaysEmptyChanged(NavigationStep) method with this step as parameter. |
void |
addEnteringScopes(java.util.Set<Variable> enteringScope)
Sets the set of variables that come into scope when this navigation step is navigated. |
void |
addExpressionForWhichThisIsNavigationStep(OCLExpression oclExpression)
Adds oclExpression as an expression for which this is the computed
navigation step. |
void |
addHashCodeChangeListener(HashCodeChangeListener listener)
|
void |
addLeavingScopes(java.util.Set<Variable> leavingScopes)
Adds variables to the set of variables leaving scope when navigating this step. |
void |
addSourceTypeChangeListener(SourceTypeChangeListener listener)
Whenever the result of getSourceType() changes, registered listeners will be informed by calling their
SourceTypeChangeListener.sourceTypeChanged(NavigationStep) method with this step as parameter. |
void |
addTargetTypeChangeListener(TargetTypeChangeListener listener)
Whenever the result of getTargetType() changes, registered listeners will be informed by calling their
TargetTypeChangeListener.targetTypeChanged(NavigationStep) method with this step as parameter. |
int |
distinctSize()
|
java.util.Set<OCLExpression> |
getDebugInfo()
Optionally, a navigation step may tell for which OCL expression it was mainly created. |
java.util.Set<Variable> |
getEnteringScopes()
Returns the variables that come into scope when this navigation step is navigated. |
java.util.Set<Variable> |
getLeavingScopes()
Returns the variables that fall out of scope when navigating this step. |
org.eclipse.emf.ecore.EClass |
getSourceType()
|
org.eclipse.emf.ecore.EClass |
getTargetType()
|
boolean |
isAbsolute()
Some "navigation" steps produce absolute results, ignoring the from object that is passed to navigate(Set, TracebackCache, Notification) . |
boolean |
isAlwaysEmpty()
Tells if this step in all cases returns an empty set. |
java.util.Set<AnnotatedEObject> |
navigate(java.util.Set<AnnotatedEObject> from,
TracebackCache cache,
org.eclipse.emf.common.notify.Notification changeEvent)
|
int |
size()
Counts the number of steps in the navigation step tree of which this is the root |
Methods inherited from interface org.eclipse.ocl.examples.impactanalyzer.util.SemanticComparable |
---|
getSemanticIdentity |
Method Detail |
---|
java.util.Set<AnnotatedEObject> navigate(java.util.Set<AnnotatedEObject> from, TracebackCache cache, org.eclipse.emf.common.notify.Notification changeEvent)
cache
- keys are lists of which the first element (index 0) is the NavigationStep
, the second element (index 1)
the from-object (of type AnnotatedEObject
) for which to look up any previously computed results.boolean isAbsolute()
navigate(Set, TracebackCache, Notification)
. Those must return true here. Examples are navigation steps returning
all instances of a given type and the step always returning the empty set.
boolean isAlwaysEmpty()
isAlwaysEmpty()
implies isAbsolute()
org.eclipse.emf.ecore.EClass getSourceType()
org.eclipse.emf.ecore.EClass getTargetType()
java.util.Set<OCLExpression> getDebugInfo()
void addAlwaysEmptyChangeListener(AlwaysEmptyChangeListener listener)
isAlwaysEmpty()
changes, registered listeners will be informed by calling their
ChangeListener#alwaysEmptyChanged(NavigationStep)
method with this step as parameter.
void addSourceTypeChangeListener(SourceTypeChangeListener listener)
getSourceType()
changes, registered listeners will be informed by calling their
SourceTypeChangeListener.sourceTypeChanged(NavigationStep)
method with this step as parameter.
void addTargetTypeChangeListener(TargetTypeChangeListener listener)
getTargetType()
changes, registered listeners will be informed by calling their
TargetTypeChangeListener.targetTypeChanged(NavigationStep)
method with this step as parameter.
void addHashCodeChangeListener(HashCodeChangeListener listener)
int size()
int distinctSize()
void addExpressionForWhichThisIsNavigationStep(OCLExpression oclExpression)
oclExpression
as an expression for which this is the computed
navigation step. Multiple expressions may share the same navigation step. An expression
added here will be returned in the set resulting from getDebugInfo()
.
java.util.Set<Variable> getLeavingScopes()
Variable
s. Note
that variables leaving scope can immediately come into scope again, thus occurring in the results of
getLeavingScopes()
as well as getEnteringScopes()
. It just means that the variable shows up in a new
dynamic scope.
Variable
s that represents the scopes left by navigating this step.void addLeavingScopes(java.util.Set<Variable> leavingScopes)
Variable
s. Note that variables leaving scope can immediately come into scope again, thus occurring in the results
of getLeavingScopes()
as well as getEnteringScopes()
. It just means that the variable shows up in a new
dynamic scope.
leavingScopes
- the set of Variable
s that fall out of scope by navigating this step.java.util.Set<Variable> getEnteringScopes()
Variable
.
Variable
s coming entering scope by navigating this step.void addEnteringScopes(java.util.Set<Variable> enteringScope)
Set>|Variable
>
.
enteringScope
- the set of Variable
s representing the variables getting into scope by navigating this step.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |