|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dip.world.TurnState
A TurnState represents a snapshot of the game for the given Phase. The essential components of a TurnState are, then:
Note that we store Map (Province) adjacency data seperately from the Map (it's in the World object), so Map objects are re-constituted from a list of Provinces and Powers. This occurs behind-the-scenes when a World (or TurnState) object is deserialized.
This object is NOT SYNCHRONIZED and therefore not inherently threadsafe.
Also note that when a List of orders is obtained for a power, we do not check that the list contains only orders for that power. (e.g., are non-power orders 'snuck in' for a given power)
Constructor Summary | |
protected |
TurnState()
Creates a TurnState object. |
|
TurnState(Phase phase)
Creates a TurnState object. |
Method Summary | |
void |
clearAllOrders()
Clear all Orders, for all Powers. |
java.util.List |
getAllOrders()
Returns a List of orders for all powers. |
java.util.List |
getOrders(Power power)
Returns the List of orders for a given Power. |
Phase |
getPhase()
Returns the current Phase |
Position |
getPosition()
Gets the Position data for this TurnState |
java.util.List |
getResultList()
Returns the result list |
boolean |
getSCOwnerChanged()
A flag indicating if, after adjudication, any supply centers have changed ownership. |
World |
getWorld()
Gets the World object associated with this TurnState. |
boolean |
isEnded()
Returns true if game has ended |
boolean |
isOrderSuccessful(Orderable o)
Returns if an order has failed, based on results. |
boolean |
isResolved()
Returns the turn has been adjudicated |
void |
setEnded(boolean value)
Set if game has ended for any reason |
void |
setOrders(Power power,
java.util.List list)
Sets the orders for the given Power, deleting any existing orders for the power |
void |
setPhase(Phase phase)
This should be used with the utmost care. |
void |
setPosition(Position position)
Sets the Position data for this TurnState |
void |
setResolved(boolean value)
Set if the turn has been adjudicated. |
void |
setResultList(java.util.List list)
Sets the Result list, erasing any previously existing result list. |
void |
setSCOwnerChanged(boolean value)
Sets the flag indicating if, after adjudication, any supply centers have changed ownership. |
void |
setWorld(World world)
Set the World object associated with this TurnState. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected TurnState()
public TurnState(Phase phase)
Method Detail |
public void setWorld(World world)
null
World is not permitted.
public World getWorld()
public Phase getPhase()
public void setPhase(Phase phase)
public Position getPosition()
public void setPosition(Position position)
public java.util.List getResultList()
public void setResultList(java.util.List list)
public boolean getSCOwnerChanged()
public void setSCOwnerChanged(boolean value)
public java.util.List getAllOrders()
Manipulations to this list will not be reflected in the TurnState object.
public void clearAllOrders()
public java.util.List getOrders(Power power)
Note that modifications to the returned order List will be reflected in the TurnState.
public void setOrders(Power power, java.util.List list)
public void setEnded(boolean value)
public boolean isEnded()
true
if game has ended
public void setResolved(boolean value)
public boolean isResolved()
public boolean isOrderSuccessful(Orderable o)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |