Package net.sf.colossus.game
Enum Phase
- java.lang.Object
-
- java.lang.Enum<Phase>
-
- net.sf.colossus.game.Phase
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Phase>
public enum Phase extends java.lang.Enum<Phase>
TODO this should probably start numbering with zero as does the BattlePhase and as does any other Java enum -- currently SPLIT is serialized as "1" TODO instead: now that I added an artificial phase "INIT" (needed during start of the game, otherwise updateStatusScreen tries to do toString on null), - are then the fromInt/toInit still needed?
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringname
-
Constructor Summary
Constructors Modifier Constructor Description privatePhase(java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PhasefromInt(int i)Deserialize enum from integer value.inttoInt()Serialize the object to an integer code.java.lang.StringtoString()Returns a non-localized UI string for the phase.static PhasevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static Phase[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static Phase[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Phase c : Phase.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Phase valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
fromInt
public static Phase fromInt(int i)
Deserialize enum from integer value.- Parameters:
i- The number for the phase.- Returns:
- The matching Phase instance.
- Throws:
ArrayOutOfBoundsException- iff the number is not valid.
-
toInt
public int toInt()
Serialize the object to an integer code. Used for savegames.- Returns:
- An integer code representing the phase.
-
toString
public java.lang.String toString()
Returns a non-localized UI string for the phase.- Overrides:
toStringin classjava.lang.Enum<Phase>
-
-