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>
,java.io.Serializable
public final class SparseNumberedEdgeManager<T> extends java.lang.Object implements NumberedEdgeManager<T>, java.io.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 void
addEdge(T src, T dst)
int
getPredNodeCount(T N)
Return the number ofimmediate predecessor
nodes of nIntSet
getPredNodeNumbers(T node)
java.util.Iterator<T>
getPredNodes(T N)
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.int
getSuccNodeCount(int number)
int
getSuccNodeCount(T N)
Return the number ofimmediate successor
nodes of this Node in the GraphIntSet
getSuccNodeNumbers(T node)
java.util.Iterator<T>
getSuccNodes(int number)
java.util.Iterator<T>
getSuccNodes(T N)
Return an Iterator over the immediate successor nodes of nboolean
hasAnySuccessor(int node)
This is implemented as a shortcut for efficiencyboolean
hasEdge(T src, T dst)
void
removeAllIncidentEdges(T node)
void
removeEdge(T src, T dst)
void
removeIncomingEdges(T node)
void
removeOutgoingEdges(T node)
java.lang.String
toString()
-
-
-
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 java.lang.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:
java.lang.IllegalArgumentException
- if normalCase < 0
-
-
Method Detail
-
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
-
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
-
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
-
getSuccNodes
public java.util.Iterator<T> getSuccNodes(int number)
-
getSuccNodeNumbers
public IntSet getSuccNodeNumbers(T node) throws java.lang.IllegalArgumentException
- Specified by:
getSuccNodeNumbers
in interfaceNumberedEdgeManager<T>
- Returns:
- the numbers identifying the immediate successors of node
- Throws:
java.lang.IllegalArgumentException
-
getPredNodeNumbers
public IntSet getPredNodeNumbers(T node) throws java.lang.IllegalArgumentException
- Specified by:
getPredNodeNumbers
in interfaceNumberedEdgeManager<T>
- Returns:
- the numbers identifying the immediate predecessors of 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
-
getSuccNodeCount
public int getSuccNodeCount(int number)
-
addEdge
public void addEdge(T src, T dst) throws java.lang.IllegalArgumentException
- Specified by:
addEdge
in interfaceEdgeManager<T>
- Throws:
java.lang.IllegalArgumentException
-
hasEdge
public boolean hasEdge(T src, T dst)
- Specified by:
hasEdge
in interfaceEdgeManager<T>
-
removeAllIncidentEdges
public void removeAllIncidentEdges(T node) throws java.lang.IllegalArgumentException
- Specified by:
removeAllIncidentEdges
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
-
removeEdge
public void removeEdge(T src, T dst) throws java.lang.IllegalArgumentException
- Specified by:
removeEdge
in interfaceEdgeManager<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
-
hasAnySuccessor
public boolean hasAnySuccessor(int node)
This is implemented as a shortcut for efficiency- Returns:
- true iff that node has any successors
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-