org.eclipse.incquery.runtime.base.itc.igraph

## Class IBiDirectionalWrapper<V>

- java.lang.Object
- - org.eclipse.incquery.runtime.base.itc.igraph.IBiDirectionalWrapper<V>

- Type Parameters:
    `V` - the type parameter of the nodes in the graph data source
  All Implemented Interfaces:
    java.io.Serializable, IBiDirectionalGraphDataSource<V>, IGraphDataSource<V>, IGraphObserver<V>

      public class IBiDirectionalWrapper<V>
      extends java.lang.Object
      implements IBiDirectionalGraphDataSource<V>, IGraphObserver<V>

  This class can be used to wrap an `IGraphDataSource` into an `IBiDirectionalGraphDataSource`. This class provides support for the retrieval of source nodes for a given target which is not supported by standard `IGraphDataSource` implementations.
  Author:
    Tamas Szabo
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IBiDirectionalWrapper(IGraphDataSource<V> gds)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `attachObserver(IGraphObserver<V> go)` Attach a new graph observer.
    `void` | `detachObserver(IGraphObserver<V> go)` Detach an existing observer.
    `void` | `edgeDeleted(V source, V target)` Used to notify when an edge is deleted from the graph.
    `void` | `edgeInserted(V source, V target)` Used to notify when an edge is inserted into the graph.
    `java.util.Set<V>` | `getAllNodes()` Get all nodes of the graph.
    `java.util.List<V>` | `getSourceNodes(V target)` Returns the source nodes of those edges that end in target.
    `java.util.List<V>` | `getTargetNodes(V source)` Get those nodes that are the target of an edge starting with source.
    `void` | `nodeDeleted(V n)` Used to notify when a node is deleted from the graph.
    `void` | `nodeInserted(V n)` Used to notify when a node is inserted into the graph.
    `java.lang.String` | `toString()`

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

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

- - ### Constructor Detail

    - #### IBiDirectionalWrapper

          public IBiDirectionalWrapper(IGraphDataSource<V> gds)

  - ### Method Detail

    - #### attachObserver

          public void attachObserver(IGraphObserver<V> go)

      Description copied from interface: `IGraphDataSource`
      Attach a new graph observer. Note that the order of attaching the observers may be important (some observers will be notified earlier than others).
      Specified by:
        `attachObserver` in interface `IGraphDataSource<V>`
      Parameters:
        `go` - the graph observer

    - #### detachObserver

          public void detachObserver(IGraphObserver<V> go)

      Description copied from interface: `IGraphDataSource`
      Detach an existing observer.
      Specified by:
        `detachObserver` in interface `IGraphDataSource<V>`
      Parameters:
        `go` - the graph observer

    - #### getAllNodes

          public java.util.Set<V> getAllNodes()

      Description copied from interface: `IGraphDataSource`
      Get all nodes of the graph.
      Specified by:
        `getAllNodes` in interface `IGraphDataSource<V>`
      Returns:
        the set of all nodes

    - #### getTargetNodes

          public java.util.List<V> getTargetNodes(V source)

      Description copied from interface: `IGraphDataSource`
      Get those nodes that are the target of an edge starting with source. List is returned as multiple edges may be present.
      Specified by:
        `getTargetNodes` in interface `IGraphDataSource<V>`
      Parameters:
        `source` - the source node
      Returns:
        the list of target nodes or null if no targets can be found

    - #### getSourceNodes

          public java.util.List<V> getSourceNodes(V target)

      Description copied from interface: `IBiDirectionalGraphDataSource`
      Returns the source nodes of those edges that end in target. The nodes are returned as a `List` as multiple edges can be present between two arbitrary nodes. If no such node can be found than the method should return null.
      Specified by:
        `getSourceNodes` in interface `IBiDirectionalGraphDataSource<V>`
      Parameters:
        `target` - the target node
      Returns:
        the list of source nodes or null if no sources can be found

    - #### edgeInserted

          public void edgeInserted(V source,
                                   V target)

      Description copied from interface: `IGraphObserver`
      Used to notify when an edge is inserted into the graph.
      Specified by:
        `edgeInserted` in interface `IGraphObserver<V>`
      Parameters:
        `source` - the source of the edge
        `target` - the target of the edge

    - #### edgeDeleted

          public void edgeDeleted(V source,
                                  V target)

      Description copied from interface: `IGraphObserver`
      Used to notify when an edge is deleted from the graph.
      Specified by:
        `edgeDeleted` in interface `IGraphObserver<V>`
      Parameters:
        `source` - the source of the edge
        `target` - the target of the edge

    - #### nodeInserted

          public void nodeInserted(V n)

      Description copied from interface: `IGraphObserver`
      Used to notify when a node is inserted into the graph.
      Specified by:
        `nodeInserted` in interface `IGraphObserver<V>`
      Parameters:
        `n` - the node

    - #### nodeDeleted

          public void nodeDeleted(V n)

      Description copied from interface: `IGraphObserver`
      Used to notify when a node is deleted from the graph.
      Specified by:
        `nodeDeleted` in interface `IGraphObserver<V>`
      Parameters:
        `n` - the node

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`