public abstract class BasicCallGraph<T> extends AbstractNumberedGraph<CGNode> implements CallGraph
Modifier and Type | Class and Description |
---|---|
protected static class |
BasicCallGraph.Key |
class |
BasicCallGraph.NodeImpl
A class that represents the a normal node in a call graph.
|
Modifier and Type | Field and Description |
---|---|
protected Map<MethodReference,Set<CGNode>> |
mr2Nodes
A mapping from MethodReference to Set of nodes that represent this methodReference.
|
Constructor and Description |
---|
BasicCallGraph() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsNode(CGNode N)
This implementation is necessary because the underlying SparseNumberedGraph may not support node membership tests.
|
abstract CGNode |
findOrCreateNode(IMethod method,
Context C)
Use with extreme care.
|
Collection<CGNode> |
getEntrypointNodes()
Note: not all successors of the root node are entrypoints
|
CGNode |
getFakeRootNode()
Return the (fake) interprocedural
root node of the call graph. |
CGNode |
getFakeWorldClinitNode() |
protected T |
getInterpreter(CGNode node) |
protected BasicCallGraph.NodeImpl |
getNode(BasicCallGraph.Key K) |
CGNode |
getNode(IMethod method,
Context C)
If you want to get all the nodes corresponding to a particular method, regardless of context, then use
getNodes |
protected NumberedNodeManager<CGNode> |
getNodeManager() |
Set<CGNode> |
getNodes(MethodReference m) |
int |
getNumberOfNodes()
We override this since this class supports remove() on nodes, but the superclass doesn't.
|
void |
init() |
Iterator<CGNode> |
iterator()
We override this since this class supports remove() on nodes, but the superclass doesn't.
|
protected abstract CGNode |
makeFakeRootNode() |
protected abstract CGNode |
makeFakeWorldClinitNode() |
void |
registerEntrypoint(CGNode node)
record that a node is an entrypoint
|
protected void |
registerNode(BasicCallGraph.Key K,
CGNode N) |
void |
removeNodeAndEdges(CGNode N)
remove a node and all its incident edges
|
void |
setInterpreter(T interpreter) |
void |
summarizeByPackage() |
String |
toString() |
getEdgeManager, getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodes
addEdge, addNode, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeOutgoingEdges
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getClassHierarchy, getNumberOfTargets, getPossibleSites, getPossibleTargets
getMaxNumber, getNode, getNumber, iterateNodes
addNode, removeNode
forEach, spliterator
getPredNodeNumbers, getSuccNodeNumbers
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
protected final Map<MethodReference,Set<CGNode>> mr2Nodes
public void init() throws CancelException
CancelException
protected abstract CGNode makeFakeRootNode() throws CancelException
CancelException
protected abstract CGNode makeFakeWorldClinitNode() throws CancelException
CancelException
public abstract CGNode findOrCreateNode(IMethod method, Context C) throws CancelException
CancelException
- TODOprotected void registerNode(BasicCallGraph.Key K, CGNode N)
protected BasicCallGraph.NodeImpl getNode(BasicCallGraph.Key K)
public CGNode getFakeRootNode()
CallGraph
root node
of the call graph.getFakeRootNode
in interface CallGraph
public CGNode getFakeWorldClinitNode()
getFakeWorldClinitNode
in interface CallGraph
public void registerEntrypoint(CGNode node)
public Collection<CGNode> getEntrypointNodes()
getEntrypointNodes
in interface CallGraph
public String toString()
toString
in class AbstractGraph<CGNode>
public void removeNodeAndEdges(CGNode N) throws UnimplementedError
Graph
removeNodeAndEdges
in interface Graph<CGNode>
removeNodeAndEdges
in class AbstractGraph<CGNode>
UnimplementedError
public CGNode getNode(IMethod method, Context C)
CallGraph
getNodes
public Set<CGNode> getNodes(MethodReference m)
protected T getInterpreter(CGNode node)
node
- a call graph node we want information aboutpublic int getNumberOfNodes()
getNumberOfNodes
in interface NodeManager<CGNode>
getNumberOfNodes
in class AbstractGraph<CGNode>
NodeManager.getNumberOfNodes()
public Iterator<CGNode> iterator()
iterator
in interface NodeManager<CGNode>
iterator
in interface Iterable<CGNode>
iterator
in class AbstractGraph<CGNode>
Iterator
of the nodes in this graphNodeManager.iterator()
public boolean containsNode(CGNode N)
containsNode
in interface NodeManager<CGNode>
containsNode
in class AbstractGraph<CGNode>
IllegalArgumentException
- if N is nullpublic void setInterpreter(T interpreter)
protected NumberedNodeManager<CGNode> getNodeManager()
getNodeManager
in class AbstractNumberedGraph<CGNode>
public void summarizeByPackage()