mil.af.afit.router
Class WindList

java.lang.Object
  |
  +--java.util.Observable
        |
        +--mil.af.afit.router.WindList
All Implemented Interfaces:
java.util.Observer, java.io.Serializable

public class WindList
extends java.util.Observable
implements java.util.Observer, java.io.Serializable

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

Since:
1.0
See Also:
Wind, Observer, Serialized Form

Constructor Summary
WindList()
          Constructs a wind list with a single wind.
 
Method Summary
 void addWind(Wind wind)
          Adds a single wind to the end of the wind list and notifies registered Observers of the change.
 void addWinds(Wind[] moreWinds)
          Adds the array of winds to the end of the wind list and notifies registered Observers of the change.
 Wind[] getWinds()
          Returns an array of the winds in the list.
 void removeWind(Wind wind)
          Removes a wind by checking wind == winds[i] for each wind in the list and notifies registered Observers of the change
 void removeWindAt(int index)
          Removes a wind at a particular index and notifies registered Observers of the change.
 void removeWindsAt(int[] indeces)
          Removes winds at the specified indeces and notifies registered Observers of the change.
 void replace(WindList newList)
          Replaces this list with newList.
 java.lang.String toString()
           
 void update(java.util.Observable thing, java.lang.Object arg)
          Called when an Observable registers a change.
 
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

WindList

public WindList()
Constructs a wind list with a single wind.
Since:
1.0
Method Detail

addWinds

public final void addWinds(Wind[] moreWinds)
Adds the array of winds to the end of the wind list and notifies registered Observers of the change.
Parameters:
moreWinds - array of winds to add to list
See Also:
Wind, Observer

addWind

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

removeWindAt

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

removeWind

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

removeWindsAt

public final void removeWindsAt(int[] indeces)
Removes winds at the specified indeces and notifies registered Observers of the change.
Parameters:
wind - wind to remove
See Also:
Wind, Observer

getWinds

public final Wind[] getWinds()
Returns an array of the winds in the list.
Returns:
array of winds in the list
Since:
1.0

toString

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

update

public final void update(java.util.Observable thing,
                         java.lang.Object arg)
Called when an Observable registers a change. The list registers with winds. The list then notifies its own registered Observers of the change.
Specified by:
update in interface java.util.Observer
Parameters:
thing - thing that was updated
arg - argument passed by thing
Since:
1.0
See Also:
Observable, Observer

replace

public final void replace(WindList newList)
Replaces this list with newList. This is used when loading a new Kernel. Observers registered with the original list will still be registered, but anything registered with newList will not still be registered.
Parameters:
newList - the new wind list to use
Since:
1.0