|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.hagenah.diplomacy.game.Unit
public final class Unit
The Unit class represents an unit in a phase of a game.
| Field Summary | |
|---|---|
static int |
TOSTRING_COUNTRY
Includes the country, e.g. |
static int |
TOSTRING_CSS
The CSS class color-? |
static int |
TOSTRING_HTML
Returns a xhtml text, e.g. → instead of -> |
static int |
TOSTRING_JUDGE
Judge compatible output, e.g. |
static int |
TOSTRING_LIST
Returns a list output, e.g. |
static int |
TOSTRING_RETREATS
Includes the retreats, e.g. |
static int |
TOSTRING_SHORT
Returns a short text, e.g. |
| Constructor Summary | |
|---|---|
Unit(Country country,
SubProvince subprovince)
Creates a unit that cannot retreat. |
|
Unit(Country country,
SubProvince subprovince,
java.util.Collection retreats)
Creates a dislodged unit. |
|
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object obj)
Compares two Units by Country, SubProvince, Retreats. |
boolean |
equals(java.lang.Object obj)
Compares two Units by Country, SubProvince, Retreats. |
Country |
getCountry()
Returns the owner of the unit. |
java.util.SortedSet |
getRetreats()
Returns all possible retreats. null if the unit cannot retreat. |
SubProvince |
getSubProvince()
Returns the subprovince in which the unit is. |
int |
hashCode()
Returns a hashcode for this unit. |
boolean |
isDislodged()
Is the unit dislodged? |
boolean |
isFleet()
Is the unit a fleet? |
java.lang.String |
toString()
Returns a description of the unit, e.g. |
java.lang.String |
toString(int flags)
Returns a text for this unit. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int TOSTRING_LIST
public static final int TOSTRING_SHORT
public static final int TOSTRING_COUNTRY
public static final int TOSTRING_RETREATS
public static final int TOSTRING_JUDGE
public static final int TOSTRING_HTML
public static final int TOSTRING_CSS
| Constructor Detail |
|---|
public Unit(Country country,
SubProvince subprovince)
country - Owner of the unitsubprovince - Subprovince in which the unit is
public Unit(Country country,
SubProvince subprovince,
java.util.Collection retreats)
country - Owner of the unit (!=null).subprovince - Subprovince in which the unit is (!=null).retreats - Subprovinces to which the unit can retreat (!=null). Must not be empty,
contain null or duplicated values or provinces that are not neighbours.| Method Detail |
|---|
public Country getCountry()
public SubProvince getSubProvince()
public boolean isDislodged()
public java.util.SortedSet getRetreats()
public boolean isFleet()
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(int flags)
flags - TOSTRING_LIST, TOSTRING_COUNTRY, TOSTRING_RETREATS, TOSTRING_SHORT, TOSTRING_JUDGE, TOSTRING_HTML, TOSTRING_CSS
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||