|
|||||||
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.PriorityModel
This records how a user wishes to treat priorities. For example
a user may never want to trade even 100 priority 2 sites for a priority 1 site,
or maybe five priority 2 sites are worth one priority 1 site. Whatever the case,
PriorityModel
tracks the relative worth of the priorities
specified by the sites in the kernel's site list.
Site
,
SiteList
,
PriorityModelList
, Serialized FormField Summary | |
static int |
NEAR_INF
A relative worth equal to or greater than this number is considered infinity. |
Constructor Summary | |
PriorityModel(PriorityModel shellFromThis)
Constructs a shell of a priority model from the passed priority model. |
|
PriorityModel(java.lang.String name,
Kernel kernel)
Constructs a priority model with a default relative worth of infinity. |
|
PriorityModel(java.lang.String name,
Kernel kernel,
int defaultRelativeWorth,
boolean isEditable)
Constructs a priority model with the specifie default relative worth and editable state. |
Method Summary | |
int[] |
getAllRelativeWorths()
Returns all of relative worths. |
int |
getDefaultRelativeWorth()
Returns the default relative worth. |
java.lang.String |
getName()
Returns the name of the model. |
int[] |
getPriorities()
Returns an array of priorities currently in the site list |
int |
getRelativeWorthAt(int index)
Returns a specific relative worth. |
int[] |
getRelativeWorths()
Returns an array of relative worths. |
void |
initializeAfterDeserialization(Kernel kernel)
Registers with the kernel and updates self based on the site list. |
static int |
intValue(java.lang.String s)
Converts a string relative worth to an int value. |
boolean |
isEditable()
Returns whether or not this model is marked as editable. |
boolean |
isEnabled()
Whether or not the model is marked as enabled. |
PriorityModel |
makeShell()
Returns a shell of this model. |
void |
setEnabled(boolean state)
Sets whether or not the model is enabled. |
void |
setIsEditable(boolean state)
Sets whether or not this model is marked as editable. |
void |
setName(java.lang.String name)
Sets the name of the model. |
void |
setRelativeWorthAt(int worth,
int index)
Sets a specific relative worth for the model. |
void |
setRelativeWorths(int[] worths)
Sets the relative worths for the model. |
static java.lang.String |
textValue(int n)
Converts a relative worth to a text value. |
java.lang.String |
toString()
|
void |
update(java.util.Observable thing,
java.lang.Object arg)
Listens for updates to the kernel and its SiteList |
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 |
Field Detail |
public static final int NEAR_INF
Constructor Detail |
public PriorityModel(java.lang.String name, Kernel kernel)
name
- name of priority modelkernel
- kernel being usedpublic PriorityModel(java.lang.String name, Kernel kernel, int defaultRelativeWorth, boolean isEditable)
name
- name of priority modelkernel
- kernel being useddefaultRelativeWorth
- default relative worth for modelisEditable
- whether or not this model's worths can be changedpublic PriorityModel(PriorityModel shellFromThis)
shellFromThis
- priority model from which to construct a shellMethod Detail |
public final void initializeAfterDeserialization(Kernel kernel)
kernel
- the kernel to register withpublic final int getDefaultRelativeWorth()
public final int[] getAllRelativeWorths()
public final PriorityModel makeShell()
public final boolean isEnabled()
public final void setEnabled(boolean state)
state
- whether or not the model is enabledpublic final java.lang.String getName()
public final int[] getPriorities()
public final int[] getRelativeWorths()
public final int getRelativeWorthAt(int index)
index
- position of relative worth to returnpublic final void setName(java.lang.String name)
name
- name of the modelpublic final void setRelativeWorths(int[] worths)
worths
- new relative worths for the modelpublic final void setRelativeWorthAt(int worth, int index)
worths
- new relative worthindex
- position of new relative worthpublic final void setIsEditable(boolean state)
state
- whether or not this model is marked as editablepublic final boolean isEditable()
public static final java.lang.String textValue(int n)
n
- number to convertpublic static final int intValue(java.lang.String s)
s
- string to convertpublic void update(java.util.Observable thing, java.lang.Object arg)
update
in interface java.util.Observer
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |