Package it.polimi.ingsw.model
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 ENDEND_SETUPFINALINITIALPRODUCINGSETUP_CHOOSING_RESOURCESSETUP_DISCARDING_LEADERSSHOPPINGSHOPPING_LEADER -
Method Summary
Modifier and Type Method Description static PhaseTypefromValue(java.lang.String value)static factory method that constructs enum by stringjava.util.List<ActionType>getAvailableActions()booleanisSetup()Check if the Phase is a initial setup phase (in the first turn of the player)booleanisTmp()Check if the Phase is a temporary phase existing only during some model updates (but never before or after it)booleanisValid(ActionType actionType)Returns true if the specified action is valid in this phasestatic PhaseTypevalueOf(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, valueOfMethods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
Enum Constant Details
-
SETUP_CHOOSING_RESOURCES
-
SETUP_DISCARDING_LEADERS
-
END_SETUP
-
INITIAL
-
SHOPPING
-
SHOPPING_LEADER
-
PRODUCING
-
FINAL
-
END
-
-
Method Details
-
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
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
-
fromValue
static factory method that constructs enum by string- Parameters:
value- string to create the enum- Returns:
- a new enumeration
-
isValid
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
- Returns:
- an unmodifiable list of all the valid actions during this phase
-