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 |
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() |
public IBiDirectionalWrapper(IGraphDataSource<V> gds)
public void attachObserver(IGraphObserver<V> go)
IGraphDataSource
attachObserver
in interface IGraphDataSource<V>
go
- the graph observerpublic void detachObserver(IGraphObserver<V> go)
IGraphDataSource
detachObserver
in interface IGraphDataSource<V>
go
- the graph observerpublic java.util.Set<V> getAllNodes()
IGraphDataSource
getAllNodes
in interface IGraphDataSource<V>
public java.util.List<V> getTargetNodes(V source)
IGraphDataSource
getTargetNodes
in interface IGraphDataSource<V>
source
- the source nodepublic java.util.List<V> getSourceNodes(V target)
IBiDirectionalGraphDataSource
List
as
multiple edges can be present between two arbitrary nodes. If no such node can be found than the method should
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 n)
IGraphObserver
nodeDeleted
in interface IGraphObserver<V>
n
- the nodepublic java.lang.String toString()
toString
in class java.lang.Object