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 Summary
Modifier and TypeMethodDescriptionvoid
Adds the given listener to the list of those to be notified of model changes.getActiveFunction
(Duo.Side side) Returns the active (selected) function for the given side.getFunctions
(Duo.Side side) Returns the list of all functions on the given side that could be made active.boolean
isEmpty()
Returns true if the model has no function to compare.void
removeFunction
(Function function) Removes the given function from both sides of the comparison.void
Removes the given listener from the list of those to be notified of model changes.void
removeFunctions
(Program program) Removes all functions from the given program from both sides of the comparisonvoid
removeFunctions
(Collection<Function> functions) Removes all the given functions from both sides of the comparison.boolean
setActiveFunction
(Duo.Side side, Function function) Sets the function for the given side.
-
Method Details
-
addFunctionComparisonModelListener
Adds the given listener to the list of those to be notified of model changes.- Parameters:
listener
- the listener to add
-
removeFunctionComparisonModelListener
Removes the given listener from the list of those to be notified of model changes.- Parameters:
listener
- the listener to remove
-
setActiveFunction
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 forfunction
- 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
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
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
Removes the given function from both sides of the comparison.- Parameters:
function
- the function to remove
-
removeFunctions
Removes all the given functions from both sides of the comparison.- Parameters:
functions
- the functions to remove
-
removeFunctions
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
-