Interface FunctionComparisonModel

All Known Implementing Classes:
AbstractFunctionComparisonModel, AnyToAnyFunctionComparisonModel, MatchedFunctionComparisonModel

public interface FunctionComparisonModel
A model for comparing one or more functions in a side by side display. The model supports the concept of a set of function that can be selected for each side of the comparison. It also maintains the selected function for each side. The default model simply has a single set of functions that can be selected for either side of the comparison. The model supports the concept of different sets of functions for each and even the idea the the active function for one side can determine the set of functions for the other side. See MatchedFunctionComparisonModel.

This model is intended to be used by the the FunctionComparisonService to generate a function comparison display window.

Note: Subscribers may register to be informed of changes to this model via the comparison model listener interface.

  • Method Details

    • addFunctionComparisonModelListener

      void addFunctionComparisonModelListener(FunctionComparisonModelListener listener)
      Adds the given listener to the list of those to be notified of model changes.
      Parameters:
      listener - the listener to add
    • removeFunctionComparisonModelListener

      void removeFunctionComparisonModelListener(FunctionComparisonModelListener listener)
      Removes the given listener from the list of those to be notified of model changes.
      Parameters:
      listener - the listener to remove
    • setActiveFunction

      boolean setActiveFunction(Duo.Side side, Function function)
      Sets the function for the given side. The function must be one of the functions from that side's set of functions
      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
    • getActiveFunction

      Function getActiveFunction(Duo.Side side)
      Returns the active (selected) function for the given side.
      Parameters:
      side - the side to get the active function for
      Returns:
      the active function for the given side
    • getFunctions

      List<Function> getFunctions(Duo.Side side)
      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
    • removeFunction

      void removeFunction(Function function)
      Removes the given function from both sides of the comparison.
      Parameters:
      function - the function to remove
    • removeFunctions

      void removeFunctions(Collection<Function> functions)
      Removes all the given functions from both sides of the comparison.
      Parameters:
      functions - the functions to remove
    • removeFunctions

      void removeFunctions(Program program)
      Removes all functions from the given program from both sides of the comparison
      Parameters:
      program - that program whose functions should be removed from this model
    • isEmpty

      boolean isEmpty()
      Returns true if the model has no function to compare.
      Returns:
      true if the model has no functions to compare