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:
-
Constructor Summary
ConstructorDescriptionSparseNumberedEdgeManager
(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
Modifier and TypeMethodDescriptionvoid
int
Return the number ofimmediate predecessor
nodes of ngetPredNodeNumbers
(@Nullable T node) getPredNodes
(@Nullable T N) Return anIterator
over the immediate predecessor nodes of nint
getSuccNodeCount
(int number) int
Return the number ofimmediate successor
nodes of this Node in the GraphgetSuccNodeNumbers
(@Nullable T node) getSuccNodes
(int number) getSuccNodes
(@Nullable T N) Return an Iterator over the immediate successor nodes of nboolean
hasAnySuccessor
(int node) This is implemented as a shortcut for efficiencyboolean
void
removeAllIncidentEdges
(T node) void
removeEdge
(T src, T dst) void
removeIncomingEdges
(T node) void
removeOutgoingEdges
(T node) toString()
-
Constructor Details
-
SparseNumberedEdgeManager
- 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 Details
-
getPredNodes
Description copied from interface:EdgeManager
Return anIterator
over the immediate predecessor nodes of nThis method never returns
null
.- Specified by:
getPredNodes
in interfaceEdgeManager<T>
- Returns:
- an
Iterator
over the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException
- See Also:
-
getPredNodeCount
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:
IllegalArgumentException
- See Also:
-
getSuccNodes
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:
IllegalArgumentException
- See Also:
-
getSuccNodes
-
getSuccNodeNumbers
- Specified by:
getSuccNodeNumbers
in interfaceNumberedEdgeManager<T>
- Returns:
- the numbers identifying the immediate successors of node
- Throws:
IllegalArgumentException
-
getPredNodeNumbers
- Specified by:
getPredNodeNumbers
in interfaceNumberedEdgeManager<T>
- Returns:
- the numbers identifying the immediate predecessors of node
- Throws:
IllegalArgumentException
-
getSuccNodeCount
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:
IllegalArgumentException
- See Also:
-
getSuccNodeCount
public int getSuccNodeCount(int number) - See Also:
-
addEdge
- Specified by:
addEdge
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
hasEdge
- Specified by:
hasEdge
in interfaceEdgeManager<T>
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
removeIncomingEdges
- Specified by:
removeIncomingEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
removeEdge
- Specified by:
removeEdge
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
hasAnySuccessor
public boolean hasAnySuccessor(int node) This is implemented as a shortcut for efficiency- Returns:
- true iff that node has any successors
-
toString
-