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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadd a node to this graphbooleanReturn the (fake) interproceduralroot nodeof the call graph.intgetNode(int number) If you want to get all the nodes corresponding to a particular method, regardless of context, then usegetNodesintintintgetNumberOfTargets(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 nodeintReturn the number ofimmediate predecessornodes of ngetPredNodeNumbers(CGNode node) Return anIteratorover the immediate predecessor nodes of nintReturn the number ofimmediate successornodes of this Node in the GraphgetSuccNodeNumbers(CGNode node) Return an Iterator over the immediate successor nodes of nbooleaniterator()voidremoveAllIncidentEdges(CGNode node) voidremoveEdge(CGNode src, CGNode dst) voidremoveIncomingEdges(CGNode node) voidremoveNode(CGNode n) remove a node from this graphvoidremove a node and all its incident edgesvoidremoveOutgoingEdges(CGNode node) stream()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
PrunedCallGraph
Create a pruned (filtered) view of an existing call graph.Note: the created instance retains references to
cgandkeepwithout making private copies thereof. Be cautious if subsequently modifyingcgorkeepoutside of this class's control. In particular,keepmust always be a subset of the nodes incgor else unexpected behavior may arise.- Parameters:
cg- Underlying call graph to prunekeep- Subset ofcgnodes to include in the pruned graph- Throws:
IllegalArgumentException- if anykeepnode is not a node incg
-
PrunedCallGraph
-
-
Method Details
-
removeNodeAndEdges
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
-
iterator
-
stream
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodesin interfaceNodeManager<CGNode>- Returns:
- the number of nodes in this graph
-
addNode
Description copied from interface:NodeManageradd a node to this graph- Specified by:
addNodein interfaceNodeManager<CGNode>
-
removeNode
Description copied from interface:NodeManagerremove a node from this graph- Specified by:
removeNodein interfaceNodeManager<CGNode>- Throws:
UnsupportedOperationException
-
containsNode
- Specified by:
containsNodein interfaceNodeManager<CGNode>- Returns:
- true iff the graph contains the specified node
-
getPredNodes
Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of nThis method never returns
null.- Specified by:
getPredNodesin interfaceEdgeManager<CGNode>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node.
-
getPredNodeCount
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
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
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
- Specified by:
addEdgein interfaceEdgeManager<CGNode>
-
removeEdge
- Specified by:
removeEdgein interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
removeIncomingEdges
- Specified by:
removeIncomingEdgesin interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdgesin interfaceEdgeManager<CGNode>- Throws:
UnsupportedOperationException
-
hasEdge
- Specified by:
hasEdgein interfaceEdgeManager<CGNode>
-
getNumber
- Specified by:
getNumberin interfaceNumberedNodeManager<CGNode>
-
getNode
- Specified by:
getNodein interfaceNumberedNodeManager<CGNode>
-
getMaxNumber
public int getMaxNumber()- Specified by:
getMaxNumberin interfaceNumberedNodeManager<CGNode>
-
iterateNodes
- Specified by:
iterateNodesin interfaceNumberedNodeManager<CGNode>- Returns:
- iterator of nodes with the numbers in set s
-
getSuccNodeNumbers
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<CGNode>- Returns:
- the numbers identifying the immediate successors of node
-
getPredNodeNumbers
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<CGNode>- Returns:
- the numbers identifying the immediate predecessors of node
-
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
- Specified by:
getFakeWorldClinitNodein interfaceCallGraph
-
getEntrypointNodes
- Specified by:
getEntrypointNodesin interfaceCallGraph- Returns:
- an Iterator of the nodes designated as "root nodes"
-
getNode
-
getNodes
-
getClassHierarchy
- Specified by:
getClassHierarchyin interfaceCallGraph- Returns:
- the governing class hierarchy for this call graph
-
getPossibleTargets
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
- Specified by:
getNumberOfTargetsin interfaceCallGraph- Returns:
- the number of nodes that the call site may dispatch to
-
getPossibleSites
- Specified by:
getPossibleSitesin interfaceCallGraph- Returns:
- iterator of CallSiteReference, the call sites in a node that might dispatch to the target node.
-