Class Graph<V>
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.base.itc.graphimpl.Graph<V>
-
- All Implemented Interfaces:
IBiDirectionalGraphDataSource<V>
,IGraphDataSource<V>
public class Graph<V> extends java.lang.Object implements IGraphDataSource<V>, IBiDirectionalGraphDataSource<V>
-
-
Constructor Summary
Constructors Constructor Description Graph()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
attachAsFirstObserver(IGraphObserver<V> observer)
Attaches a new graph observer to this graph data source as the first one.void
attachObserver(IGraphObserver<V> go)
Attaches a new graph observer to this graph data source.void
deleteEdge(V source, V target)
Deprecated.use explicitlydeleteEdgeThatExists(Object, Object)
ordeleteEdgeIfExists(Object, Object)
instead.void
deleteEdgeIfExists(V source, V target)
No-op if trying to delete edge that does not existvoid
deleteEdgeThatExists(V source, V target)
void
deleteNode(V node)
Deletes the given node AND all of the edges going in and out from the node.void
detachObserver(IGraphObserver<V> go)
Detaches an already registered graph observer from this graph data source.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
insertEdge(V source, V target)
void
insertNode(V node)
Insert the given node into the graph.java.lang.String
toString()
-
-
-
Method Detail
-
deleteEdgeIfExists
public void deleteEdgeIfExists(V source, V target)
No-op if trying to delete edge that does not exist- Since:
- 2.0
- See Also:
deleteEdgeIfExists(Object, Object)
-
deleteEdgeThatExists
public void deleteEdgeThatExists(V source, V target)
- Throws:
java.lang.IllegalStateException
- if trying to delete edge that does not exist- Since:
- 2.0
- See Also:
deleteEdgeIfExists(Object, Object)
-
deleteEdge
@Deprecated public void deleteEdge(V source, V target)
Deprecated.use explicitlydeleteEdgeThatExists(Object, Object)
ordeleteEdgeIfExists(Object, Object)
instead. To preserve backwards compatibility, this method delegates to the latter.
-
insertNode
public void insertNode(V node)
Insert the given node into the graph.
-
deleteNode
public void deleteNode(V node)
Deletes the given node AND all of the edges going in and out from the node.
-
attachObserver
public void attachObserver(IGraphObserver<V> go)
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 interfaceIGraphDataSource<V>
- Parameters:
go
- 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 interfaceIGraphDataSource<V>
- Parameters:
observer
- the graph observer
-
detachObserver
public void detachObserver(IGraphObserver<V> go)
Description copied from interface:IGraphDataSource
Detaches an already registered graph observer from this graph data source.- Specified by:
detachObserver
in interfaceIGraphDataSource<V>
- Parameters:
go
- the graph observer
-
getAllNodes
public java.util.Set<V> getAllNodes()
Description copied from interface:IGraphDataSource
Returns the complete set of nodes in the graph data source.- Specified by:
getAllNodes
in interfaceIGraphDataSource<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 anIMultiset
because of potential parallel edges in the graph data source. The method must not return null.- Specified by:
getTargetNodes
in interfaceIGraphDataSource<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 anIMultiset
because of potential parallel edges in the graph data source. The method must not return null.- Specified by:
getSourceNodes
in interfaceIBiDirectionalGraphDataSource<V>
- Parameters:
target
- the target node- Returns:
- the multiset of source nodes
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-