Class DelegatingNumberedNodeManager<T extends INodeWithNumber>
java.lang.Object
com.ibm.wala.util.graph.impl.DelegatingNumberedNodeManager<T>
- All Implemented Interfaces:
NodeManager<T>
,NumberedNodeManager<T>
,Iterable<T>
public class DelegatingNumberedNodeManager<T extends INodeWithNumber>
extends Object
implements NumberedNodeManager<T>
Basic implementation of a numbered graph -- this implementation relies on nodes that carry
numbers and edges.
The management of node numbers is a bit fragile, but designed this way for efficiency. Use this class with care.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
If N.getNumber() == -1, then set N.number and insert this node in the graph.boolean
containsNode
(@Nullable T n) int
getNode
(int number) int
int
iterator()
void
removeNode
(T n) remove a node from this graphstream()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DelegatingNumberedNodeManager
public DelegatingNumberedNodeManager()
-
-
Method Details
-
getNumber
- Specified by:
getNumber
in interfaceNumberedNodeManager<T extends INodeWithNumber>
-
getNode
- Specified by:
getNode
in interfaceNumberedNodeManager<T extends INodeWithNumber>
-
getMaxNumber
public int getMaxNumber()- Specified by:
getMaxNumber
in interfaceNumberedNodeManager<T extends INodeWithNumber>
-
iterator
- Specified by:
iterator
in interfaceIterable<T extends INodeWithNumber>
- Specified by:
iterator
in interfaceNodeManager<T extends INodeWithNumber>
- Returns:
- an
Iterator
of the nodes in this graph - See Also:
-
stream
- Specified by:
stream
in interfaceNodeManager<T extends INodeWithNumber>
- Returns:
- a
Stream
of the nodes in this graph
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodes
in interfaceNodeManager<T extends INodeWithNumber>
- Returns:
- the number of nodes in this graph
- See Also:
-
addNode
If N.getNumber() == -1, then set N.number and insert this node in the graph. Use with extreme care.- Specified by:
addNode
in interfaceNodeManager<T extends INodeWithNumber>
- Throws:
IllegalArgumentException
- if n is null- See Also:
-
removeNode
Description copied from interface:NodeManager
remove a node from this graph- Specified by:
removeNode
in interfaceNodeManager<T extends INodeWithNumber>
- See Also:
-
toString
-
containsNode
- Specified by:
containsNode
in interfaceNodeManager<T extends INodeWithNumber>
- Returns:
- true iff the graph contains the specified node
- See Also:
-
iterateNodes
- Specified by:
iterateNodes
in interfaceNumberedNodeManager<T extends INodeWithNumber>
- Returns:
- iterator of nodes with the numbers in set s
-