dip.order
Class Support

java.lang.Object
  extended bydip.order.Order
      extended bydip.order.Support
All Implemented Interfaces:
Orderable, java.io.Serializable
Direct Known Subclasses:
GUISupport

public class Support
extends Order

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].

See Also:
Serialized Form

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

supSrc

protected Location supSrc

supDest

protected Location supDest

supUnitType

protected Unit.Type supUnitType

narrowingOrder

protected Order narrowingOrder

supPower

protected Power supPower
Constructor Detail

Support

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.


Support

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.

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.


Support

protected Support()
Creates a Support order

Method Detail

setNarrowingOrder

public void setNarrowingOrder(Order o)
A narrowing order only applies to non-move Supports, to make it more specific.

Note: this can be set, but narrowing order usage is not currently implemented.

Throws:
java.lang.IllegalArgumentException - if this is a Move support.

getSupportedSrc

public Location getSupportedSrc()
Returns the Location of the Unit we are Supporting


getSupportedUnitType

public 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()).


getNarrowingOrder

public Order getNarrowingOrder()
Returns the Narrowing order, or null if none was specified.


getSupportedPower

public Power getSupportedPower()
Returns the Power 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()).

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.


isSupportingHold

public final boolean isSupportingHold()
Returns true if we are supporting a non-Move order. This is the preferred method of determining if we are truly supporting a Move order verses a non-Move (Hold) order.


isNonMoveSupport

public final boolean isNonMoveSupport()
Returns true if we are supporting a non-Move order.

Note: isSupportingHold() should be deprecated. There is no difference (other than name) between this method and isSupportingHold()).


getSupportedDest

public Location getSupportedDest()
Returns the Location that we are Supporting into; if this is a non-move Support, this will return the same (referentially!) location as getSupportedSrc(). It will not return null.


getFullName

public java.lang.String getFullName()
Description copied from interface: Orderable
Returns the Full name of the Order (e.g., "Hold" for a Hold order)


getBriefName

public java.lang.String getBriefName()
Description copied from interface: Orderable
Returns the Brief name of the Order (e.g., "H" for a Hold order)


getDefaultFormat

public java.lang.String getDefaultFormat()
Description copied from interface: Orderable
Get the default OrderFormat String used to custom-format orders.


toBriefString

public java.lang.String toBriefString()
Description copied from interface: Orderable
Prints the entire order, in a brief syntax


toFullString

public java.lang.String toFullString()
Description copied from interface: Orderable
Prints the entire order, in a verbose syntax


equals

public boolean equals(java.lang.Object obj)
Description copied from class: Order
Determines if the orders are equal.

Note that full equality MUST be implemented for each subclassed Order object! Subclasses are advised to call the super method for assistance.

Overrides:
equals in class Order

validate

public void validate(TurnState state,
                     ValidationOptions valOpts,
                     RuleOptions ruleOpts)
              throws OrderException
Description copied from class: Order
Validate the 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.

Specified by:
validate in interface Orderable
Overrides:
validate in class Order
Parameters:
state - Current turn state
valOpts - Current validation options
Throws:
OrderException

verify

public void verify(Adjudicator adjudicator)
Checks if support orders are appropriately matched, since at this time all orders are known. Matching of Support

At this time, we do not check for narrowing conventions in a support order.


determineDependencies

public void determineDependencies(Adjudicator adjudicator)
Dependencies for a Support order:
  1. Moves to this space (for cuts, and dislodgement)
  2. Support to this space (only considered if attacked, to prevent dislodgement)


evaluate

public 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.
                                (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.
                



Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.