Package sootup.callgraph
Class LabeledGraphBasedCallGraph<L>
java.lang.Object
sootup.callgraph.GraphBasedCallGraph
sootup.callgraph.LabeledGraphBasedCallGraph<L>
- Type Parameters:
L- the type of the labels attached to the calls
- All Implemented Interfaces:
CallGraph,LabeledCallGraph<L>,MutableCallGraph,MutableLabeledCallGraph<L>
public class LabeledGraphBasedCallGraph<L>
extends GraphBasedCallGraph
implements MutableLabeledCallGraph<L>
This class implements a mutable call graph as a graph whose calls can carry labels of type
L. The labels of a call keep their insertion order.
Call graph algorithms create a plain GraphBasedCallGraph. Use of(CallGraph)
to label their result, or override AbstractCallGraphAlgorithm.initializeCallGraph(List, List) to return a labeled call graph that is filled during the construction.
GraphBasedCallGraph.diff(CallGraph) compares the calls only and ignores labels.
-
Nested Class Summary
Nested classes/interfaces inherited from interface sootup.callgraph.CallGraph
CallGraph.Call -
Constructor Summary
ConstructorsModifierConstructorDescriptionLabeledGraphBasedCallGraph(@NonNull List<MethodSignature> entryMethods) The constructor of the labeled graph based call graph. it initializes an empty call graph.protectedLabeledGraphBasedCallGraph(@NonNull GraphBasedCallGraph callGraph, @NonNull com.google.common.collect.SetMultimap<CallGraph.Call, L> labels) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLabel(@NonNull CallGraph.Call call, @NonNull L label) This method attaches a label to a call in the call graph.@NonNull LabeledGraphBasedCallGraph<L>copy()This method copies a call graph.getLabels(@NonNull CallGraph.Call call) This method returns all labels attached to a call in the call graph.static <L> @NonNull LabeledGraphBasedCallGraph<L>Creates a labeled copy of the given call graph.protected StringThis returns the string that is used in the toString Method to define the called methodsprotected StringThis returns the string that is used in the toString Method to define the methods that call a specific methodprotected StringprintLabels(CallGraph.Call call) This returns the string that is used in the toString Method to print the labels of a callbooleanremoveLabel(@NonNull CallGraph.Call call, @NonNull L label) This method removes a label from a call in the call graph.Methods inherited from class sootup.callgraph.GraphBasedCallGraph
addCall, addCall, addMethod, callCount, callsFrom, callSourcesTo, callsTo, callTargetsFrom, containsCall, containsCall, containsMethod, diff, edgeOf, getCalls, getEntryMethods, getMethodSignatures, sortedCallsFrom, toString, vertexOfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface sootup.callgraph.CallGraph
callCount, callsFrom, callSourcesTo, callsTo, callTargetsFrom, containsCall, containsCall, containsMethod, diff, exportAsDot, exportAsDot, getCalls, getEntryMethods, getMethodSignatures, sortedCallsFromMethods inherited from interface sootup.callgraph.LabeledCallGraph
callsFrom, callsTo, hasLabel, toDotEdgeMethods inherited from interface sootup.callgraph.MutableCallGraph
addCall, addCall, addMethodMethods inherited from interface sootup.callgraph.MutableLabeledCallGraph
addCall
-
Constructor Details
-
LabeledGraphBasedCallGraph
The constructor of the labeled graph based call graph. it initializes an empty call graph.- Parameters:
entryMethods- the entry methods of the call graph
-
LabeledGraphBasedCallGraph
protected LabeledGraphBasedCallGraph(@NonNull GraphBasedCallGraph callGraph, @NonNull com.google.common.collect.SetMultimap<CallGraph.Call, L> labels)
-
-
Method Details
-
of
Creates a labeled copy of the given call graph. The given call graph is not modified. If it is aLabeledCallGraphits labels are copied as well; they must be of typeL.- Type Parameters:
L- the type of the labels attached to the calls- Parameters:
callGraph- the call graph whose methods and calls are copied- Returns:
- a labeled call graph containing the methods and calls of the given call graph
-
addLabel
Description copied from interface:MutableLabeledCallGraphThis method attaches a label to a call in the call graph. A call can carry several labels. A label that is already attached to the call is not added a second time.- Specified by:
addLabelin interfaceMutableLabeledCallGraph<L>- Parameters:
call- the call the label is attached to. It must be contained in the call graph.label- the label that will be attached to the call
-
removeLabel
Description copied from interface:MutableLabeledCallGraphThis method removes a label from a call in the call graph.- Specified by:
removeLabelin interfaceMutableLabeledCallGraph<L>- Parameters:
call- the call the label is removed fromlabel- the label that will be removed- Returns:
- true if the label was attached to the call, otherwise false
-
getLabels
Description copied from interface:LabeledCallGraphThis method returns all labels attached to a call in the call graph.- Specified by:
getLabelsin interfaceLabeledCallGraph<L>- Parameters:
call- the requested call in the call graph- Returns:
- an unmodifiable set of the labels of the call. It is empty if the call has no labels or is not contained in the call graph.
-
copy
Description copied from interface:CallGraphThis method copies a call graph.- Specified by:
copyin interfaceCallGraph- Specified by:
copyin interfaceLabeledCallGraph<L>- Overrides:
copyin classGraphBasedCallGraph- Returns:
- it returns a copied call graph.
-
printCallingMethods
Description copied from class:GraphBasedCallGraphThis returns the string that is used in the toString Method to define the methods that call a specific method- Overrides:
printCallingMethodsin classGraphBasedCallGraph- Parameters:
call- The data of the call- Returns:
- The returned String will be used in the toString method to define the methods that call a specific method
-
printCalledMethods
Description copied from class:GraphBasedCallGraphThis returns the string that is used in the toString Method to define the called methods- Overrides:
printCalledMethodsin classGraphBasedCallGraph- Parameters:
call- The data of the call- Returns:
- The returned String will be used in the toString method to define the called methods
-
printLabels
This returns the string that is used in the toString Method to print the labels of a call- Parameters:
call- The data of the call- Returns:
- the labels of the call prefixed by a space, or an empty string if the call has no labels
-