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, iterateNodesaddEdge, addNode, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeOutgoingEdgesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetClassHierarchy, getNumberOfTargets, getPossibleSites, getPossibleTargetsgetMaxNumber, getNode, getNumber, iterateNodesaddNode, removeNodeforEach, spliteratorgetPredNodeNumbers, getSuccNodeNumbersaddEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdgesprotected final Map<MethodReference,Set<CGNode>> mr2Nodes
public void init()
throws CancelException
CancelExceptionprotected abstract CGNode makeFakeRootNode() throws CancelException
CancelExceptionprotected abstract CGNode makeFakeWorldClinitNode() throws CancelException
CancelExceptionpublic 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()
CallGraphroot node of the call graph.getFakeRootNode in interface CallGraphpublic CGNode getFakeWorldClinitNode()
getFakeWorldClinitNode in interface CallGraphpublic void registerEntrypoint(CGNode node)
public Collection<CGNode> getEntrypointNodes()
getEntrypointNodes in interface CallGraphpublic String toString()
toString in class AbstractGraph<CGNode>public void removeNodeAndEdges(CGNode N) throws UnimplementedError
GraphremoveNodeAndEdges in interface Graph<CGNode>removeNodeAndEdges in class AbstractGraph<CGNode>UnimplementedErrorpublic CGNode getNode(IMethod method, Context C)
CallGraphgetNodespublic 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()