Package com.ibm.wala.util.graph.impl
Class SparseNumberedEdgeManager<T>
- java.lang.Object
-
- com.ibm.wala.util.graph.impl.SparseNumberedEdgeManager<T>
-
- All Implemented Interfaces:
EdgeManager<T>,NumberedEdgeManager<T>,Serializable
public final class SparseNumberedEdgeManager<T> extends Object implements NumberedEdgeManager<T>, Serializable
An object which tracks edges for nodes that have numbers.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager)SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager, int normalCase, byte delegateImpl)If normalOutCount == n, this edge manager will eagerly allocated n words to hold out edges for each node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(T src, T dst)intgetPredNodeCount(T N)Return the number ofimmediate predecessornodes of nIntSetgetPredNodeNumbers(@Nullable T node)Iterator<T>getPredNodes(@Nullable T N)Return anIteratorover the immediate predecessor nodes of nintgetSuccNodeCount(int number)intgetSuccNodeCount(T N)Return the number ofimmediate successornodes of this Node in the GraphIntSetgetSuccNodeNumbers(@Nullable T node)Iterator<T>getSuccNodes(int number)Iterator<T>getSuccNodes(@Nullable T N)Return an Iterator over the immediate successor nodes of nbooleanhasAnySuccessor(int node)This is implemented as a shortcut for efficiencybooleanhasEdge(@Nullable T src, @Nullable T dst)voidremoveAllIncidentEdges(T node)voidremoveEdge(T src, T dst)voidremoveIncomingEdges(T node)voidremoveOutgoingEdges(T node)StringtoString()
-
-
-
Constructor Detail
-
SparseNumberedEdgeManager
public SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager)
- Parameters:
nodeManager- an object to track nodes
-
SparseNumberedEdgeManager
public SparseNumberedEdgeManager(NumberedNodeManager<T> nodeManager, int normalCase, byte delegateImpl) throws IllegalArgumentException
If normalOutCount == n, this edge manager will eagerly allocated n words to hold out edges for each node. (performance optimization for time)- Parameters:
nodeManager- an object to track nodesnormalCase- what is the "normal" number of out edges for a node?- Throws:
IllegalArgumentException- if normalCase < 0
-
-
Method Detail
-
getPredNodes
public Iterator<T> getPredNodes(@Nullable T N) throws IllegalArgumentException
Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of nThis method never returns
null.- Specified by:
getPredNodesin interfaceEdgeManager<T>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException- See Also:
EdgeManager.getPredNodes(java.lang.Object)
-
getPredNodeCount
public int getPredNodeCount(T N) throws IllegalArgumentException
Description copied from interface:EdgeManagerReturn the number ofimmediate predecessornodes of n- Specified by:
getPredNodeCountin interfaceEdgeManager<T>- Returns:
- the number of immediate predecessors of n.
- Throws:
IllegalArgumentException- See Also:
EdgeManager.getPredNodeCount(java.lang.Object)
-
getSuccNodes
public Iterator<T> getSuccNodes(@Nullable T N) throws IllegalArgumentException
Description copied from interface:EdgeManagerReturn an Iterator over the immediate successor nodes of nThis method never returns
null.- Specified by:
getSuccNodesin interfaceEdgeManager<T>- Returns:
- an Iterator over the immediate successor nodes of n
- Throws:
IllegalArgumentException- See Also:
EdgeManager.getSuccNodes(java.lang.Object)
-
getSuccNodeNumbers
public IntSet getSuccNodeNumbers(@Nullable T node) throws IllegalArgumentException
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<T>- Returns:
- the numbers identifying the immediate successors of node
- Throws:
IllegalArgumentException
-
getPredNodeNumbers
public IntSet getPredNodeNumbers(@Nullable T node) throws IllegalArgumentException
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<T>- Returns:
- the numbers identifying the immediate predecessors of node
- Throws:
IllegalArgumentException
-
getSuccNodeCount
public int getSuccNodeCount(T N) throws IllegalArgumentException
Description copied from interface:EdgeManagerReturn the number ofimmediate successornodes of this Node in the Graph- Specified by:
getSuccNodeCountin interfaceEdgeManager<T>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
- Throws:
IllegalArgumentException- See Also:
EdgeManager.getSuccNodeCount(java.lang.Object)
-
getSuccNodeCount
public int getSuccNodeCount(int number)
-
addEdge
public void addEdge(T src, T dst) throws IllegalArgumentException
- Specified by:
addEdgein interfaceEdgeManager<T>- Throws:
IllegalArgumentException- See Also:
EdgeManager.addEdge(java.lang.Object, java.lang.Object)
-
hasEdge
public boolean hasEdge(@Nullable T src, @Nullable T dst)
- Specified by:
hasEdgein interfaceEdgeManager<T>
-
removeAllIncidentEdges
public void removeAllIncidentEdges(T node) throws IllegalArgumentException
- Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<T>- Throws:
IllegalArgumentException- See Also:
EdgeManager.removeAllIncidentEdges(Object)
-
removeIncomingEdges
public void removeIncomingEdges(T node) throws IllegalArgumentException
- Specified by:
removeIncomingEdgesin interfaceEdgeManager<T>- Throws:
IllegalArgumentException- See Also:
EdgeManager.removeAllIncidentEdges(Object)
-
removeEdge
public void removeEdge(T src, T dst) throws IllegalArgumentException
- Specified by:
removeEdgein interfaceEdgeManager<T>- Throws:
IllegalArgumentException
-
removeOutgoingEdges
public void removeOutgoingEdges(T node) throws IllegalArgumentException
- Specified by:
removeOutgoingEdgesin interfaceEdgeManager<T>- Throws:
IllegalArgumentException- See Also:
EdgeManager.removeAllIncidentEdges(Object)
-
hasAnySuccessor
public boolean hasAnySuccessor(int node)
This is implemented as a shortcut for efficiency- Returns:
- true iff that node has any successors
-
-