org.eclipse.ocl.examples.impactanalyzer.instanceScope
Class CompositeNavigationStep

java.lang.Object
  extended by org.eclipse.ocl.examples.impactanalyzer.instanceScope.AbstractNavigationStep
      extended by org.eclipse.ocl.examples.impactanalyzer.instanceScope.CompositeNavigationStep
All Implemented Interfaces:
HashCodeChangeListener, NavigationStep, SemanticComparable
Direct Known Subclasses:
BranchingNavigationStep, NavigationStepSequence

public abstract class CompositeNavigationStep
extends AbstractNavigationStep
implements HashCodeChangeListener

A navigation step that branches in several paths and combines the results into one. As hashCode and equals depend on the subordinate steps, steps of this class register as HashCodeChangeListener on each contained step and propagate the event correspondingly. The hash code combination for the subordinate steps, once computed, is cached and updated when subordinate steps send hash code change events.


Constructor Summary
CompositeNavigationStep(org.eclipse.emf.ecore.EClass sourceType, org.eclipse.emf.ecore.EClass targetType, OCLExpression debugInfo, NavigationStep... steps)
           
 
Method Summary
 void afterHashCodeChange(NavigationStep step, int token)
          Called after the step's SemanticIdentity hash code has changed.
 void beforeHashCodeChange(NavigationStep step, int token)
          Invoked before step's SemanticIdentity changes its hash code.
protected  int distinctSize(java.util.Set<SemanticIdentity> visited)
           
 InstanceScopeAnalysis getInstanceScopeAnalysis()
           
 SemanticIdentity getSemanticIdentity()
           
protected  SemanticIdentity getSemanticIdentityOfAbstractNavigationStep()
           
 NavigationStep[] getSteps()
           
protected  int size(java.util.Set<NavigationStep> visited)
          The default size in particular for atomic navigation steps is 1.
 
Methods inherited from class org.eclipse.ocl.examples.impactanalyzer.instanceScope.AbstractNavigationStep
addAlwaysEmptyChangeListener, addEnteringScopes, addExpressionForWhichThisIsNavigationStep, addHashCodeChangeListener, addLeavingScopes, addSourceTypeChangeListener, addTargetTypeChangeListener, annotateEObject, contentToString, distinctSize, doesSourceTypeMatch, fireAfterHashCodeChange, fireBeforeHashCodeChange, getDebugInfo, getEnteringScopes, getId, getLeavingScopes, getNavigateCounter, getResultObjectsCounter, getSourceType, getTargetType, haveIntersectingSubclassTree, incrementNavigateCounter, isAbsolute, isAlwaysEmpty, navigate, navigate, newTokenForFiringHashCodeChangeEvent, setAlwaysEmpty, size, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeNavigationStep

public CompositeNavigationStep(org.eclipse.emf.ecore.EClass sourceType,
                               org.eclipse.emf.ecore.EClass targetType,
                               OCLExpression debugInfo,
                               NavigationStep... steps)
Method Detail

getSemanticIdentityOfAbstractNavigationStep

protected SemanticIdentity getSemanticIdentityOfAbstractNavigationStep()

getSteps

public NavigationStep[] getSteps()

beforeHashCodeChange

public void beforeHashCodeChange(NavigationStep step,
                                 int token)
Description copied from interface: HashCodeChangeListener
Invoked before step's SemanticIdentity changes its hash code. When this method is called for a step, the HashCodeChangeListener.afterHashCodeChange(NavigationStep, int) is guaranteed to be called on the same listener later, immediately after the hash code has changed. Receiving this call gives the receiver the opportunity to remove the step from hashed structures in order to re-insert it later when the hash code has assumed the new value.

Specified by:
beforeHashCodeChange in interface HashCodeChangeListener
token - a token value identifying the root cause of the change by a monotonously-increasing number. This can be used in cyclic NavigationStep graphs to decide that a root cause has already been handled by a listener when it comes by a second time.

afterHashCodeChange

public void afterHashCodeChange(NavigationStep step,
                                int token)
Description copied from interface: HashCodeChangeListener
Called after the step's SemanticIdentity hash code has changed. This gives hash structures the opportunity to enter the step again.

Specified by:
afterHashCodeChange in interface HashCodeChangeListener
token - a token value identifying the root cause of the change by a monotonously-increasing number. This can be used in cyclic NavigationStep graphs to decide that a root cause has already been handled by a listener when it comes by a second time.

size

protected int size(java.util.Set<NavigationStep> visited)
The default size in particular for atomic navigation steps is 1.

Overrides:
size in class AbstractNavigationStep

distinctSize

protected int distinctSize(java.util.Set<SemanticIdentity> visited)
Overrides:
distinctSize in class AbstractNavigationStep

getSemanticIdentity

public SemanticIdentity getSemanticIdentity()
Specified by:
getSemanticIdentity in interface SemanticComparable
Overrides:
getSemanticIdentity in class AbstractNavigationStep

getInstanceScopeAnalysis

public InstanceScopeAnalysis getInstanceScopeAnalysis()