|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdip.world.Coast
Coasts are essential to determining connectivity between Provinces.
Coast constants should be used.
Field Summary | |
static Coast[] |
ALL_COASTS
Array of the 6 main coast types (NONE, SINGLE, NORTH, SOUTH, WEST, EAST) Warning: this should not be mutated. |
static Coast[] |
ANY_DIRECTIONAL
Array of directional coasts (NORTH, SOUTH, WEST, EAST) Warning: this should not be mutated. |
static Coast[] |
ANY_SEA
Array of sea coasts (SINGLE, NORTH, SOUTH, WEST, EAST) Warning: this should not be mutated. |
static Coast |
EAST
Constant indicating East Coast |
static Coast |
LAND
Alias for Coast.NONE |
static Coast |
NONE
Constant indicating no coast (Army movement) |
static Coast |
NORTH
Constant indicating North Coast |
static Coast[] |
NOT_DISPLAYED
Array of Coasts that are not typically displayed Warning: this should not be mutated. |
static Coast |
SEA
Alias for Coast.SINGLE |
static Coast |
SINGLE
Constant indicating a single Coast (for fleets in coastal land areas, or sea-only provinces) |
static Coast |
SOUTH
Constant indicating South Coast |
static Coast |
TOUCHING
Alias for Coast.WING |
static Coast |
UNDEFINED
Constant indicated an Undefined coast |
static Coast |
WEST
Constant indicating West Coast |
static Coast |
WING
Constant indicating Wing coast (for Wing movement) |
Method Summary | |
java.lang.String |
getAbbreviation()
Returns the abbreviated coast name (e.g., "nc") |
static Coast |
getCoast(int idx)
Gets the Coast corresponding to an index; null if index is out of range. |
int |
getIndex()
Gets the index of a Coast. |
java.lang.String |
getName()
Returns the full name (long name) of a coast; e.g., "North Coast" |
static java.lang.String |
getProvinceName(java.lang.String input)
Returns the Province name upto the first Coast seperator character ('-', '/', or '\'); Parentheses are not supported. |
int |
hashCode()
Implementation of Object.hashCode() |
boolean |
isDirectional()
Returns true if coast is one of
Coast.NORTH, Coast.SOUTH, Coast.WEST, or Coast.EAST |
static boolean |
isDisplayable(Coast coast)
Returns if this Coast is typically displayed |
static java.lang.String |
normalize(java.lang.String input)
Normalizes coasts to standard format "/xx". |
static Coast |
parse(java.lang.String text)
Parses the coast from a text token. |
protected java.lang.Object |
readResolve()
Assigns serialized objects to a single constant reference |
java.lang.String |
toString()
Returns the full name of the coast |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Coast UNDEFINED
public static final Coast WING
public static final Coast NONE
public static final Coast SINGLE
public static final Coast NORTH
public static final Coast SOUTH
public static final Coast WEST
public static final Coast EAST
public static final Coast TOUCHING
public static final Coast LAND
public static final Coast SEA
public static final Coast[] NOT_DISPLAYED
public static final Coast[] ALL_COASTS
public static final Coast[] ANY_SEA
public static final Coast[] ANY_DIRECTIONAL
Method Detail |
public java.lang.String getName()
public java.lang.String getAbbreviation()
public int getIndex()
public static Coast getCoast(int idx)
public java.lang.String toString()
public static boolean isDisplayable(Coast coast)
public static Coast parse(java.lang.String text)
Given a text token such as "spa-sc" or "spa/nc", Returns the Coast constant. Coasts must begin with a '/', '-', or '\'; parenthetical notation e.g., "(nc)" is not supported.
This method never returns null; for nonexistent or unparsable coasts, Coast.UNDEFINED is returned.
public static java.lang.String getProvinceName(java.lang.String input)
public static java.lang.String normalize(java.lang.String input) throws OrderException
The following applies:
a) input must be lower-case b) normalizes: axy where a = "/" "\" or "-" x where x = any alphanumeric [but is later checked]; a "." may follow y where y = "c" or (if x="m", "v"); a "." my follow c) parenthetical coasts coalesces preceding spaces (before parenthesis), so "stp(sc)", "stp( sc)", "stp(.s.c.)", "stp (sc)", and "stp (sc)" all would become "stp/sc" coast depends upon FIRST character stp(qoieru) ==> invalid!
An OrderException is thrown if the coast is not recognized. The OrderException will contain the invalid coast text only.
Bug note: the following "xxx-n.c." will be converted to "xxx-nc ." Note the extra period.
OrderException
public boolean isDirectional()
true
if coast is one of
Coast.NORTH, Coast.SOUTH, Coast.WEST, or Coast.EAST
public int hashCode()
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |