Package ghidra.features.base.codecompare.model

# Class MatchedFunctionComparisonModel

java.lang.Object
ghidra.features.base.codecompare.model.AbstractFunctionComparisonModel
ghidra.features.base.codecompare.model.MatchedFunctionComparisonModel

All Implemented Interfaces:
  `FunctionComparisonModel`

public class MatchedFunctionComparisonModel extends AbstractFunctionComparisonModel
A FunctionComparisonModel comprised of matched pairs of source and target functions. Each source function has its own set of target functions that it can be compared with.

- ## Field Summary

  ### Fields inherited from class ghidra.features.base.codecompare.model.AbstractFunctionComparisonModel

  `activeFunctions, FUNCTION_COMPARATOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MatchedFunctionComparisonModel()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addMatch(Function sourceFunction, Function targetFunction)`
  Adds a new comparison to the model.
  `protected boolean`
  `containsFunction(Duo.Side side, Function function)`
  `List<Function>`
  `getFunctions(Duo.Side side)`
  Returns the list of all functions on the given side that could be made active.
  `List<Function>`
  `getSourceFunctions()`
  `boolean`
  `isEmpty()`
  Returns true if the model has no function to compare.
  `void`
  `removeFunction(Function function)`
  Removes the given function from all comparisons in the model, whether stored as a source or target
  `void`
  `removeFunctions(Program program)`
  Removes all functions in the model that come from the given program
  `void`
  `removeFunctions(Collection<Function> functions)`
  Removes all the given functions from all comparisons in the model
  `boolean`
  `setActiveFunction(Duo.Side side, Function function)`
  Sets the function for the given side.

  ### Methods inherited from class ghidra.features.base.codecompare.model.AbstractFunctionComparisonModel

  `addFunctionComparisonModelListener, fireModelDataChanged, getActiveFunction, removeFunctionComparisonModelListener`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### MatchedFunctionComparisonModel

    public MatchedFunctionComparisonModel()

- ## Method Details

  - ### removeFunction

    public void removeFunction(Function function)
    Removes the given function from all comparisons in the model, whether stored as a source or target
    Parameters:
      `function` - the function to remove

  - ### removeFunctions

    public void removeFunctions(Collection<Function> functions)
    Removes all the given functions from all comparisons in the model
    Parameters:
      `functions` - the functions to remove

  - ### removeFunctions

    public void removeFunctions(Program program)
    Removes all functions in the model that come from the given program
    Parameters:
      `program` - the program to remove functions from

  - ### getFunctions

    public List<Function> getFunctions(Duo.Side side)
    Description copied from interface: `FunctionComparisonModel`
    Returns the list of all functions on the given side that could be made active.
    Parameters:
      `side` - the side to get functions for
    Returns:
      the list of all functions on the given side that could be made active

  - ### setActiveFunction

    public boolean setActiveFunction(Duo.Side side, Function function)
    Description copied from interface: `FunctionComparisonModel`
    Sets the function for the given side. The function must be one of the functions from that side's set of functions
    Specified by:
      `setActiveFunction` in interface `FunctionComparisonModel`
    Overrides:
      `setActiveFunction` in class `AbstractFunctionComparisonModel`
    Parameters:
      `side` - the side to set the function for
      `function` - the function so set for the given side
    Returns:
      true if the function was made active or false if the function does not exist for the given side

  - ### getSourceFunctions

    public List<Function> getSourceFunctions()

  - ### isEmpty

    public boolean isEmpty()
    Description copied from interface: `FunctionComparisonModel`
    Returns true if the model has no function to compare.
    Returns:
      true if the model has no functions to compare

  - ### addMatch

    public void addMatch(Function sourceFunction, Function targetFunction)
    Adds a new comparison to the model. If the sourceFunction already exists on the left side, then the target function will be added to that specific function's right side functions. Otherwise, the source function will be added to the left side the given target as its only right side function.
    Parameters:
      `sourceFunction` - the left side function to add
      `targetFunction` - the right side function to add for that source function

  - ### containsFunction

    protected boolean containsFunction(Duo.Side side, Function function)
    Specified by:
      `containsFunction` in class `AbstractFunctionComparisonModel`