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>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add a node to this graphboolean
Return the (fake) interproceduralroot node
of the call graph.int
getNode
(int number) If you want to get all the nodes corresponding to a particular method, regardless of context, then usegetNodes
int
int
int
getNumberOfTargets
(CGNode node, CallSiteReference site) getPossibleSites
(CGNode src, CGNode target) getPossibleTargets
(CGNode node, CallSiteReference site) Return the set of CGNodes that represent possible targets of a particular call site from a particular nodeint
Return the number ofimmediate predecessor
nodes of ngetPredNodeNumbers
(CGNode node) Return anIterator
over the immediate predecessor nodes of nint
Return the number ofimmediate successor
nodes of this Node in the GraphgetSuccNodeNumbers
(CGNode node) Return an Iterator over the immediate successor nodes of nboolean
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
remove a node and all its incident edgesvoid
removeOutgoingEdges
(CGNode node) stream()
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
-
Constructor Details
-
PrunedCallGraph
Create a pruned (filtered) view of an existing call graph.Note: the created instance retains references to
cg
andkeep
without making private copies thereof. Be cautious if subsequently modifyingcg
orkeep
outside of this class's control. In particular,keep
must always be a subset of the nodes incg
or else unexpected behavior may arise.- Parameters:
cg
- Underlying call graph to prunekeep
- Subset ofcg
nodes to include in the pruned graph- Throws:
IllegalArgumentException
- if anykeep
node is not a node incg
-
PrunedCallGraph
-
-
Method Details
-
removeNodeAndEdges
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
-
iterator
-
stream
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodes
in interfaceNodeManager<CGNode>
- Returns:
- the number of nodes in this graph
-
addNode
Description copied from interface:NodeManager
add a node to this graph- Specified by:
addNode
in interfaceNodeManager<CGNode>
-
removeNode
Description copied from interface:NodeManager
remove a node from this graph- Specified by:
removeNode
in interfaceNodeManager<CGNode>
- Throws:
UnsupportedOperationException
-
containsNode
- Specified by:
containsNode
in interfaceNodeManager<CGNode>
- Returns:
- true iff the graph contains the specified node
-
getPredNodes
Description copied from interface:EdgeManager
Return anIterator
over the immediate predecessor nodes of nThis method never returns
null
.- Specified by:
getPredNodes
in interfaceEdgeManager<CGNode>
- Returns:
- an
Iterator
over the immediate predecessor nodes of this Node.
-
getPredNodeCount
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
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
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
- Specified by:
addEdge
in interfaceEdgeManager<CGNode>
-
removeEdge
- Specified by:
removeEdge
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdges
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
removeIncomingEdges
- Specified by:
removeIncomingEdges
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdges
in interfaceEdgeManager<CGNode>
- Throws:
UnsupportedOperationException
-
hasEdge
- Specified by:
hasEdge
in interfaceEdgeManager<CGNode>
-
getNumber
- Specified by:
getNumber
in interfaceNumberedNodeManager<CGNode>
-
getNode
- Specified by:
getNode
in interfaceNumberedNodeManager<CGNode>
-
getMaxNumber
public int getMaxNumber()- Specified by:
getMaxNumber
in interfaceNumberedNodeManager<CGNode>
-
iterateNodes
- Specified by:
iterateNodes
in interfaceNumberedNodeManager<CGNode>
- Returns:
- iterator of nodes with the numbers in set s
-
getSuccNodeNumbers
- Specified by:
getSuccNodeNumbers
in interfaceNumberedEdgeManager<CGNode>
- Returns:
- the numbers identifying the immediate successors of node
-
getPredNodeNumbers
- Specified by:
getPredNodeNumbers
in interfaceNumberedEdgeManager<CGNode>
- Returns:
- the numbers identifying the immediate predecessors of node
-
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
- Specified by:
getFakeWorldClinitNode
in interfaceCallGraph
-
getEntrypointNodes
- Specified by:
getEntrypointNodes
in interfaceCallGraph
- Returns:
- an Iterator of the nodes designated as "root nodes"
-
getNode
-
getNodes
-
getClassHierarchy
- Specified by:
getClassHierarchy
in interfaceCallGraph
- Returns:
- the governing class hierarchy for this call graph
-
getPossibleTargets
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
- Specified by:
getNumberOfTargets
in interfaceCallGraph
- Returns:
- the number of nodes that the call site may dispatch to
-
getPossibleSites
- Specified by:
getPossibleSites
in interfaceCallGraph
- Returns:
- iterator of CallSiteReference, the call sites in a node that might dispatch to the target node.
-