|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdip.world.Phase
A Phase object represents when a turn takes place, and contains the year, game phase (PhaseType), and Season information.
Phase objects are mutable and comparable.
PhaseType and SeasonType objects may be compared with referential equality. (For example, "Phase.getSeasonType() == SeasonType.SPRING")
Nested Class Summary | |
static class |
Phase.PhaseType
PhaseTypes represent game phases. |
static class |
Phase.SeasonType
Represents seasons SeasonType constants should be used, rather than creating new SeasonType objects. |
static class |
Phase.YearType
YearType is used to represent the Year A YearType is used because we now support negative years ("BC") and need to appropriately advance, parse, and format these years. |
Field Summary | |
protected Phase.PhaseType |
phaseType
|
protected Phase.SeasonType |
seasonType
|
protected Phase.YearType |
yearType
|
Constructor Summary | |
|
Phase(Phase.SeasonType seasonType,
int year,
Phase.PhaseType phaseType)
Create a new Phase. |
|
Phase(Phase.SeasonType seasonType,
Phase.YearType yearType,
Phase.PhaseType phaseType)
Create a new Phase. |
protected |
Phase(Phase.YearType yt,
int idx)
Create a new Phase, given a known index |
Method Summary | |
int |
compareTo(java.lang.Object obj)
Compares the Phase to the given Phase object. |
boolean |
equals(java.lang.Object obj)
Returns true if the two phases are equivalent. |
static java.lang.String[] |
getAllSeasonPhaseCombos()
Returns a String array, in order, of valid season/phase combinations. |
java.lang.String |
getBriefName()
Displays as a short String (e.g., F1902R) |
Phase |
getNext()
Get the phase that would be after to the current phase |
Phase.PhaseType |
getPhaseType()
Returns the PhaseType |
Phase |
getPrevious()
Get the phase that would come before the current phase |
Phase.SeasonType |
getSeasonType()
Returns the SeasonType |
int |
getYear()
Returns the year |
Phase.YearType |
getYearType()
Returns the YearType |
static boolean |
isValid(Phase.SeasonType st,
Phase.PhaseType pt)
Determines if this phase is valid. |
static Phase |
parse(java.lang.String in)
Determines the Phase from a String. |
protected java.lang.Object |
readResolve()
Reconstitute a Phase object |
java.lang.String |
toString()
Displays the phase as a String |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected final Phase.SeasonType seasonType
protected final Phase.YearType yearType
protected final Phase.PhaseType phaseType
Constructor Detail |
public Phase(Phase.SeasonType seasonType, int year, Phase.PhaseType phaseType)
public Phase(Phase.SeasonType seasonType, Phase.YearType yearType, Phase.PhaseType phaseType)
protected Phase(Phase.YearType yt, int idx)
Method Detail |
public int getYear()
public Phase.YearType getYearType()
public Phase.PhaseType getPhaseType()
public Phase.SeasonType getSeasonType()
public java.lang.String getBriefName()
public java.lang.String toString()
public boolean equals(java.lang.Object obj)
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public Phase getNext()
public Phase getPrevious()
public static boolean isValid(Phase.SeasonType st, Phase.PhaseType pt)
public static Phase parse(java.lang.String in)
Expects input in the following form(s):
Season, Year (Phase)
Season, Year [Phase]
SYYYYP as a single 6-character token, e.g., F1900M = Fall 1900, Movement
Whitespace: space, comma, colon, semicolon, [], (), tab, newline, return, quotes
The order is not important. If the combination is not valid (via isValid()), or if any Phase component cannot be parsed, a null value is returned. Note that this is very forgiving, but it does not allow any non-word tokens between what we look for.
public static java.lang.String[] getAllSeasonPhaseCombos()
E.g.: Spring Move, or Spring Adjustment, etc.
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 |