Package com.ibm.wala.util.graph.impl
Class DelegatingGraph<T>
- java.lang.Object
-
- com.ibm.wala.util.graph.impl.DelegatingGraph<T>
-
- All Implemented Interfaces:
EdgeManager<T>
,Graph<T>
,NodeManager<T>
,java.lang.Iterable<T>
public class DelegatingGraph<T> extends java.lang.Object implements Graph<T>
A utility class.
-
-
Constructor Summary
Constructors Constructor Description DelegatingGraph(Graph<T> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdge(T src, T dst)
void
addNode(T n)
add a node to this graphboolean
containsNode(T N)
int
getNumberOfNodes()
int
getPredNodeCount(T N)
Return the number ofimmediate predecessor
nodes of njava.util.Iterator<T>
getPredNodes(T N)
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.int
getSuccNodeCount(T N)
Return the number ofimmediate successor
nodes of this Node in the Graphjava.util.Iterator<T>
getSuccNodes(T N)
Return an Iterator over the immediate successor nodes of nboolean
hasEdge(T src, T dst)
java.util.Iterator<T>
iterator()
void
removeAllIncidentEdges(T node)
void
removeEdge(T src, T dst)
void
removeIncomingEdges(T node)
void
removeNode(T n)
remove a node from this graphvoid
removeNodeAndEdges(T N)
remove a node and all its incident edgesvoid
removeOutgoingEdges(T node)
java.lang.String
toString()
-
-
-
Method Detail
-
addEdge
public void addEdge(T src, T dst) throws java.lang.IllegalArgumentException
- Specified by:
addEdge
in interfaceEdgeManager<T>
- Throws:
java.lang.IllegalArgumentException
-
addNode
public void addNode(T n)
Description copied from interface:NodeManager
add a node to this graph- Specified by:
addNode
in interfaceNodeManager<T>
-
containsNode
public boolean containsNode(T N)
- Specified by:
containsNode
in interfaceNodeManager<T>
- Returns:
- true iff the graph contains the specified node
-
getNumberOfNodes
public int getNumberOfNodes()
- Specified by:
getNumberOfNodes
in interfaceNodeManager<T>
- Returns:
- the number of nodes in this graph
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getPredNodeCount
public int getPredNodeCount(T N) throws java.lang.IllegalArgumentException
Description copied from interface:EdgeManager
Return the number ofimmediate predecessor
nodes of n- Specified by:
getPredNodeCount
in interfaceEdgeManager<T>
- Returns:
- the number of immediate predecessors of n.
- Throws:
java.lang.IllegalArgumentException
-
getPredNodes
public java.util.Iterator<T> getPredNodes(T N) throws java.lang.IllegalArgumentException
Description copied from interface:EdgeManager
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.- Specified by:
getPredNodes
in interfaceEdgeManager<T>
- Returns:
- an
Iterator
over the immediate predecessor nodes of this Node. - Throws:
java.lang.IllegalArgumentException
-
getSuccNodeCount
public int getSuccNodeCount(T N) throws java.lang.IllegalArgumentException
Description copied from interface:EdgeManager
Return the number ofimmediate successor
nodes of this Node in the Graph- Specified by:
getSuccNodeCount
in interfaceEdgeManager<T>
- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
- Throws:
java.lang.IllegalArgumentException
-
getSuccNodes
public java.util.Iterator<T> getSuccNodes(T N) throws java.lang.IllegalArgumentException
Description copied from interface:EdgeManager
Return an Iterator over the immediate successor nodes of nThis method never returns
null
.- Specified by:
getSuccNodes
in interfaceEdgeManager<T>
- Returns:
- an Iterator over the immediate successor nodes of n
- Throws:
java.lang.IllegalArgumentException
-
hasEdge
public boolean hasEdge(T src, T dst)
- Specified by:
hasEdge
in interfaceEdgeManager<T>
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
- Specified by:
iterator
in interfaceNodeManager<T>
- Returns:
- an
Iterator
of the nodes in this graph
-
removeAllIncidentEdges
public void removeAllIncidentEdges(T node) throws java.lang.IllegalArgumentException
- Specified by:
removeAllIncidentEdges
in interfaceEdgeManager<T>
- Throws:
java.lang.IllegalArgumentException
-
removeEdge
public void removeEdge(T src, T dst) throws java.lang.IllegalArgumentException
- Specified by:
removeEdge
in interfaceEdgeManager<T>
- Throws:
java.lang.IllegalArgumentException
-
removeIncomingEdges
public void removeIncomingEdges(T node) throws java.lang.IllegalArgumentException
- Specified by:
removeIncomingEdges
in interfaceEdgeManager<T>
- Throws:
java.lang.IllegalArgumentException
-
removeNode
public void removeNode(T n)
Description copied from interface:NodeManager
remove a node from this graph- Specified by:
removeNode
in interfaceNodeManager<T>
-
removeNodeAndEdges
public void removeNodeAndEdges(T N) throws java.lang.IllegalArgumentException
Description copied from interface:Graph
remove a node and all its incident edges- Specified by:
removeNodeAndEdges
in interfaceGraph<T>
- Throws:
java.lang.IllegalArgumentException
-
removeOutgoingEdges
public void removeOutgoingEdges(T node) throws java.lang.IllegalArgumentException
- Specified by:
removeOutgoingEdges
in interfaceEdgeManager<T>
- Throws:
java.lang.IllegalArgumentException
-
-