public class GraphBasedCallGraph extends Object implements MutableCallGraph
| Modifier and Type | Class and Description |
|---|---|
protected static class |
GraphBasedCallGraph.Edge
This internal class is used to describe the edge in the graph.
|
protected static class |
GraphBasedCallGraph.Vertex
This internal class is used to describe a vertex in the graph.
|
| Constructor and Description |
|---|
GraphBasedCallGraph()
The constructor of the graph based call graph.
|
GraphBasedCallGraph(org.jgrapht.graph.DefaultDirectedGraph<GraphBasedCallGraph.Vertex,GraphBasedCallGraph.Edge> graph,
Map<MethodSignature,GraphBasedCallGraph.Vertex> signatureToVertex) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCall(MethodSignature sourceMethod,
MethodSignature targetMethod)
This method enables to add calls that are edges in the call graph.
|
protected void |
addCall(MethodSignature sourceMethod,
MethodSignature targetMethod,
GraphBasedCallGraph.Edge edge) |
void |
addMethod(MethodSignature calledMethod)
This method enables to add method that are nodes in the call graph.
|
protected void |
addMethod(MethodSignature calledMethod,
GraphBasedCallGraph.Vertex vertex) |
int |
callCount()
This method counts every edge in the call graph.
|
Set<MethodSignature> |
callsFrom(MethodSignature sourceMethod)
This method returns all method signatures that are called by a given method signature.
|
Set<MethodSignature> |
callsTo(MethodSignature targetMethod)
This method returns all method signatures that call a given method signature.
|
boolean |
containsCall(MethodSignature sourceMethod,
MethodSignature targetMethod)
This method checks if an edge is contained in the call graph.
|
boolean |
containsMethod(MethodSignature method)
This method checks if a given method signature is a node in the call graph.
|
MutableCallGraph |
copy()
This method copies a call graph.
|
String |
exportAsDot()
This method converts the call graph object into dot format and write it to a string file.
|
protected org.jgrapht.graph.DefaultDirectedGraph<GraphBasedCallGraph.Vertex,GraphBasedCallGraph.Edge> |
getGraph() |
Set<MethodSignature> |
getMethodSignatures()
This method returns method signatures in the call graph.
|
protected Map<MethodSignature,GraphBasedCallGraph.Vertex> |
getSignatureToVertex() |
String |
toString()
This method exports the call graph in a human-readable string.
|
protected MethodSignature |
vertex2MethodSignature(GraphBasedCallGraph.Vertex vertex) |
protected GraphBasedCallGraph.Vertex |
vertexOf(MethodSignature method)
it returns the vertex of the graph that describes the given method signature in the call graph.
|
public GraphBasedCallGraph()
public GraphBasedCallGraph(@Nonnull org.jgrapht.graph.DefaultDirectedGraph<GraphBasedCallGraph.Vertex,GraphBasedCallGraph.Edge> graph, @Nonnull Map<MethodSignature,GraphBasedCallGraph.Vertex> signatureToVertex)
public void addMethod(@Nonnull MethodSignature calledMethod)
MutableCallGraphaddMethod in interface MutableCallGraphcalledMethod - the method that will be added to the call graph.protected void addMethod(@Nonnull MethodSignature calledMethod, GraphBasedCallGraph.Vertex vertex)
public void addCall(@Nonnull MethodSignature sourceMethod, @Nonnull MethodSignature targetMethod)
MutableCallGraphaddCall in interface MutableCallGraphsourceMethod - this parameter defines the source node of the edge in the call graph.targetMethod - this paramter defines the target node of the edge in the call graph.protected void addCall(@Nonnull MethodSignature sourceMethod, @Nonnull MethodSignature targetMethod, GraphBasedCallGraph.Edge edge)
@Nonnull public Set<MethodSignature> getMethodSignatures()
CallGraphgetMethodSignatures in interface CallGraph@Nonnull public Set<MethodSignature> callsFrom(@Nonnull MethodSignature sourceMethod)
CallGraph@Nonnull public Set<MethodSignature> callsTo(@Nonnull MethodSignature targetMethod)
CallGraphpublic boolean containsMethod(@Nonnull MethodSignature method)
CallGraphcontainsMethod in interface CallGraphmethod - the method signature of the requested nodepublic boolean containsCall(@Nonnull MethodSignature sourceMethod, @Nonnull MethodSignature targetMethod)
CallGraphcontainsCall in interface CallGraphsourceMethod - it defines the source node in the call graphtargetMethod - it defines the target node in the call graphpublic int callCount()
CallGraphpublic String exportAsDot()
CallGraphexportAsDot in interface CallGraph@Nonnull public MutableCallGraph copy()
CallGraph@Nonnull protected GraphBasedCallGraph.Vertex vertexOf(@Nonnull MethodSignature method)
method - the method signature searched in the call graph@Nonnull protected org.jgrapht.graph.DefaultDirectedGraph<GraphBasedCallGraph.Vertex,GraphBasedCallGraph.Edge> getGraph()
@Nonnull protected Map<MethodSignature,GraphBasedCallGraph.Vertex> getSignatureToVertex()
@Nonnull protected MethodSignature vertex2MethodSignature(@Nonnull GraphBasedCallGraph.Vertex vertex)
public String toString()
Copyright © 2024 Soot OSS. All rights reserved.