|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdip.process.OrderState
OrderState objects keep track of the state of an order, during adjudication. OrderStates are not designed to be serialized.
Each OrderState represents a decision. All OrderStates initially start out with an evaluation state of Tristate.UNCERTAIN. Once a decision has been made, based upon the internal state, the evaluation state is finalized (Tristate.SUCCESS or Tristate.FAILURE). Ince finalized, a decision can never be reversed. Irreversibility is enforced by the OrderState object.
_max values only become smaller.
_certain values only become larger.
defense: the strength to stay in the same position (hold strength)
attack: the strength required to dislodge a defender from it's position; a separate value
is computed for "self" attacks.
Dependent lists include OrderStates representing:
In Java code, OrderState variables typically have the suffix "OS".
NOTE: When debugging, assertions should be enabled.
DESIGN NOTE: this class is currently marked final but may not be in future versions.
Field Summary | |
static int |
MAX_VALUE
NOTE: 'max' values start at an arbitrarily high value (something that is so large that it could never occur in a game) and move down. |
static int |
MIN_VALUE
MINIMUM value for a strength. |
Constructor Summary | |
protected |
OrderState(Order order)
Create an OrderState. |
Method Summary | |
int |
getAtkCertain()
Get certain attack value |
int |
getAtkMax()
Get maximum attack value |
int |
getAtkSelfSupportCertain()
Get certain self-support attack value. |
int |
getAtkSelfSupportMax()
Get maximum self-support attack value |
int |
getDefCertain()
Get certain defense value |
int |
getDefMax()
Get maximum defense value |
OrderState[] |
getDependentMovesToDestination()
Get the Move orders that are moving to the Destination Location of this order. |
OrderState[] |
getDependentMovesToSource()
Get the Move orders that are moving to the Source Location of this order. |
OrderState[] |
getDependentSelfSupports()
Gets the dependent self-Support orders for this order |
OrderState[] |
getDependentSupports()
Gets the dependent Support orders for this order |
Tristate |
getDislodgedState()
Get dislodged state. |
OrderState |
getDislodger()
Get the dislodger, if any. |
Tristate |
getEvalState()
Get the evaluation state. |
OrderState |
getHeadToHead()
Get the order that we are in a head-to-head Move with. |
Order |
getOrder()
Get the Order for this OrderState. |
Power |
getPower()
Convenicent method: get the order Power |
int |
getRetreatStrength()
Get retreat strength |
int |
getSelfSupport(boolean isCertain)
Similar to getSupport(), but, determines self-support (if any). |
Location |
getSource()
Convenicent method: get the order source Location |
Province |
getSourceProvince()
Convenicent method: get the order source Province |
int |
getSupport(boolean isCertain)
For each support in the dependent list, the total support is determined in the following manner: if isCertain == true: +1 if support evalState == TriSTate.SUCCESS +0 if evalState is UNCERTAIN or FAILURE if isCertain == false; [calculates 'max' support] +1 if support evalState == SUCCESS or UNCERTAIN +0 if support evalState == FAILURE Note: It is assumed that all support is 'appropriate'; and that invalid supports have already been marked as such (e.g., if order is Move A-B, and we have to supports: support 1: C sup A-B, and support 2: C sup A) that support 2 (illegal for a Move order) is marked FAILURE with it's evalstate. |
protected int |
getSupport(boolean isCertain,
OrderState[] supportList,
int defaultStrength)
Helper method, used by other getSupport() and getSelfSupport() methods. |
boolean |
hasFoundConvoyPath()
Get if we have found a convoy path. |
boolean |
isCircular()
Get if we are part of a circular movement chain. |
boolean |
isHeadToHead()
Determines if this is part of a head-to-head Move. |
boolean |
isLegal()
Get the order legality (default is true). |
boolean |
isRetreatStrengthSet()
Indicates if the retreat strength has been set. |
boolean |
isVerified()
Indicate if Order has been Verified |
void |
setAtkCertain(int value)
Set the certain attack value. |
void |
setAtkMax(int value)
Set the maximum attack value. |
void |
setAtkSelfSupportCertain(int value)
Set the attack certain including self-support |
void |
setAtkSelfSupportMax(int value)
Set the attack max including self-support |
void |
setCircular(boolean value)
Set if this is part of a chain of circular movements. |
void |
setDefCertain(int value)
Set the certain defense. |
void |
setDefMax(int value)
Set the maximum defense. |
void |
setDependentMovesToDestination(java.util.List osList)
Adds a List of the Dependent Move Orderstates to the Destination Province of this Orderstate If asserts are enabled, all OrderStates are verified to contain only Move orders. |
void |
setDependentMovesToSource(java.util.List osList)
Adds a List of the Dependent Move Orderstates to the Source Province of this Orderstate. |
void |
setDependentSelfSupports(java.util.List osList)
Criteria: Support order Supported MOVE (not any other) [supportedSrc ! |
void |
setDependentSupports(java.util.List osList)
Adds the given list, which must only contain Dependent Support OrderStates. |
void |
setDislodgedState(Tristate value)
Set the dislodged state. |
void |
setDislodger(OrderState os)
Set the dislodger. |
void |
setEvalState(Tristate value)
Set the evaluation state. |
void |
setFoundConvoyPath(boolean value)
Set if we have found a convoy path |
void |
setHeadToHead(OrderState os)
if move is a head-to-head move, set which move we are moving head-to-head against here. |
void |
setLegal(boolean value)
Sets if an Order is legal. |
protected void |
setOrder(Order value)
Set the Order. |
void |
setRetreatStrength(int value)
Set the retreat strength |
void |
setVerified(boolean value)
Set if an order has been verified. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_VALUE
public static final int MIN_VALUE
Constructor Detail |
protected OrderState(Order order)
Method Detail |
public Order getOrder()
public boolean isCircular()
public Tristate getEvalState()
public Tristate getDislodgedState()
public int getDefMax()
public int getDefCertain()
public int getAtkMax()
public int getAtkCertain()
public int getAtkSelfSupportMax()
public int getAtkSelfSupportCertain()
public boolean isHeadToHead()
public OrderState getHeadToHead()
public boolean isLegal()
public OrderState getDislodger()
public boolean hasFoundConvoyPath()
public int getRetreatStrength()
public boolean isRetreatStrengthSet()
public boolean isVerified()
public OrderState[] getDependentSupports()
public OrderState[] getDependentMovesToSource()
public OrderState[] getDependentMovesToDestination()
public OrderState[] getDependentSelfSupports()
protected void setOrder(Order value)
public void setCircular(boolean value)
public void setDislodgedState(Tristate value)
public void setDefMax(int value)
public void setDefCertain(int value)
public void setAtkMax(int value)
public void setAtkCertain(int value)
public void setAtkSelfSupportMax(int value)
public void setAtkSelfSupportCertain(int value)
public void setFoundConvoyPath(boolean value)
public void setRetreatStrength(int value)
public void setLegal(boolean value)
public void setVerified(boolean value)
public void setEvalState(Tristate value)
public void setHeadToHead(OrderState os)
public void setDislodger(OrderState os)
public void setDependentSupports(java.util.List osList)
If assertions are enabled, the list is verified to contain only Support OrderStates
public void setDependentSelfSupports(java.util.List osList)
public void setDependentMovesToSource(java.util.List osList)
If asserts are enabled, all OrderStates are verified to contain only Move orders.
public void setDependentMovesToDestination(java.util.List osList)
If asserts are enabled, all OrderStates are verified to contain only Move orders.
public Location getSource()
public Province getSourceProvince()
public Power getPower()
public int getSupport(boolean isCertain)
Note:
It is assumed that all support is 'appropriate'; and that invalid supports have
already been marked as such (e.g., if order is Move A-B, and we have to supports:
support 1: C sup A-B, and support 2: C sup A) that support 2 (illegal for a Move order)
is marked FAILURE with it's evalstate.
If there is NO support, we return 1 (since all units have a default strength of 1), unless the base move modifier (due to a difficult passable border) changes this amount.
public int getSelfSupport(boolean isCertain)
protected int getSupport(boolean isCertain, OrderState[] supportList, int defaultStrength)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |