dip.order
Class Build

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

public class Build
extends Order

Implementation of the Build order.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class dip.order.Order
ORD_VAL_BORDER, power, src, srcUnitType
 
Constructor Summary
protected Build()
          Creates a Build order
protected Build(Power power, Location src, Unit.Type srcUnit)
          Creates a Build order
 
Method Summary
 void determineDependencies(Adjudicator adjudicator)
          Empty method: Build orders do not require dependency determination.
 boolean equals(java.lang.Object obj)
          Determines if the orders are equal.
 void evaluate(Adjudicator adjudicator)
          Build orders are always successful.
 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)
 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)
          Builds: Builds are valid if: supply center is owned by this power supply centers is home to this power province contains no unit can build unit of that type in said province if fleet specified, coast must be valid default to army if no type specified AND supply center is inland otherwise build fails.
 void verify(Adjudicator adjudicator)
          Empty method: Build orders do not require verification.
 
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
 

Constructor Detail

Build

protected Build(Power power,
                Location src,
                Unit.Type srcUnit)
Creates a Build order


Build

protected Build()
Creates a Build order

Method Detail

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
Builds:

Builds are valid if:

  1. supply center is owned by this power
  2. supply centers is home to this power
  3. province contains no unit
  4. can build unit of that type in said province
  5. if fleet specified, coast must be valid
  6. default to army if no type specified AND supply center is inland otherwise build fails.

Validation is different than that of most other orders, since there is no unit present.

If builds not in home supply centers are allowed, restriction #2 above is waived.

WARNING: if the "build in any owned sc if one (or more) home sc is owned" rule is in place, this method does NOT currently check and reject the order if no home supply centers are owned. However, no units are allowed to be built in that case anyway, so the adjustments should be 0.

NOTE: validate() cannot take care of state-dependent order problems (since validate() cannot know what other orders have been submitted), such as if too many build orders are submitted. verify() could, but currently does not.

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)
Empty method: Build orders do not require verification.


determineDependencies

public void determineDependencies(Adjudicator adjudicator)
Empty method: Build orders do not require dependency determination.


evaluate

public void evaluate(Adjudicator adjudicator)
Build orders are always successful.

If there are too few build orders, that is ok. If there are too many build orders, extra build orders must be discarded by the Adjustment adjudicator as appropriate.

Extra build orders are NOT considered in the evaluate() method here.



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