|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Observable | +--mil.af.afit.router.WindList
This maintains a list of winds and allows interested objects to listen
for changes by implementing the Observer
interface.
Wind
,
Observer
, Serialized FormConstructor 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 Observer s of the change. |
void |
addWinds(Wind[] moreWinds)
Adds the array of winds to the end of the wind list and notifies registered Observer s 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 Observer s
of the change |
void |
removeWindAt(int index)
Removes a wind at a particular index and notifies registered Observer s of the change. |
void |
removeWindsAt(int[] indeces)
Removes winds at the specified indeces and notifies registered Observer s 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 |
public WindList()
Method Detail |
public final void addWinds(Wind[] moreWinds)
Observer
s of the change.moreWinds
- array of winds to add to listWind
,
Observer
public final void addWind(Wind wind)
Observer
s of the change.wind
- wind to add to listWind
,
Observer
public final void removeWindAt(int index)
Observer
s of the change.index
- index of wind to removeWind
,
Observer
public final void removeWind(Wind wind)
wind == winds[i]
for
each wind in the list and notifies registered Observer
s
of the changewind
- wind to removeWind
,
Observer
public final void removeWindsAt(int[] indeces)
Observer
s of the change.wind
- wind to removeWind
,
Observer
public final Wind[] getWinds()
public java.lang.String toString()
toString
in class java.lang.Object
public final void update(java.util.Observable thing, java.lang.Object arg)
Observable
registers a change. The
list registers with winds. The list then notifies its own
registered Observer
s of the change.update
in interface java.util.Observer
thing
- thing that was updatedarg
- argument passed by thingObservable
,
Observer
public final void replace(WindList newList)
newList
. This is used
when loading a new Kernel
. Observer
s
registered with the original list will still be registered, but
anything registered with newList
will not still
be registered.newList
- the new wind list to use
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |