Package com.ibm.wala.ipa.callgraph.impl
Class PartialCallGraph
- java.lang.Object
-
- com.ibm.wala.util.graph.impl.DelegatingGraph<CGNode>
-
- com.ibm.wala.ipa.callgraph.impl.PartialCallGraph
-
- All Implemented Interfaces:
CallGraph
,EdgeManager<CGNode>
,Graph<CGNode>
,NodeManager<CGNode>
,NumberedEdgeManager<CGNode>
,NumberedGraph<CGNode>
,NumberedNodeManager<CGNode>
,Iterable<CGNode>
public class PartialCallGraph extends DelegatingGraph<CGNode> implements CallGraph
a view of a portion of a call graph.
-
-
Field Summary
Fields Modifier and Type Field Description protected CallGraph
cg
protected Collection<CGNode>
partialRoots
-
Constructor Summary
Constructors Modifier Constructor Description protected
PartialCallGraph(CallGraph cg, Collection<CGNode> partialRoots, Graph<CGNode> partialGraph)
-
Method Summary
-
Methods inherited from class com.ibm.wala.util.graph.impl.DelegatingGraph
addEdge, addNode, containsNode, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.ibm.wala.util.graph.EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
-
Methods inherited from interface com.ibm.wala.util.graph.Graph
removeNodeAndEdges
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.ibm.wala.util.graph.NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode
-
-
-
-
Field Detail
-
cg
protected final CallGraph cg
-
partialRoots
protected final Collection<CGNode> partialRoots
-
-
Constructor Detail
-
PartialCallGraph
protected PartialCallGraph(CallGraph cg, Collection<CGNode> partialRoots, Graph<CGNode> partialGraph)
-
-
Method Detail
-
make
public static PartialCallGraph make(CallGraph cg, Collection<CGNode> partialRoots, Collection<CGNode> nodes)
- Parameters:
cg
- the original call graphpartialRoots
- roots of the new, partial graphnodes
- set of nodes that will be included in the new, partial call graph
-
make
public static PartialCallGraph make(CallGraph cg, Collection<CGNode> partialRoots)
- Parameters:
cg
- the original call graphpartialRoots
- roots of the new, partial graph the result contains only nodes reachable from the partialRoots in the original call graph.
-
getFakeRootNode
public CGNode getFakeRootNode() throws UnsupportedOperationException
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
- Throws:
UnsupportedOperationException
-
getFakeWorldClinitNode
public CGNode getFakeWorldClinitNode() throws UnsupportedOperationException
- Specified by:
getFakeWorldClinitNode
in interfaceCallGraph
- Throws:
UnsupportedOperationException
-
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
-
iterateNodes
public Iterator<CGNode> iterateNodes(IntSet nodes)
- Specified by:
iterateNodes
in interfaceNumberedNodeManager<CGNode>
- Returns:
- iterator of nodes with the numbers in set s
-
getMaxNumber
public int getMaxNumber()
- Specified by:
getMaxNumber
in interfaceNumberedNodeManager<CGNode>
-
getNode
public CGNode getNode(int index)
- Specified by:
getNode
in interfaceNumberedNodeManager<CGNode>
-
getNumber
public int getNumber(CGNode n)
- Specified by:
getNumber
in interfaceNumberedNodeManager<CGNode>
-
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
-
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.
-
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
-
-