|
|||||||
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.VehicleList
This maintains a list of Vehicles and allows interested objects to listen
for changes by implementing the Observer
interface.
Vehicle
,
Observer
, Serialized FormConstructor Summary | |
VehicleList()
Constructs an empty Vehicle list |
Method Summary | |
void |
addVehicle(Vehicle vehicle)
Adds a single Vehicle to the end of the Vehicle list and notifies registered Observer s of the change. |
void |
addVehicles(Vehicle[] moreVehicles)
Adds the array of Vehicles to the end of the Vehicle list and notifies registered Observer s of the change. |
int |
countEnabledVehicles()
Returns the number of enabled vehicles in list. |
Vehicle[] |
getVehicles()
Returns an array of the Vehicles in the list. |
void |
initializeAfterDeserialization(Kernel kernel)
After deserialization, reconnect links. |
void |
removeVehicle(Vehicle vehicle)
Removes a Vehicle by checking Vehicle == Vehicles[i] for
each Vehicle in the list and notifies registered Observer s
of the change |
void |
removeVehicleAt(int index)
Removes a Vehicle at a particular index and notifies registered Observer s of the change. |
void |
removeVehiclesAt(int[] indeces)
Removes Vehicles at the specified indeces and notifies registered Observer s of the change. |
void |
replace(VehicleList newList,
BaseList baseList)
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 VehicleList()
Method Detail |
public final void addVehicles(Vehicle[] moreVehicles)
Observer
s of the change.moreVehicles
- array of Vehicles to add to listVehicle
,
Observer
public final void addVehicle(Vehicle vehicle)
Observer
s of the change.Vehicle
- Vehicle to add to listVehicle
,
Observer
public final void removeVehicleAt(int index)
Observer
s of the change.index
- index of Vehicle to removeVehicle
,
Observer
public final void removeVehicle(Vehicle vehicle)
Vehicle == Vehicles[i]
for
each Vehicle in the list and notifies registered Observer
s
of the changeVehicle
- Vehicle to removeVehicle
,
Observer
public final void removeVehiclesAt(int[] indeces)
Observer
s of the change.Vehicle
- Vehicle to removeVehicle
,
Observer
public final Vehicle[] getVehicles()
public final void initializeAfterDeserialization(Kernel kernel)
kernel
- kernel being usedpublic 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 bases. 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 int countEnabledVehicles()
public final void replace(VehicleList newList, BaseList baseList)
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 vehicle list to use
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |