Enum PhaseType

java.lang.Object
java.lang.Enum<PhaseType>
it.polimi.ingsw.model.PhaseType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<PhaseType>, java.lang.constant.Constable

public enum PhaseType
extends java.lang.Enum<PhaseType>
Represents all the possible turn phases. Each phase has a list of the valid action during that phase
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant Description
    END  
    END_SETUP  
    FINAL  
    INITIAL  
    PRODUCING  
    SETUP_CHOOSING_RESOURCES  
    SETUP_DISCARDING_LEADERS  
    SHOPPING  
    SHOPPING_LEADER  
  • Method Summary

    Modifier and Type Method Description
    static PhaseType fromValue​(java.lang.String value)
    static factory method that constructs enum by string
    java.util.List<ActionType> getAvailableActions()  
    boolean isSetup()
    Check if the Phase is a initial setup phase (in the first turn of the player)
    boolean isTmp()
    Check if the Phase is a temporary phase existing only during some model updates (but never before or after it)
    boolean isValid​(ActionType actionType)
    Returns true if the specified action is valid in this phase
    static PhaseType valueOf​(java.lang.String name)
    Returns the enum constant of this type with the specified name.
    static PhaseType[] 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, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

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

    • SETUP_CHOOSING_RESOURCES

      public static final PhaseType SETUP_CHOOSING_RESOURCES
    • SETUP_DISCARDING_LEADERS

      public static final PhaseType SETUP_DISCARDING_LEADERS
    • END_SETUP

      public static final PhaseType END_SETUP
    • INITIAL

      public static final PhaseType INITIAL
    • SHOPPING

      public static final PhaseType SHOPPING
    • SHOPPING_LEADER

      public static final PhaseType SHOPPING_LEADER
    • PRODUCING

      public static final PhaseType PRODUCING
    • FINAL

      public static final PhaseType FINAL
    • END

      public static final PhaseType END
  • Method Details

    • values

      public static PhaseType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static PhaseType 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
    • fromValue

      public static PhaseType fromValue​(java.lang.String value)
      static factory method that constructs enum by string
      Parameters:
      value - string to create the enum
      Returns:
      a new enumeration
    • isValid

      public boolean isValid​(ActionType actionType)
      Returns true if the specified action is valid in this phase
      Parameters:
      actionType - the action whose validity is to be checked
      Returns:
      true if the action is valid
    • isSetup

      public boolean isSetup()
      Check if the Phase is a initial setup phase (in the first turn of the player)
      Returns:
      true if it's a setup phase
    • isTmp

      public boolean isTmp()
      Check if the Phase is a temporary phase existing only during some model updates (but never before or after it)
      Returns:
      true if it's temporary
    • getAvailableActions

      public java.util.List<ActionType> getAvailableActions()
      Returns:
      an unmodifiable list of all the valid actions during this phase