Class PrunedCallGraph
- java.lang.Object
-
- com.ibm.wala.ipa.callgraph.pruned.PrunedCallGraph
-
- All Implemented Interfaces:
CallGraph,EdgeManager<CGNode>,Graph<CGNode>,NodeManager<CGNode>,NumberedEdgeManager<CGNode>,NumberedGraph<CGNode>,NumberedNodeManager<CGNode>,Iterable<CGNode>
public class PrunedCallGraph extends Object implements CallGraph
-
-
Constructor Summary
Constructors Constructor Description PrunedCallGraph(CallGraph cg, Set<CGNode> keep)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(CGNode src, CGNode dst)voidaddNode(CGNode n)add a node to this graphbooleancontainsNode(CGNode n)IClassHierarchygetClassHierarchy()Collection<CGNode>getEntrypointNodes()CGNodegetFakeRootNode()Return the (fake) interproceduralroot nodeof the call graph.CGNodegetFakeWorldClinitNode()intgetMaxNumber()CGNodegetNode(int number)CGNodegetNode(IMethod method, Context C)If you want to get all the nodes corresponding to a particular method, regardless of context, then usegetNodesSet<CGNode>getNodes(MethodReference m)intgetNumber(CGNode N)intgetNumberOfNodes()intgetNumberOfTargets(CGNode node, CallSiteReference site)Iterator<CallSiteReference>getPossibleSites(CGNode src, CGNode target)Set<CGNode>getPossibleTargets(CGNode node, CallSiteReference site)Return the set of CGNodes that represent possible targets of a particular call site from a particular nodeintgetPredNodeCount(CGNode n)Return the number ofimmediate predecessornodes of nIntSetgetPredNodeNumbers(CGNode node)Iterator<CGNode>getPredNodes(CGNode n)Return anIteratorover the immediate predecessor nodes of n This method never returnsnull.intgetSuccNodeCount(CGNode n)Return the number ofimmediate successornodes of this Node in the GraphIntSetgetSuccNodeNumbers(CGNode node)Iterator<CGNode>getSuccNodes(CGNode n)Return an Iterator over the immediate successor nodes of nbooleanhasEdge(CGNode src, CGNode dst)Iterator<CGNode>iterateNodes(IntSet s)Iterator<CGNode>iterator()voidremoveAllIncidentEdges(CGNode node)voidremoveEdge(CGNode src, CGNode dst)voidremoveIncomingEdges(CGNode node)voidremoveNode(CGNode n)remove a node from this graphvoidremoveNodeAndEdges(CGNode n)remove a node and all its incident edgesvoidremoveOutgoingEdges(CGNode node)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
removeNodeAndEdges
public void removeNodeAndEdges(CGNode n) throws UnsupportedOperationException
Description copied from interface:Graphremove a node and all its incident edges- Specified by:
removeNodeAndEdgesin interfaceGraph<CGNode>- Throws:
UnsupportedOperationException- if the graph implementation does not allow removal
-
getNumberOfNodes
public int getNumberOfNodes()
- Specified by:
getNumberOfNodesin interfaceNodeManager<CGNode>- Returns:
- the number of nodes in this graph
-
addNode
public void addNode(CGNode n)
Description copied from interface:NodeManageradd a node to this graph- Specified by:
addNodein interfaceNodeManager<CGNode>
-
removeNode
public void removeNode(CGNode n) throws UnsupportedOperationException
Description copied from interface:NodeManagerremove a node from this graph- Specified by:
removeNodein interfaceNodeManager<CGNode>- Throws:
UnsupportedOperationException
-
containsNode
public boolean containsNode(CGNode n)
- Specified by:
containsNodein interfaceNodeManager<CGNode>- Returns:
- true iff the graph contains the specified node
-
getPredNodes
public Iterator<CGNode> getPredNodes(CGNode n)
Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of n This method never returnsnull.- Specified by:
getPredNodesin interfaceEdgeManager<CGNode>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node.
-
getPredNodeCount
public int getPredNodeCount(CGNode n)
Description copied from interface:EdgeManagerReturn the number ofimmediate predecessornodes of n- Specified by:
getPredNodeCountin interfaceEdgeManager<CGNode>- Returns:
- the number of immediate predecessors of n.
-
getSuccNodes
public Iterator<CGNode> getSuccNodes(CGNode n)
Description copied from interface:EdgeManagerReturn an Iterator over the immediate successor nodes of nThis method never returns
null.- Specified by:
getSuccNodesin interfaceEdgeManager<CGNode>- Returns:
- an Iterator over the immediate successor nodes of n
-
getSuccNodeCount
public int getSuccNodeCount(CGNode n)
Description copied from interface:EdgeManagerReturn the number ofimmediate successornodes of this Node in the Graph- Specified by:
getSuccNodeCountin interfaceEdgeManager<CGNode>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
-
addEdge
public void addEdge(CGNode src, CGNode dst)
- Specified by:
addEdgein interfaceEdgeManager<CGNode>
-
removeEdge
public void removeEdge(CGNode src, CGNode dst) throws UnsupportedOperationException
- Specified by:
removeEdgein interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
removeAllIncidentEdges
public void removeAllIncidentEdges(CGNode node) throws UnsupportedOperationException
- Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
removeIncomingEdges
public void removeIncomingEdges(CGNode node) throws UnsupportedOperationException
- Specified by:
removeIncomingEdgesin interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
public void removeOutgoingEdges(CGNode node) throws UnsupportedOperationException
- Specified by:
removeOutgoingEdgesin interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
hasEdge
public boolean hasEdge(CGNode src, CGNode dst)
- Specified by:
hasEdgein interfaceEdgeManager<CGNode>
-
getNumber
public int getNumber(CGNode N)
- Specified by:
getNumberin interfaceNumberedNodeManager<CGNode>
-
getNode
public CGNode getNode(int number)
- Specified by:
getNodein interfaceNumberedNodeManager<CGNode>
-
getMaxNumber
public int getMaxNumber()
- Specified by:
getMaxNumberin interfaceNumberedNodeManager<CGNode>
-
iterateNodes
public Iterator<CGNode> iterateNodes(IntSet s)
- Specified by:
iterateNodesin interfaceNumberedNodeManager<CGNode>- Returns:
- iterator of nodes with the numbers in set s
-
getSuccNodeNumbers
public IntSet getSuccNodeNumbers(CGNode node)
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<CGNode>- Returns:
- the numbers identifying the immediate successors of node
-
getPredNodeNumbers
public IntSet getPredNodeNumbers(CGNode node)
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<CGNode>- Returns:
- the numbers identifying the immediate predecessors of node
-
getFakeRootNode
public CGNode getFakeRootNode()
Description copied from interface:CallGraphReturn the (fake) interproceduralroot nodeof the call graph.- Specified by:
getFakeRootNodein interfaceCallGraph- Returns:
- the "fake" root node the call graph
-
getFakeWorldClinitNode
public CGNode getFakeWorldClinitNode()
- Specified by:
getFakeWorldClinitNodein interfaceCallGraph
-
getEntrypointNodes
public Collection<CGNode> getEntrypointNodes()
- Specified by:
getEntrypointNodesin interfaceCallGraph- Returns:
- an Iterator of the nodes designated as "root nodes"
-
getNode
public CGNode getNode(IMethod method, Context C)
Description copied from interface:CallGraphIf you want to get all the nodes corresponding to a particular method, regardless of context, then usegetNodes
-
getNodes
public Set<CGNode> getNodes(MethodReference m)
-
getClassHierarchy
public IClassHierarchy getClassHierarchy()
- Specified by:
getClassHierarchyin interfaceCallGraph- Returns:
- the governing class hierarchy for this call graph
-
getPossibleTargets
public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site)
Description copied from interface:CallGraphReturn the set of CGNodes that represent possible targets of a particular call site from a particular node- Specified by:
getPossibleTargetsin interfaceCallGraph
-
getNumberOfTargets
public int getNumberOfTargets(CGNode node, CallSiteReference site)
- Specified by:
getNumberOfTargetsin interfaceCallGraph- Returns:
- the number of nodes that the call site may dispatch to
-
getPossibleSites
public Iterator<CallSiteReference> getPossibleSites(CGNode src, CGNode target)
- Specified by:
getPossibleSitesin interfaceCallGraph- Returns:
- iterator of CallSiteReference, the call sites in a node that might dispatch to the target node.
-
-