Class StateMachine<S>

java.lang.Object
org.antublue.test.engine.internal.statemachine.StateMachine<S>

public class StateMachine<S> extends Object
Class to implement a StateMachine
  • Constructor Details

    • StateMachine

      public StateMachine()
      Constructor
    • StateMachine

      public StateMachine(String id)
      Constructor
      Parameters:
      id - the state machine id
  • Method Details

    • addTransition

      public StateMachine<S> addTransition(S state, Transition<S> transition)
      Method to add a state transition
      Parameters:
      state - the state
      transition - the transition
      Returns:
      this
    • getId

      public String getId()
      Method to get the state machine id
      Returns:
      the state machine id
    • signal

      public void signal(S state)
      Method to set the state
      Parameters:
      state - the state
    • run

      public void run(S state) throws Throwable
      Method start the state machine
      Parameters:
      state - the beginning state
      Throws:
      Throwable - an exception encountered when running
    • stop

      public void stop()
      Method to stop the state machine
    • stop

      public void stop(Throwable throwable)
      Method to stop the state machine
      Parameters:
      throwable - throwable
    • getState

      public S getState()
      Method to get the current state
      Returns:
      the current state
    • toString

      public String toString()
      Overrides:
      toString in class Object