|
|||||||
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.PriorityModelList
This maintains a list of priority models and allows interested objects to listen
for changes by implementing the Observer
interface.
PriorityModel
,
Observer
, Serialized FormConstructor Summary | |
PriorityModelList()
Constructs an empty priority model list |
Method Summary | |
void |
addPriorityModel(PriorityModel priorityModel)
Adds a single priorityModel to the end of the priorityModel list and notifies registered Observer s of the change. |
void |
addPriorityModels(PriorityModel[] morePriorityModels)
Adds the array of models to the end of the list and notifies registered Observer s of the change. |
PriorityModel[] |
getPriorityModels()
Returns an array of the priorityModels in the list. |
void |
initializeAfterDeserialization(Kernel kernel)
Register as observer after deserialization. |
void |
makeStandardModels(Kernel kernel)
Makes the standard models which includes three models: Infinite relative worths (not editable) Relative worths of 5 to 1 (not editable) Customizable relative worths with a default of 10 |
void |
removePriorityModel(PriorityModel priorityModel)
Removes a priorityModel by checking priorityModel == priorityModels[i] for
each priorityModel in the list and notifies registered Observer s
of the change |
void |
removePriorityModelAt(int index)
Removes a priorityModel at a particular index and notifies registered Observer s of the change. |
void |
removePriorityModelsAt(int[] indeces)
Removes priorityModels at the specified indeces and notifies registered Observer s of the change. |
void |
replace(PriorityModelList newList)
Replaces this list with newList . |
java.lang.String |
toString()
Returns "Number of priorityModels: " + priorityModels.length; |
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 PriorityModelList()
Method Detail |
public final void makeStandardModels(Kernel kernel)
kernel
- kernel being usedpublic final void addPriorityModels(PriorityModel[] morePriorityModels)
Observer
s of the change.morePriorityModels
- array of models to add to listPriorityModel
,
Observer
public final void addPriorityModel(PriorityModel priorityModel)
Observer
s of the change.priorityModel
- priorityModel to add to listPriorityModel
,
Observer
public final void removePriorityModelAt(int index)
Observer
s of the change.index
- index of priorityModel to removePriorityModel
,
Observer
public final void removePriorityModel(PriorityModel priorityModel)
priorityModel == priorityModels[i]
for
each priorityModel in the list and notifies registered Observer
s
of the changepriorityModel
- priorityModel to removePriorityModel
,
Observer
public final void removePriorityModelsAt(int[] indeces)
Observer
s of the change.priorityModel
- priorityModel to removePriorityModel
,
Observer
public final PriorityModel[] getPriorityModels()
public java.lang.String toString()
"Number of priorityModels: " + priorityModels.length;
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 priorityModels. 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 initializeAfterDeserialization(Kernel kernel)
kernel
- kernel being usedpublic final void replace(PriorityModelList 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 priorityModel list to use
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |