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 Type
    Method
    Description
    void
    changeState(S newState)
    Exits the current state and enters a new state, unless both are equal.
    default void
    changeState(S from, S to)
    Changes the state of this state machine, only if the current state matches a given state.
    default void
    toggleState(S active, S inactive)
    Changes the current state to active, unless active is already the current state, then the state is changed to inactive.

    Methods inherited from interface dev.prozilla.pine.core.state.StateProvider

    getState, isAnyState, isState
  • Method Details

    • toggleState

      default void toggleState(S active, S inactive)
      Changes the current state to active, unless active is already the current state, then the state is changed to inactive.
      Parameters:
      active - The primary state
      inactive - The secondary state
    • changeState

      default void changeState(S from, S to)
      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

      void changeState(S newState)
      Exits the current state and enters a new state, unless both are equal.
      Parameters:
      newState - The new state to enter