|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.hagenah.diplomacy.game.Turn
public class Turn
The Turn class contains the state of the board for one phase.
| Field Summary | |
|---|---|
static int |
NUMBER_FIRST
Number of the first turn |
static int |
TOSTRING_BUILDS
Includes the builds |
static int |
TOSTRING_CENTERS
Includes the centers |
static int |
TOSTRING_CSS
The CSS class color-? |
static int |
TOSTRING_DISLODGEDUNITS
Includes the dislodged units |
static int |
TOSTRING_HTML
Returns a xhtml text, e.g. → instead of -> |
static int |
TOSTRING_ORDERS
Includes the orders |
static int |
TOSTRING_SHORT
Returns a short text |
| Constructor Summary | |
|---|---|
Turn(int number,
Phase phase)
Creates a new Turn |
|
| Method Summary | |
|---|---|
void |
addDislodgedUnit(Unit dislodgedunit)
Adds a dislodged unit. |
boolean |
addOrder(Order order)
Adds an order. |
void |
addUnit(Unit unit)
Adds a unit. |
boolean |
areBuildsKnown()
Return true is the builds of this turn are known. |
boolean |
areCentersKnown()
Return true is the centers of this turn are known. |
boolean |
areDislodgedUnitsKnown()
Return true is the dislodged units of this turn are known. |
boolean |
areNoOrdersNeeded(Country country)
Are no orders needed for the country? |
boolean |
areOrdersKnown()
Return true is the orders of this turn are known. |
boolean |
areUnitsKnown()
Return true is the units of this turn are known. |
int |
compareTo(java.lang.Object obj)
Compares two Turns by Number |
boolean |
equals(java.lang.Object obj)
Compares two Turns by Number |
java.util.Map |
getBuilds()
Returns all builds (Country -> Integer). |
int |
getBuilds(Country country)
Returns the builds for a country. |
Country |
getCenter(Province center)
Returns the owner of a center or null. |
java.util.Map |
getCenters()
Returns all centers (Province -> Country). |
java.util.SortedSet |
getCenters(Country owner)
Returns all centers (Province) of owner. |
java.util.Date |
getDeadline()
Returns the deadline of the turn (can be null) |
Unit |
getDislodgedUnit(Province province)
Returns the dislodged unit in a province or null. |
java.util.Map |
getDislodgedUnits()
Returns all dislodged units (Country -> Unit). |
java.lang.String |
getMissingInformation(boolean mostrecent)
Returns which information is missing. |
int |
getNumber()
Returns the number of the turn. |
Order |
getOrder(Country country,
Province province)
Returns the order of the country for the unit in province. |
Order |
getOrder(Province province)
Returns the executed order for the unit in province. null if there is not order, there are circular proxy orders or the unit for the province is missing. |
java.util.SortedSet |
getOrders()
Returns all orders. |
Phase |
getPhase()
Returns the phase of the turn. |
Unit |
getUnit(Province province)
Returns the unit in a province or null. |
Country |
getUnitCountry(Province province)
Returns the owner of the unit in province. |
java.util.Map |
getUnits()
Returns all units (Province -> Unit). |
java.util.Collection |
getWaiveOrders(Country country)
Returns all waive orders of the country (Order objects) |
int |
hashCode()
Returns a hashcode for this turn. |
boolean |
isComplete(boolean mostrecent)
Is all possible data there? |
void |
removeDislodgedUnit(Province province)
Removes a dislodged unit. |
boolean |
removeOrder(Order order)
Removes a order. |
void |
removeUnit(Province province)
Removes a unit. |
void |
setBuilds(Country country,
int units)
Sets the builds for a country |
void |
setBuilds(java.util.Map builds)
Sets the builds for this turn (Country -> Integer). |
void |
setCenter(Province center,
Country owner)
Sets the owner for a center |
void |
setCenters(java.util.Map centers)
Sets the centers for this turn. |
void |
setDeadline(java.util.Date deadline)
Returns the deadline of the turn (can be null) |
void |
setDislodgedUnits(java.util.Collection dislodgedunits)
Sets the dislodged units for this turn. |
void |
setOrders(java.util.Collection orders)
Sets the orders for this turn. |
void |
setUnits(java.util.Collection units)
Sets the units for this turn. |
java.lang.String |
toString()
Returns the phase of the turn, e.g. |
java.lang.String |
toString(int flags)
Returns a description of the turn. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int NUMBER_FIRST
public static final int TOSTRING_SHORT
public static final int TOSTRING_HTML
public static final int TOSTRING_CSS
public static final int TOSTRING_ORDERS
public static final int TOSTRING_DISLODGEDUNITS
public static final int TOSTRING_BUILDS
public static final int TOSTRING_CENTERS
| Constructor Detail |
|---|
public Turn(int number,
Phase phase)
| Method Detail |
|---|
public int getNumber()
public Phase getPhase()
public boolean areUnitsKnown()
public Unit getUnit(Province province)
public java.util.Map getUnits()
public boolean areDislodgedUnitsKnown()
public Unit getDislodgedUnit(Province province)
public java.util.Map getDislodgedUnits()
public java.util.Date getDeadline()
public void setDeadline(java.util.Date deadline)
public boolean areCentersKnown()
public Country getCenter(Province center)
public java.util.Map getCenters()
public java.util.SortedSet getCenters(Country owner)
public boolean areBuildsKnown()
public int getBuilds(Country country)
public java.util.Map getBuilds()
public boolean areOrdersKnown()
public Order getOrder(Country country,
Province province)
public java.util.Collection getWaiveOrders(Country country)
public Country getUnitCountry(Province province)
province - The province
java.lang.NullPointerException - If the units are not known
java.lang.IllegalArgumentException - If the phase is not a movement phasepublic Order getOrder(Province province)
java.lang.NullPointerException - If the units or orders are not known
java.lang.IllegalArgumentException - If the phase is not a movement phasepublic java.util.SortedSet getOrders()
public boolean isComplete(boolean mostrecent)
mostrecent - Is it the most recent turn of the game?
public java.lang.String getMissingInformation(boolean mostrecent)
mostrecent - Is it the most recent turn of the game?
public void setUnits(java.util.Collection units)
public void addUnit(Unit unit)
public void removeUnit(Province province)
public void setDislodgedUnits(java.util.Collection dislodgedunits)
public void addDislodgedUnit(Unit dislodgedunit)
public void removeDislodgedUnit(Province province)
public void setCenters(java.util.Map centers)
public void setCenter(Province center,
Country owner)
public void setBuilds(java.util.Map builds)
public void setBuilds(Country country,
int units)
public void setOrders(java.util.Collection orders)
public boolean areNoOrdersNeeded(Country country)
country - The country
public boolean addOrder(Order order)
order - The order to add
public boolean removeOrder(Order order)
order - The order to remove
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int compareTo(java.lang.Object obj)
compareTo in interface java.lang.Comparablepublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(int flags)
flags - TOSTRING_SHORT, TOSTRING_HTML, TOSTRING_CSS, TOSTRING_ORDERS, TOSTRING_DISLODGEDUNITS, TOSTRING_BUILDS
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||