Class StateMetadata<T>

  • Type Parameters:
    T - StateMachine's key datatype

    public class StateMetadata<T>
    extends java.lang.Object
    A container for metadata about a state. These are sent to every state's action consumer to provide information about how and when it is being called.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected StateMetadata​(StateMachine parent, T previousState, boolean isFirstRun)
      Create StateMetadata
    • Constructor Detail

      • StateMetadata

        protected StateMetadata​(@Nonnull
                                StateMachine parent,
                                @Nullable
                                T previousState,
                                boolean isFirstRun)
        Create StateMetadata
        Parameters:
        parent - State's parent StateMachine
        previousState - The previous state key
        isFirstRun - Is this the first run of the action?
    • Method Detail

      • getPreviousStateKey

        @Nullable
        public T getPreviousStateKey()
        Get the key of the last state to run. Null if this is the first state to be executed.
        Returns:
        Last key
      • isFirstRun

        public boolean isFirstRun()
        Is this the first loop of this action?
        Returns:
        Is first loop