Class FunctionComparisonModel
function comparison
objects that describe how functions may be compared. Each comparison object
is a mapping of a function (source) to a list of functions (targets).
This model is intended to be used by the FunctionComparisonProvider
as the basis for its display. It should never be created manually, and should
only be accessed via the FunctionComparisonService
.
Note: Subscribers may register to be informed of changes to this model via the
comparison model listener
interface.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addComparison
(ghidra.app.plugin.core.functioncompare.FunctionComparison comparison) Adds a single comparison to the modelvoid
addFunctionComparisonModelListener
(ghidra.app.plugin.core.functioncompare.FunctionComparisonModelListener listener) Adds the given subscriber to the list of those to be notified of model changesvoid
compareFunctions
(Function source, Function target) Compares two functions.void
compareFunctions
(Set<Function> functions) Updates the model with a set of functions to compare.void
compareFunctions
(Set<Function> sourceFunctions, Set<Function> destinationFunctions) Updates the model with two sets of functions to compare.List<ghidra.app.plugin.core.functioncompare.FunctionComparison>
Returns a list of all comparisons in the model, in sorted order by source function nameReturns all source functions in the modelReturns all target functions in the modelgetTargetFunctions
(Function source) Returns a set of all target functions for a given sourcegetTargets
(Function source) Returns a list of all targets in the model (across all comparisons) for a given source functionvoid
removeFunction
(Function function) Removes the given function from all comparisons in the model, whether stored as a source or targetvoid
removeFunctions
(Program program) Removes all functions in the model that come from the given programvoid
removeFunctions
(Collection<Function> functions) Removes all the given functions from all comparisons in the modelvoid
setComparisons
(List<ghidra.app.plugin.core.functioncompare.FunctionComparison> comparisons) Replaces the current model with the comparisons provided
-
Constructor Details
-
FunctionComparisonModel
public FunctionComparisonModel()
-
-
Method Details
-
addFunctionComparisonModelListener
public void addFunctionComparisonModelListener(ghidra.app.plugin.core.functioncompare.FunctionComparisonModelListener listener) Adds the given subscriber to the list of those to be notified of model changes- Parameters:
listener
- the model change subscriber
-
getComparisons
Returns a list of all comparisons in the model, in sorted order by source function name- Returns:
- a list of all comparisons in the model
-
setComparisons
public void setComparisons(List<ghidra.app.plugin.core.functioncompare.FunctionComparison> comparisons) Replaces the current model with the comparisons provided- Parameters:
comparisons
- the new comparison model
-
addComparison
public void addComparison(ghidra.app.plugin.core.functioncompare.FunctionComparison comparison) Adds a single comparison to the model- Parameters:
comparison
- the comparison to add
-
getTargets
Returns a list of all targets in the model (across all comparisons) for a given source function- Parameters:
source
- the source function- Returns:
- list of associated target functions
-
compareFunctions
Updates the model with a set of functions to compare. This will add the functions to any existingcomparisons
in the model and create new comparisons for functions not represented.Note: It is assumed that when using this method, all functions can be compared with all other functions; meaning each function will be added as both a source AND a target. To specify a specific source/target relationship, use
compareFunctions(Function, Function)
.- Parameters:
functions
- the set of functions to compare
-
compareFunctions
Updates the model with two sets of functions to compare. This will add the functions to any existingcomparisons
in the model and create new comparisons for functions not represented.Note: It is assumed that when using this method, all source functions can be compared to all destination functions; meaning all functions in the source function set will be added as sources, and all functions in the destination function set will be added as targets.
- Parameters:
sourceFunctions
-destinationFunctions
-
-
compareFunctions
Compares two functions. If a comparison already exists in the model for the given source, the target will simply be added to it; otherwise a new comparison will be created.- Parameters:
source
- the source functiontarget
- the target function
-
removeFunction
Removes the given function from all comparisons in the model, whether stored as a source or target- Parameters:
function
- the function to remove
-
removeFunctions
Removes all the given functions from all comparisons in the model- Parameters:
functions
- the functions to remove
-
removeFunctions
Removes all functions in the model that come from the given program- Parameters:
program
- the program to remove functions from
-
getSourceFunctions
Returns all source functions in the model- Returns:
- a set of all source functions
-
getTargetFunctions
Returns all target functions in the model- Returns:
- a set of all target functions
-
getTargetFunctions
Returns a set of all target functions for a given source- Parameters:
source
- the source function to search for- Returns:
- the set of associated target functions
-