org.eclipse.incquery.runtime.base.core

## Class TransitiveClosureHelperImpl

- java.lang.Object
- - org.eclipse.emf.common.notify.impl.AdapterImpl
  - - org.eclipse.emf.ecore.util.EContentAdapter
    - - org.eclipse.incquery.runtime.base.core.TransitiveClosureHelperImpl

- All Implemented Interfaces:
    org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal, FeatureListener, InstanceListener, TransitiveClosureHelper, ITcDataSource<org.eclipse.emf.ecore.EObject>, ITcObserver<org.eclipse.emf.ecore.EObject>

      public class TransitiveClosureHelperImpl
      extends org.eclipse.emf.ecore.util.EContentAdapter
      implements TransitiveClosureHelper, ITcObserver<org.eclipse.emf.ecore.EObject>, FeatureListener, InstanceListener

  Implementation class for the `TransitiveClosureHelper`. It uses a `NavigationHelper` instance to wrap an EMF model and make it suitable for the `IncSCCAlg` algorithm.
  Author:
    Tamas Szabo

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter

      `org.eclipse.emf.common.notify.Adapter.Internal`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransitiveClosureHelperImpl(NavigationHelper navigationHelper, boolean disposeBaseIndexWhenDisposed, java.util.Set<org.eclipse.emf.ecore.EReference> references)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `attachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)` Attach a transitive closure relation observer.
    `void` | `detachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)` Detach a transitive closure relation observer.
    `void` | `dispose()` Call this method to properly dispose the data structures of a transitive closure algorithm.
    `void` | `featureDeleted(org.eclipse.emf.ecore.EObject host, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)` Called when the given value is removed from the given feature of the given host EObject.
    `void` | `featureInserted(org.eclipse.emf.ecore.EObject host, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)` Called when the given value is inserted into the given feature of the given host EObject.
    `java.util.Set<org.eclipse.emf.ecore.EObject>` | `getAllReachableSources(org.eclipse.emf.ecore.EObject target)` Returns all nodes from which the target node is reachable.
    `java.util.Set<org.eclipse.emf.ecore.EObject>` | `getAllReachableTargets(org.eclipse.emf.ecore.EObject source)` Returns all nodes which are reachable from the source node.
    `IGraphPathFinder<org.eclipse.emf.ecore.EObject>` | `getPathFinder()` The returned `IGraphPathFinder` can be used to retrieve paths between nodes using transitive reachability.
    `java.util.List<org.eclipse.emf.ecore.EObject>` | `getReachabilityPath(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)` Returns a reachability path between the given source and target elements, or null if no such transitive reachability is present in the graph.
    `void` | `instanceDeleted(org.eclipse.emf.ecore.EClass clazz, org.eclipse.emf.ecore.EObject instance)` Called when the given instance was removed from the model.
    `void` | `instanceInserted(org.eclipse.emf.ecore.EClass clazz, org.eclipse.emf.ecore.EObject instance)` Called when the given instance was added to the model.
    `boolean` | `isReachable(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)` Returns true if the target node is reachable from the source node.
    `void` | `tupleDeleted(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)` Used to notify when a tuple is deleted from the transitive closure relation.
    `void` | `tupleInserted(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target)` Used to notify when a tuple is inserted into the transitive closure relation.

    - ### Methods inherited from class org.eclipse.emf.ecore.util.EContentAdapter

      `notifyChanged, setTarget, unsetTarget`

    - ### Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl

      `getTarget, isAdapterForType`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TransitiveClosureHelperImpl

          public TransitiveClosureHelperImpl(NavigationHelper navigationHelper,
                                             boolean disposeBaseIndexWhenDisposed,
                                             java.util.Set<org.eclipse.emf.ecore.EReference> references)

  - ### Method Detail

    - #### attachObserver

          public void attachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)

      Description copied from interface: `ITcDataSource`
      Attach a transitive closure relation observer.
      Specified by:
        `attachObserver` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `to` - the observer object

    - #### detachObserver

          public void detachObserver(ITcObserver<org.eclipse.emf.ecore.EObject> to)

      Description copied from interface: `ITcDataSource`
      Detach a transitive closure relation observer.
      Specified by:
        `detachObserver` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `to` - the observer object

    - #### getAllReachableTargets

          public java.util.Set<org.eclipse.emf.ecore.EObject> getAllReachableTargets(org.eclipse.emf.ecore.EObject source)

      Description copied from interface: `ITcDataSource`
      Returns all nodes which are reachable from the source node.
      Specified by:
        `getAllReachableTargets` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `source` - the source node
      Returns:
        the set of target nodes

    - #### getAllReachableSources

          public java.util.Set<org.eclipse.emf.ecore.EObject> getAllReachableSources(org.eclipse.emf.ecore.EObject target)

      Description copied from interface: `ITcDataSource`
      Returns all nodes from which the target node is reachable.
      Specified by:
        `getAllReachableSources` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `target` - the target node
      Returns:
        the set of source nodes

    - #### isReachable

          public boolean isReachable(org.eclipse.emf.ecore.EObject source,
                                     org.eclipse.emf.ecore.EObject target)

      Description copied from interface: `ITcDataSource`
      Returns true if the target node is reachable from the source node.
      Specified by:
        `isReachable` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `source` - the source node
        `target` - the target node
      Returns:
        true if target is reachable from source, false otherwise

    - #### tupleInserted

          public void tupleInserted(org.eclipse.emf.ecore.EObject source,
                                    org.eclipse.emf.ecore.EObject target)

      Description copied from interface: `ITcObserver`
      Used to notify when a tuple is inserted into the transitive closure relation.
      Specified by:
        `tupleInserted` in interface `ITcObserver<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `source` - the source of the tuple
        `target` - the target of the tuple

    - #### tupleDeleted

          public void tupleDeleted(org.eclipse.emf.ecore.EObject source,
                                   org.eclipse.emf.ecore.EObject target)

      Description copied from interface: `ITcObserver`
      Used to notify when a tuple is deleted from the transitive closure relation.
      Specified by:
        `tupleDeleted` in interface `ITcObserver<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `source` - the source of the tuple
        `target` - the target of the tuple

    - #### dispose

          public void dispose()

      Description copied from interface: `ITcDataSource`
      Call this method to properly dispose the data structures of a transitive closure algorithm.
      Specified by:
        `dispose` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`

    - #### featureInserted

          public void featureInserted(org.eclipse.emf.ecore.EObject host,
                                      org.eclipse.emf.ecore.EStructuralFeature feature,
                                      java.lang.Object value)

      Description copied from interface: `FeatureListener`
      Called when the given value is inserted into the given feature of the given host EObject.
      Specified by:
        `featureInserted` in interface `FeatureListener`
      Parameters:
        `host` - the host (holder) of the feature
        `feature` - the `EAttribute` or `EReference` instance
        `value` - the target of the feature

    - #### featureDeleted

          public void featureDeleted(org.eclipse.emf.ecore.EObject host,
                                     org.eclipse.emf.ecore.EStructuralFeature feature,
                                     java.lang.Object value)

      Description copied from interface: `FeatureListener`
      Called when the given value is removed from the given feature of the given host EObject.
      Specified by:
        `featureDeleted` in interface `FeatureListener`
      Parameters:
        `host` - the host (holder) of the feature
        `feature` - the `EAttribute` or `EReference` instance
        `value` - the target of the feature

    - #### instanceInserted

          public void instanceInserted(org.eclipse.emf.ecore.EClass clazz,
                                       org.eclipse.emf.ecore.EObject instance)

      Description copied from interface: `InstanceListener`
      Called when the given instance was added to the model.
      Specified by:
        `instanceInserted` in interface `InstanceListener`
      Parameters:
        `clazz` - an EClass registered for this listener, for which a new instance (possibly an instance of a subclass) was inserted into the model
        `instance` - an EObject instance that was inserted into the model

    - #### instanceDeleted

          public void instanceDeleted(org.eclipse.emf.ecore.EClass clazz,
                                      org.eclipse.emf.ecore.EObject instance)

      Description copied from interface: `InstanceListener`
      Called when the given instance was removed from the model.
      Specified by:
        `instanceDeleted` in interface `InstanceListener`
      Parameters:
        `clazz` - an EClass registered for this listener, for which an instance (possibly an instance of a subclass) was removed from the model
        `instance` - an EObject instance that was removed from the model

    - #### getReachabilityPath

          public java.util.List<org.eclipse.emf.ecore.EObject> getReachabilityPath(org.eclipse.emf.ecore.EObject source,
                                                                                   org.eclipse.emf.ecore.EObject target)

      Description copied from interface: `ITcDataSource`
      Returns a reachability path between the given source and target elements, or null if no such transitive reachability is present in the graph. The returned `List` contains the nodes along the path (this means that there is an edge in the graph between two consecutive nodes), including the source and target nodes. A self loop (one edge) is indicated with the source node being present two times in the returned `List`.

      Note that the paths are not maintained incrementally and in worst case the complexity of the path construction is O(|V|+|E|) (one depth-first graph traversal). There is no guarantee that the given path is the shortest one between the given two nodes.
      Specified by:
        `getReachabilityPath` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`
      Parameters:
        `source` - the source node
        `target` - the target node
      Returns:
        a path between the nodes, or null if target is not reachable from source

    - #### getPathFinder

          public IGraphPathFinder<org.eclipse.emf.ecore.EObject> getPathFinder()

      Description copied from interface: `ITcDataSource`
      The returned `IGraphPathFinder` can be used to retrieve paths between nodes using transitive reachability.
      Specified by:
        `getPathFinder` in interface `ITcDataSource<org.eclipse.emf.ecore.EObject>`
      Returns:
        a path finder for the graph.