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 void
addEdge(CGNode src, CGNode dst)
void
addNode(CGNode n)
add a node to this graphboolean
containsNode(CGNode n)
IClassHierarchy
getClassHierarchy()
Collection<CGNode>
getEntrypointNodes()
CGNode
getFakeRootNode()
Return the (fake) interproceduralroot node
of the call graph.CGNode
getFakeWorldClinitNode()
int
getMaxNumber()
CGNode
getNode(int number)
CGNode
getNode(IMethod method, Context C)
If you want to get all the nodes corresponding to a particular method, regardless of context, then usegetNodes
Set<CGNode>
getNodes(MethodReference m)
int
getNumber(CGNode N)
int
getNumberOfNodes()
int
getNumberOfTargets(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 nodeint
getPredNodeCount(CGNode n)
Return the number ofimmediate predecessor
nodes of nIntSet
getPredNodeNumbers(CGNode node)
Iterator<CGNode>
getPredNodes(CGNode n)
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.int
getSuccNodeCount(CGNode n)
Return the number ofimmediate successor
nodes of this Node in the GraphIntSet
getSuccNodeNumbers(CGNode node)
Iterator<CGNode>
getSuccNodes(CGNode n)
Return an Iterator over the immediate successor nodes of nboolean
hasEdge(CGNode src, CGNode dst)
Iterator<CGNode>
iterateNodes(IntSet s)
Iterator<CGNode>
iterator()
void
removeAllIncidentEdges(CGNode node)
void
removeEdge(CGNode src, CGNode dst)
void
removeIncomingEdges(CGNode node)
void
removeNode(CGNode n)
remove a node from this graphvoid
removeNodeAndEdges(CGNode n)
remove a node and all its incident edgesvoid
removeOutgoingEdges(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:Graph
remove a node and all its incident edges- Specified by:
removeNodeAndEdges
in interfaceGraph<CGNode>
- Throws:
UnsupportedOperationException
- if the graph implementation does not allow removal
-
getNumberOfNodes
public int getNumberOfNodes()
- Specified by:
getNumberOfNodes
in interfaceNodeManager<CGNode>
- Returns:
- the number of nodes in this graph
-
addNode
public void addNode(CGNode n)
Description copied from interface:NodeManager
add a node to this graph- Specified by:
addNode
in interfaceNodeManager<CGNode>
-
removeNode
public void removeNode(CGNode n) throws UnsupportedOperationException
Description copied from interface:NodeManager
remove a node from this graph- Specified by:
removeNode
in interfaceNodeManager<CGNode>
- Throws:
UnsupportedOperationException
-
containsNode
public boolean containsNode(CGNode n)
- Specified by:
containsNode
in interfaceNodeManager<CGNode>
- Returns:
- true iff the graph contains the specified node
-
getPredNodes
public Iterator<CGNode> getPredNodes(CGNode n)
Description copied from interface:EdgeManager
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.- Specified by:
getPredNodes
in interfaceEdgeManager<CGNode>
- Returns:
- an
Iterator
over the immediate predecessor nodes of this Node.
-
getPredNodeCount
public int getPredNodeCount(CGNode n)
Description copied from interface:EdgeManager
Return the number ofimmediate predecessor
nodes of n- Specified by:
getPredNodeCount
in interfaceEdgeManager<CGNode>
- Returns:
- the number of immediate predecessors of n.
-
getSuccNodes
public Iterator<CGNode> getSuccNodes(CGNode n)
Description copied from interface:EdgeManager
Return an Iterator over the immediate successor nodes of nThis method never returns
null
.- Specified by:
getSuccNodes
in interfaceEdgeManager<CGNode>
- Returns:
- an Iterator over the immediate successor nodes of n
-
getSuccNodeCount
public int getSuccNodeCount(CGNode n)
Description copied from interface:EdgeManager
Return the number ofimmediate successor
nodes of this Node in the Graph- Specified by:
getSuccNodeCount
in 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:
addEdge
in interfaceEdgeManager<CGNode>
-
removeEdge
public void removeEdge(CGNode src, CGNode dst) throws UnsupportedOperationException
- Specified by:
removeEdge
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
removeAllIncidentEdges
public void removeAllIncidentEdges(CGNode node) throws UnsupportedOperationException
- Specified by:
removeAllIncidentEdges
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
removeIncomingEdges
public void removeIncomingEdges(CGNode node) throws UnsupportedOperationException
- Specified by:
removeIncomingEdges
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
public void removeOutgoingEdges(CGNode node) throws UnsupportedOperationException
- Specified by:
removeOutgoingEdges
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
hasEdge
public boolean hasEdge(CGNode src, CGNode dst)
- Specified by:
hasEdge
in interfaceEdgeManager<CGNode>
-
getNumber
public int getNumber(CGNode N)
- Specified by:
getNumber
in interfaceNumberedNodeManager<CGNode>
-
getNode
public CGNode getNode(int number)
- Specified by:
getNode
in interfaceNumberedNodeManager<CGNode>
-
getMaxNumber
public int getMaxNumber()
- Specified by:
getMaxNumber
in interfaceNumberedNodeManager<CGNode>
-
iterateNodes
public Iterator<CGNode> iterateNodes(IntSet s)
- Specified by:
iterateNodes
in interfaceNumberedNodeManager<CGNode>
- Returns:
- iterator of nodes with the numbers in set s
-
getSuccNodeNumbers
public IntSet getSuccNodeNumbers(CGNode node)
- Specified by:
getSuccNodeNumbers
in interfaceNumberedEdgeManager<CGNode>
- Returns:
- the numbers identifying the immediate successors of node
-
getPredNodeNumbers
public IntSet getPredNodeNumbers(CGNode node)
- Specified by:
getPredNodeNumbers
in interfaceNumberedEdgeManager<CGNode>
- Returns:
- the numbers identifying the immediate predecessors of node
-
getFakeRootNode
public CGNode getFakeRootNode()
Description copied from interface:CallGraph
Return the (fake) interproceduralroot node
of the call graph.- Specified by:
getFakeRootNode
in interfaceCallGraph
- Returns:
- the "fake" root node the call graph
-
getFakeWorldClinitNode
public CGNode getFakeWorldClinitNode()
- Specified by:
getFakeWorldClinitNode
in interfaceCallGraph
-
getEntrypointNodes
public Collection<CGNode> getEntrypointNodes()
- Specified by:
getEntrypointNodes
in interfaceCallGraph
- Returns:
- an Iterator of the nodes designated as "root nodes"
-
getNode
public CGNode getNode(IMethod method, Context C)
Description copied from interface:CallGraph
If 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:
getClassHierarchy
in interfaceCallGraph
- Returns:
- the governing class hierarchy for this call graph
-
getPossibleTargets
public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site)
Description copied from interface:CallGraph
Return the set of CGNodes that represent possible targets of a particular call site from a particular node- Specified by:
getPossibleTargets
in interfaceCallGraph
-
getNumberOfTargets
public int getNumberOfTargets(CGNode node, CallSiteReference site)
- Specified by:
getNumberOfTargets
in interfaceCallGraph
- Returns:
- the number of nodes that the call site may dispatch to
-
getPossibleSites
public Iterator<CallSiteReference> getPossibleSites(CGNode src, CGNode target)
- Specified by:
getPossibleSites
in interfaceCallGraph
- Returns:
- iterator of CallSiteReference, the call sites in a node that might dispatch to the target node.
-
-