Interface State

  • All Implemented Interfaces:

    
    public interface State
    
                        

    Base interface for representing states within a StateMachine.

    This interface defines the lifecycle contract for states, providing methods for initialization and finalization. States implementing this interface can be used within any state machine to define specific behaviors and transitions. Both methods have default no-operation implementations, allowing states to override only the methods they need for their specific functionality.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Unit initialize() Called when the state is entered and becomes the current state.
      Unit cleanUp() Called when the state is being exited and another state is becoming current.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • initialize

         Unit initialize()

        Called when the state is entered and becomes the current state.

        This method is invoked by the StateMachine when transitioning to this state. States should use this method to perform any initialization logic, set up listeners, start operations, or configure resources needed for the state.

      • cleanUp

         Unit cleanUp()

        Called when the state is being exited and another state is becoming current.

        This method is invoked by the StateMachine before transitioning away from this state. States should use this method to perform cleanup operations, remove listeners, cancel ongoing operations, or release resources associated with the state.