Class IBiDirectionalWrapper<V>

java.lang.Object
tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalWrapper<V>
Type Parameters:
V - the type parameter of the nodes in the graph data source
All Implemented Interfaces:
IBiDirectionalGraphDataSource<V>, IGraphDataSource<V>, IGraphObserver<V>

public class IBiDirectionalWrapper<V> extends 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.
  • Constructor Details

  • Method Details

    • attachObserver

      public void attachObserver(IGraphObserver<V> observer)
      Description copied from interface: IGraphDataSource
      Attaches a new graph observer to this graph data source. Observers will be notified in the order they have been registered.
      Specified by:
      attachObserver in interface IGraphDataSource<V>
      Parameters:
      observer - the graph observer
    • attachAsFirstObserver

      public void attachAsFirstObserver(IGraphObserver<V> observer)
      Description copied from interface: IGraphDataSource
      Attaches a new graph observer to this graph data source as the first one. In the notification order this observer will be the first one as long as another call to this method happens.
      Specified by:
      attachAsFirstObserver in interface IGraphDataSource<V>
      Parameters:
      observer - the graph observer
    • detachObserver

      public void detachObserver(IGraphObserver<V> observer)
      Description copied from interface: IGraphDataSource
      Detaches an already registered graph observer from this graph data source.
      Specified by:
      detachObserver in interface IGraphDataSource<V>
      Parameters:
      observer - the graph observer
    • getAllNodes

      public Set<V> getAllNodes()
      Description copied from interface: IGraphDataSource
      Returns the complete set of nodes in the graph data source.
      Specified by:
      getAllNodes in interface IGraphDataSource<V>
      Returns:
      the set of all nodes
    • getTargetNodes

      public IMemoryView<V> getTargetNodes(V source)
      Description copied from interface: IGraphDataSource
      Returns the target nodes for the given source node. The returned data structure is an IMultiset because of potential parallel edges in the graph data source. The method must not return null.
      Specified by:
      getTargetNodes in interface IGraphDataSource<V>
      Parameters:
      source - the source node
      Returns:
      the multiset of target nodes
    • getSourceNodes

      public IMemoryView<V> getSourceNodes(V target)
      Description copied from interface: IBiDirectionalGraphDataSource
      Returns the source nodes for the given target node. The returned data structure is an IMultiset because of potential parallel edges in the graph data source. The method must not return null.
      Specified by:
      getSourceNodes in interface IBiDirectionalGraphDataSource<V>
      Parameters:
      target - the target node
      Returns:
      the multiset of source nodes
    • 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 node)
      Description copied from interface: IGraphObserver
      Used to notify when a node is deleted from the graph.
      Specified by:
      nodeDeleted in interface IGraphObserver<V>
      Parameters:
      node - the node
    • toString

      public String toString()
      Overrides:
      toString in class Object