Enum Class ModuleState
- All Implemented Interfaces:
Serializable, Comparable<ModuleState>, Constable
Represents the lifecycle state of a game module.
States progress in a linear sequence and only forward transitions are permitted.
Use canTransitionTo(ModuleState) to validate a state change before applying it.
Valid transitions:
- CREATED -> INITIALIZING
- INITIALIZING -> RUNNING
- RUNNING -> DEINITIALIZING
- DEINITIALIZING -> CLEANED_UP
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionModule has been fully de-initialised and all resources released.Module has been created but not yet initialised.Module is currently running its de-initialisation logic.Module is currently running its initialisation logic.Module is fully initialised and active. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanTransitionTo(ModuleState next) Returnstrueif transitioning from this state tonextis permitted.static ModuleStateReturns the enum constant of this class with the specified name.static ModuleState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CREATED
Module has been created but not yet initialised. -
INITIALIZING
Module is currently running its initialisation logic. -
RUNNING
Module is fully initialised and active. -
DEINITIALIZING
Module is currently running its de-initialisation logic. -
CLEANED_UP
Module has been fully de-initialised and all resources released.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
canTransitionTo
Returnstrueif transitioning from this state tonextis permitted.- Parameters:
next- the target state to transition to; must not benull- Returns:
trueif the transition is valid,falseotherwise
-