Interface FunctionComparisonService


public interface FunctionComparisonService
Service interface to create comparisons between functions which will be displayed side-by-side in a function comparison window. 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 asynchronously on the Swing thread.

  • Method Details

    • createComparison

      void createComparison(Collection<Function> functions)
      Creates a function comparison window where each side can display any of the given functions.
      Parameters:
      functions - the functions to compare
    • createComparison

      void createComparison(Function left, Function right)
      Creates a function comparison window for the two given functions. Each side can select either function, but initially the left function will be shown in the left panel and the right function will be shown in the right panel.
      Parameters:
      left - the function to initially show in the left panel
      right - the function to initially show in the right panel
    • addToComparison

      void addToComparison(Function function)
      Adds the given function to each side the last created comparison window or creates a new comparison if none exists. The right panel will be changed to show the new function. Note that this method will not add to any provider created via the createCustomComparison(FunctionComparisonModel, Callback). Those providers are private to the client that created them. They take in a model, so if the client wants to add to those providers, it must retain a handle to the model and add functions directly to the model.
      Parameters:
      function - the function to be added to the last function comparison window
    • addToComparison

      void addToComparison(Collection<Function> functions)
      Adds the given functions to each side the last created comparison window or creates a new comparison if none exists. The right panel will be change to show a random function from the new functions. Note that this method will not add to any comparison windows created with a custom comparison model.
      Parameters:
      functions - the functions to be added to the last function comparison window
    • createCustomComparison

      void createCustomComparison(FunctionComparisonModel model, Callback closeListener)
      Creates a custom function comparison window. The default model shows all functions on both sides. This method allows the client to provide a custom comparison model which can have more control over what functions can be selected on each side. One such custom model is the MatchedFunctionComparisonModel which gives a unique set of functions on the right side, depending on what is selected on the left side.

      Note that function comparison windows created with this method are considered private for the client and are not available to be chosen for either of the above "add to" service methods. Instead, the client that uses this model can retain a handle to the model and add or remove functions directly on the model.

      Parameters:
      model - the custom function comparison model
      closeListener - an optional callback if the client wants to be notified when the associated function comparison windows is closed.