Package ghidra.app.services

# Interface FunctionComparisonService

public interface FunctionComparisonService
Allows users to create comparisons between functions which will be displayed side-by-side in a `FunctionComparisonProvider`. Each side in the display will allow the user to select one or more functions

Concurrent usage: All work performed by this service will be done on the Swing thread. Further, all calls that do not return a value will be run immediately if the caller is on the Swing thread; otherwise, the work will be done on the Swing thread at a later time. Contrastingly, any method on this interface that returns a value will be run immediately, regardless of whether the call is on the Swing thread. Thus, the methods that return a value will always be blocking calls; methods that do not return a value may or may not block, depending on the client's thread.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider`
  `compareFunctions(Function source, Function target)`
  Creates a comparison between two functions, where the source function will be shown on the left side of the comparison dialog and the target on the right.
  `void`
  `compareFunctions(Function source, Function target, ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider provider)`
  Creates a comparison between two functions and adds it to a given comparison provider.
  `ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider`
  `compareFunctions(Set<Function> functions)`
  Creates a comparison between a set of functions, where each function in the list can be compared against any other.
  `void`
  `compareFunctions(Set<Function> functions, ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider provider)`
  Creates a comparison between a set of functions, adding them to the given comparison provider.
  `ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider`
  `createFunctionComparisonProvider()`
  Creates a comparison provider that allows comparisons between a functions.
  `void`
  `removeFunction(Function function)`
  Removes a given function from all comparisons across all comparison providers
  `void`
  `removeFunction(Function function, ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider provider)`
  Removes a given function from all comparisons in the given comparison provider only

- ## Method Details

  - ### createFunctionComparisonProvider

    ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider createFunctionComparisonProvider()
    Creates a comparison provider that allows comparisons between a functions.
    Returns:
      the new comparison provider

  - ### compareFunctions

    ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider compareFunctions(Set<Function> functions)
    Creates a comparison between a set of functions, where each function in the list can be compared against any other.

    eg: Given a set of 3 functions (f1, f2, f3), the comparison dialog will allow the user to display either f1, f2 or f3 on EITHER side of the comparison.

    Note that this method will always create a new provider; if you want to add functions to an existing comparison, use `this` variant that takes a provider.

    Parameters:
      `functions` - the functions to compare
    Returns:
      the new comparison provider

  - ### compareFunctions

    ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider compareFunctions(Function source, Function target)
    Creates a comparison between two functions, where the source function will be shown on the left side of the comparison dialog and the target on the right.

    Note that this will always create a new provider; if you want to add functions to an existing comparison, use `this` variant that takes a provider.

    Parameters:
      `source` - a function in the comparison
      `target` - a function in the comparison
    Returns:
      the new comparison provider

  - ### compareFunctions

    void compareFunctions(Set<Function> functions, ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider provider)
    Creates a comparison between a set of functions, adding them to the given comparison provider. Each function in the given set will be added to both sides of the comparison, allowing users to compare any functions in the existing provider with the new set.
    Parameters:
      `functions` - the functions to compare
      `provider` - the provider to add the comparisons to
    See Also:
      - `compareFunctions(Set)`

  - ### compareFunctions

    void compareFunctions(Function source, Function target, ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider provider)
    Creates a comparison between two functions and adds it to a given comparison provider. The existing comparisons in the provider will not be affected, unless the provider already contains a comparison with the same source function; in this case the given target will be added to that comparisons' list of targets.
    Parameters:
      `source` - a function in the comparison
      `target` - a function in the comparison
      `provider` - the provider to add the comparison to
    See Also:
      - `compareFunctions(Function, Function)`

  - ### removeFunction

    void removeFunction(Function function)
    Removes a given function from all comparisons across all comparison providers
    Parameters:
      `function` - the function to remove

  - ### removeFunction

    void removeFunction(Function function, ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider provider)
    Removes a given function from all comparisons in the given comparison provider only
    Parameters:
      `function` - the function to remove
      `provider` - the comparison provider to remove functions from