Enum 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.String name  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Phase​(java.lang.String name)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Phase fromInt​(int i)
      Deserialize enum from integer value.
      int toInt()
      Serialize the object to an integer code.
      java.lang.String toString()
      Returns a non-localized UI string for the phase.
      static Phase valueOf​(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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • INIT

        public static final Phase INIT
      • SPLIT

        public static final Phase SPLIT
      • MOVE

        public static final Phase MOVE
      • FIGHT

        public static final Phase FIGHT
      • MUSTER

        public static final Phase MUSTER
    • Field Detail

      • name

        private final java.lang.String name
    • Constructor Detail

      • Phase

        private Phase​(java.lang.String name)
    • 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 name
        java.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:
        toString in class java.lang.Enum<Phase>