|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdip.order.Order
dip.order.Support
Implementation of the Support order.
While the ability to specify a narrowing order exists, it is not currently used. A narrowing order would be used to support a specific type of support/hold/convoy order [typically of another power].
Field Summary | |
protected Order |
narrowingOrder
|
protected Location |
supDest
|
protected Power |
supPower
|
protected Location |
supSrc
|
protected Unit.Type |
supUnitType
|
Fields inherited from class dip.order.Order |
ORD_VAL_BORDER, power, src, srcUnitType |
Constructor Summary | |
protected |
Support()
Creates a Support order |
protected |
Support(Power power,
Location src,
Unit.Type srcUnit,
Location supSrc,
Power supPower,
Unit.Type supUnit)
Creates a Support order, for supporting a Hold or other non-movement order. |
protected |
Support(Power power,
Location src,
Unit.Type srcUnit,
Location supSrc,
Power supPower,
Unit.Type supUnit,
Location supDest)
Creates a Support order, for Supporting a Move order. |
Method Summary | |
void |
determineDependencies(Adjudicator adjudicator)
Dependencies for a Support order: Moves to this space (for cuts, and dislodgement) Support to this space (only considered if attacked, to prevent dislodgement) |
boolean |
equals(java.lang.Object obj)
Determines if the orders are equal. |
void |
evaluate(Adjudicator adjudicator)
NOTE: this description may be slightly out of date evaluation of Support orders 1) calculate support (in this case, support to prevent dislodgement) this is done by all evaluate() methods 2) determine if this support is cut, not cut, or undecided. |
java.lang.String |
getBriefName()
Returns the Brief name of the Order (e.g., "H" for a Hold order) |
java.lang.String |
getDefaultFormat()
Get the default OrderFormat String used to custom-format orders. |
java.lang.String |
getFullName()
Returns the Full name of the Order (e.g., "Hold" for a Hold order) |
Order |
getNarrowingOrder()
Returns the Narrowing order, or null if none was specified. |
Location |
getSupportedDest()
Returns the Location that we are Supporting into; if this is a non-move Support, this will return the same (referentially!) |
Power |
getSupportedPower()
Returns the Power of the Unit we are Supporting. |
Location |
getSupportedSrc()
Returns the Location of the Unit we are Supporting |
Unit.Type |
getSupportedUnitType()
Returns the Unit Type of the Unit we are Supporting Warning: this can be null, if no unit type was set, and no strict validation was performed (via validate() ). |
boolean |
isNonMoveSupport()
Returns true if we are supporting a non-Move order. |
boolean |
isSupportingHold()
Returns true if we are supporting a non-Move order. |
void |
setNarrowingOrder(Order o)
A narrowing order only applies to non-move Supports, to make it more specific. |
java.lang.String |
toBriefString()
Prints the entire order, in a brief syntax |
java.lang.String |
toFullString()
Prints the entire order, in a verbose syntax |
void |
validate(TurnState state,
ValidationOptions valOpts,
RuleOptions ruleOpts)
Validate the order. |
void |
verify(Adjudicator adjudicator)
Checks if support orders are appropriately matched, since at this time all orders are known. |
Methods inherited from class dip.order.Order |
addSupportsOfAndMovesToSource, appendBrief, appendFull, checkPower, checkSeasonAdjustment, checkSeasonMovement, checkSeasonRetreat, getPower, getSource, getSourceUnitType, getValidatedUnitType, toFormattedString, toString, validate |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Location supSrc
protected Location supDest
protected Unit.Type supUnitType
protected Order narrowingOrder
protected Power supPower
Constructor Detail |
protected Support(Power power, Location src, Unit.Type srcUnit, Location supSrc, Power supPower, Unit.Type supUnit)
protected Support(Power power, Location src, Unit.Type srcUnit, Location supSrc, Power supPower, Unit.Type supUnit, Location supDest)
If supDest == null, a Hold support will be generated. Note that If supSrc == supDest, (or even if provinces are equal), this will be a Supported Move to the same location. Note that a supported Move to the same location will fail, since a Move to the same location is not a valid order.
protected Support()
Method Detail |
public void setNarrowingOrder(Order o)
Note: this can be set, but narrowing order usage is not currently implemented.
java.lang.IllegalArgumentException
- if this is a Move support.public Location getSupportedSrc()
public Unit.Type getSupportedUnitType()
validate()
).
public Order getNarrowingOrder()
public Power getSupportedPower()
validate()
).
Important Note: This also may be null only when a saved game from 1.5.1 or prior versions are loaded into a recent version, since prior versions did not support this field.
public final boolean isSupportingHold()
public final boolean isNonMoveSupport()
Note: isSupportingHold() should be deprecated. There is no difference (other than name) between this method and isSupportingHold()).
public Location getSupportedDest()
public java.lang.String getFullName()
Orderable
public java.lang.String getBriefName()
Orderable
public java.lang.String getDefaultFormat()
Orderable
public java.lang.String toBriefString()
Orderable
public java.lang.String toFullString()
Orderable
public boolean equals(java.lang.Object obj)
Order
Note that full equality MUST be implemented for each subclassed Order object! Subclasses are advised to call the super method for assistance.
equals
in class Order
public void validate(TurnState state, ValidationOptions valOpts, RuleOptions ruleOpts) throws OrderException
Order
This checks the order for legality. An order is not considered to be well-formed until it has been validated. It validates locations (at the least), and other order syntax as appropriate, throwing exceptions if there is a conflict.
This is used by the UI to flag bad orders, as well as by the adjudicator to eliminate bad orders before processing.
Important Note:
The only state that should be assumed is the following: 1) orders for this power (if entered) 2) the positions of all units. Thus, the orders of units not controlled by this power may not be known (in multiplayer games, this information would not be available until adjudication took place). DO NOT assume order information for the units of any power other than that of this unit/order!
Usage Notes:
Subclasses should generally call super.validate() before performing additional validation.
There should be no side effects of calling validate() multiple times, nor should behavior differ between multiple calls of validate(), given the same order.
validate
in interface Orderable
validate
in class Order
state
- Current turn statevalOpts
- Current validation options
OrderException
public void verify(Adjudicator adjudicator)
At this time, we do not check for narrowing conventions in a support order.
public void determineDependencies(Adjudicator adjudicator)
public void evaluate(Adjudicator adjudicator)
evaluation of Support orders 1) calculate support (in this case, support to prevent dislodgement) this is done by all evaluate() methods 2) determine if this support is cut, not cut, or undecided. (NOTE: (a) is OBSOLETE; it was considered to be a special case in an older, incorrect version of this algorithm). a) determine if this support is supporting an attack on our own unit, self-support is completely legal, and is treated like any other support. Thus it is cut as in 2.b, below. (Note: Move orders treat self-support differently when determining strength calculations) b) non-convoyed attacks (moves) *OR* no attack; these should be evaluated first, even if there is a possible convoyed attack. evaluate in this order: 1) from where support is going into: Note: although support cannot be cut by an attack to where support is being given, that attack can cut support if it will (or COULD) *dislodge* the supporting unit. To determine this, we must analyze the move against this support. a) if we are dislodged, (via move.evaluate()), then support is cut, becomes FAILURE b) if the move COULD have enough strength to dislodge this unit, become UNCERTAIN move.attackMax > support.defense_certain note that we do not count self-support (cannot self-dislodge) although we could cut support, that is NOT our perogative. Move.evaluate() must dislodge this support. c) if the move NEVER could have enough strength to dislodge this unit, SUCCESS move.attackMax <= support.defense_certain note that we do not count self-support (cannot self-dislodge) 2) if attack is from own unit (power): SUCCESS; support not cut 3) otherwise, support is cut, if an attack exists, or support suceeds, if there is no attack. c) convoyed attacks (moves); eval in this order: 1) SUCCESS if move fails (because there is no convoy); support not cut 2) SUCCESS if attack is from own power (can't cut support) 3) determine if support is to an attack on a fleet convoying the attacking army: a) if NOT, support is cut b) if it is, we must apply rule 21/22 as follows: 1) support is NOT cut if fleet is necessary for unit to convoy (SUCCESS) 2) support IS cut if there are multiple convoy routes, and at least one convoy route is successful. (FAILURE) 3) if this cannot yet be determined, UNCERTAIN NOTE: for multiple attacks: FAILURE >> UNCERTAIN >> SUCCESS only 2.c.3.b.3, 2.b.1.b result in UNCERTAIN success results.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |