V
- the type parameter of the nodes in the graph data sourcepublic class IBiDirectionalWrapper<V> extends java.lang.Object implements IBiDirectionalGraphDataSource<V>, IGraphObserver<V>
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 and Description |
---|
IBiDirectionalWrapper(IGraphDataSource<V> gds) |
Modifier and Type | Method and Description |
---|---|
void |
attachAsFirstObserver(IGraphObserver<V> observer)
Attaches a new graph observer to this graph data source as the first one.
|
void |
attachObserver(IGraphObserver<V> observer)
Attaches a new graph observer to this graph data source.
|
void |
detachObserver(IGraphObserver<V> observer)
Detaches an already registered graph observer from this graph data source.
|
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()
Returns the complete set of nodes in the graph data source.
|
IMemoryView<V> |
getSourceNodes(V target)
Returns the source nodes for the given target node.
|
IMemoryView<V> |
getTargetNodes(V source)
Returns the target nodes for the given source node.
|
void |
nodeDeleted(V node)
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() |
public IBiDirectionalWrapper(IGraphDataSource<V> gds)
public void attachObserver(IGraphObserver<V> observer)
IGraphDataSource
attachObserver
in interface IGraphDataSource<V>
observer
- the graph observerpublic void attachAsFirstObserver(IGraphObserver<V> observer)
IGraphDataSource
attachAsFirstObserver
in interface IGraphDataSource<V>
observer
- the graph observerpublic void detachObserver(IGraphObserver<V> observer)
IGraphDataSource
detachObserver
in interface IGraphDataSource<V>
observer
- the graph observerpublic java.util.Set<V> getAllNodes()
IGraphDataSource
getAllNodes
in interface IGraphDataSource<V>
public IMemoryView<V> getTargetNodes(V source)
IGraphDataSource
IMultiset
because of potential parallel edges in the graph data source.
The method must not return null.getTargetNodes
in interface IGraphDataSource<V>
source
- the source nodepublic IMemoryView<V> getSourceNodes(V target)
IBiDirectionalGraphDataSource
IMultiset
because of potential parallel edges in the graph data source.
The method must not return null.getSourceNodes
in interface IBiDirectionalGraphDataSource<V>
target
- the target nodepublic void edgeInserted(V source, V target)
IGraphObserver
edgeInserted
in interface IGraphObserver<V>
source
- the source of the edgetarget
- the target of the edgepublic void edgeDeleted(V source, V target)
IGraphObserver
edgeDeleted
in interface IGraphObserver<V>
source
- the source of the edgetarget
- the target of the edgepublic void nodeInserted(V n)
IGraphObserver
nodeInserted
in interface IGraphObserver<V>
n
- the nodepublic void nodeDeleted(V node)
IGraphObserver
nodeDeleted
in interface IGraphObserver<V>
node
- the nodepublic java.lang.String toString()
toString
in class java.lang.Object