Package dev.prozilla.pine.core.state
Interface MutableStateProvider<Context,S extends State<Context>>
- All Superinterfaces:
StateProvider<Context,S>
- All Known Subinterfaces:
StateMachineProvider<Context,S>
- All Known Implementing Classes:
StateMachine
public interface MutableStateProvider<Context,S extends State<Context>>
extends StateProvider<Context,S>
-
Method Summary
Modifier and TypeMethodDescriptionvoidchangeState(S newState) Exits the current state and enters a new state, unless both are equal.default voidchangeState(S from, S to) Changes the state of this state machine, only if the current state matches a given state.default voidtoggleState(S active, S inactive) Changes the current state toactive, unlessactiveis already the current state, then the state is changed toinactive.Methods inherited from interface dev.prozilla.pine.core.state.StateProvider
getState, isAnyState, isState
-
Method Details
-
toggleState
Changes the current state toactive, unlessactiveis already the current state, then the state is changed toinactive.- Parameters:
active- The primary stateinactive- The secondary state
-
changeState
Changes the state of this state machine, only if the current state matches a given state.- Parameters:
from- Determines what the current state must be in order for this change to be performed.to- The new state
-
changeState
Exits the current state and enters a new state, unless both are equal.- Parameters:
newState- The new state to enter
-