dip.process
Class StdAdjudicator

java.lang.Object
  extended bydip.process.StdAdjudicator
All Implemented Interfaces:
Adjudicator

public class StdAdjudicator
extends java.lang.Object
implements Adjudicator

StdAjudicator is adjudicates all phases of a typical game, using the standard rule set, as well as enhancements indicated in the DPTG and DATC.

This is a pretty large class, and could be split into 3 separate classes (1 for each phase).


Constructor Summary
StdAdjudicator(OrderFactory orderFactory, TurnState ts)
          Create a Adjudicator for the Standard rules, that will evaluate all Orders for the current TurnState.
 
Method Summary
 void addBouncedResult(OrderState os, OrderState bouncer)
          Add a BouncedResult to the result list
 void addDislodgedResult(OrderState os)
          Add a DislodgedResult to the result list
 void addResult(OrderState os, OrderResult.ResultType type, java.lang.String message)
          Add a Result to the result list
 void addResult(OrderState os, java.lang.String message)
          Add a Result to the result list
 void addResult(Result result)
          Add a Result to the result list
 OrderState findOrderStateBySrc(Location location)
          Find the OrderState with the given source Province.
 OrderState findOrderStateBySrc(Province src)
          Find the OrderState with the given source Province.
 TurnState getNextTurnState()
          This may return null, if the game has ended and victory conditions have been met during the Adjustment phase.
 OrderState[] getOrderStates()
          Get all OrderStates
 java.util.List getSubstitutedOrderStates()
          Returns a list of substituted orders.
 TurnState getTurnState()
          Get the TurnState
 boolean isSelfSupportedMove(OrderState os)
          Returns 'true' if The Orderstate in question is a support order that is supporting a move against itself.
 boolean isUnresolvedParadox()
          If an unresolved paradox was detected, this returns true.
 void process()
          Process the orders.
 void setOrderFormat(OrderFormatOptions ofo)
          Sets the order formatting options
 void setPowerOrderChecking(boolean value)
          If enabled, checks to make sure that each Power's list of orders only contains orders from that Power.
 void setStatReporting(boolean value)
          Enable or disable reporting of failure statistics.
protected  void verifyOrders()
          Verifies orders in a loop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StdAdjudicator

public StdAdjudicator(OrderFactory orderFactory,
                      TurnState ts)
Create a Adjudicator for the Standard rules, that will evaluate all Orders for the current TurnState.

Method Detail

process

public void process()
Process the orders.

Specified by:
process in interface Adjudicator

setOrderFormat

public void setOrderFormat(OrderFormatOptions ofo)
Sets the order formatting options


setStatReporting

public void setStatReporting(boolean value)
Enable or disable reporting of failure statistics.

Specified by:
setStatReporting in interface Adjudicator

setPowerOrderChecking

public void setPowerOrderChecking(boolean value)
If enabled, checks to make sure that each Power's list of orders only contains orders from that Power. This is important for networked games, to prevent illicit order injection.

Specified by:
setPowerOrderChecking in interface Adjudicator

getOrderStates

public final OrderState[] getOrderStates()
Get all OrderStates

Specified by:
getOrderStates in interface Adjudicator

getTurnState

public final TurnState getTurnState()
Get the TurnState

Specified by:
getTurnState in interface Adjudicator

findOrderStateBySrc

public final OrderState findOrderStateBySrc(Location location)
Find the OrderState with the given source Province. Returns null if no corresponding order was found. Note: Coast is not relevent here; only the Province in the given Location is used.

Specified by:
findOrderStateBySrc in interface Adjudicator

findOrderStateBySrc

public final OrderState findOrderStateBySrc(Province src)
Find the OrderState with the given source Province. Returns null if no corresponding order was found.

Specified by:
findOrderStateBySrc in interface Adjudicator

isSelfSupportedMove

public final boolean isSelfSupportedMove(OrderState os)
Returns 'true' if The Orderstate in question is a support order that is supporting a move against itself.
  1. Support order is supporting a Move
  2. unit in supportedDest must be present
  3. power of unit in supported dest == power of support order

Specified by:
isSelfSupportedMove in interface Adjudicator

getSubstitutedOrderStates

public java.util.List getSubstitutedOrderStates()
Returns a list of substituted orders. This is a list of OrderStates. Note that all OrderStates in this list will be marked "illegal". Also note that this will not contain 'null' substitutions (e.g., no order was specified, and a Hold order was automatically generated).

Specified by:
getSubstitutedOrderStates in interface Adjudicator

addResult

public final void addResult(Result result)
Add a Result to the result list

Specified by:
addResult in interface Adjudicator

addBouncedResult

public final void addBouncedResult(OrderState os,
                                   OrderState bouncer)
Add a BouncedResult to the result list

Specified by:
addBouncedResult in interface Adjudicator

addDislodgedResult

public final void addDislodgedResult(OrderState os)
Add a DislodgedResult to the result list

Specified by:
addDislodgedResult in interface Adjudicator

addResult

public final void addResult(OrderState os,
                            java.lang.String message)
Add a Result to the result list

Specified by:
addResult in interface Adjudicator

addResult

public final void addResult(OrderState os,
                            OrderResult.ResultType type,
                            java.lang.String message)
Add a Result to the result list

Specified by:
addResult in interface Adjudicator

getNextTurnState

public TurnState getNextTurnState()
This may return null, if the game has ended and victory conditions have been met during the Adjustment phase. During the movement phase, if victory conditions have been met, this will return the next TurnState.

Specified by:
getNextTurnState in interface Adjudicator

isUnresolvedParadox

public boolean isUnresolvedParadox()
If an unresolved paradox was detected, this returns true. This is mostly intended for debugging.

Specified by:
isUnresolvedParadox in interface Adjudicator

verifyOrders

protected void verifyOrders()
Verifies orders in a loop. Order verification can have dependencies, but extreme caution should be taken when implementing Order.verify() so that dependencies are minimized.



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