mil.af.afit.router
Class SolutionList

java.lang.Object
  |
  +--java.util.Observable
        |
        +--mil.af.afit.router.SolutionList

public class SolutionList
extends java.util.Observable

This maintains a list of solutions and allows interested objects to listen for changes by implementing the Observer interface.

Since:
1.0
See Also:
Solution, Observer

Constructor Summary
SolutionList()
          Constructs an empty solution list
 
Method Summary
 void addSolution(Solution solution)
          Adds a single solution to the end of the solution list and notifies registered Observers of the change.
 void addSolutions(Solution[] moreSolutions)
          Adds the array of solutions to the end of the solution list and notifies registered Observers of the change.
 void clear()
          Empties list.
 Solution[] getSolutions()
          Returns an array of the solutions in the list.
 void removeSolution(Solution solution)
          Removes a solution by checking solution == solutions[i] for each solution in the list and notifies registered Observers of the change
 void removeSolutionAt(int index)
          Removes a solution at a particular index and notifies registered Observers of the change.
 void removeSolutionsAt(int[] indeces)
          Removes solutions at the specified indeces and notifies registered Observers of the change.
 java.lang.String toString()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SolutionList

public SolutionList()
Constructs an empty solution list
Since:
1.0
Method Detail

addSolutions

public final void addSolutions(Solution[] moreSolutions)
Adds the array of solutions to the end of the solution list and notifies registered Observers of the change.
Parameters:
moresolutions - array of solutions to add to list
See Also:
Solution, Observer

addSolution

public final void addSolution(Solution solution)
Adds a single solution to the end of the solution list and notifies registered Observers of the change.
Parameters:
solution - solution to add to list
See Also:
Solution, Observer

removeSolutionAt

public final void removeSolutionAt(int index)
Removes a solution at a particular index and notifies registered Observers of the change.
Parameters:
index - index of solution to remove
See Also:
Solution, Observer

removeSolution

public final void removeSolution(Solution solution)
Removes a solution by checking solution == solutions[i] for each solution in the list and notifies registered Observers of the change
Parameters:
solution - solution to remove
See Also:
Solution, Observer

removeSolutionsAt

public final void removeSolutionsAt(int[] indeces)
Removes solutions at the specified indeces and notifies registered Observers of the change.
Parameters:
solution - solution to remove
See Also:
Solution, Observer

getSolutions

public final Solution[] getSolutions()
Returns an array of the solutions in the list.
Returns:
array of solutions in the list
Since:
1.0

clear

public final void clear()
Empties list.
Since:
1.0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object