Class StateMachine

java.lang.Object
io.github.frizman21.automaton.StateMachine
All Implemented Interfaces:
Runnable

public class StateMachine extends Object implements Runnable
Author:
Mike Frizzell
  • Constructor Details

    • StateMachine

      public StateMachine(String name)
  • Method Details

    • register

      public boolean register(Event event)
    • add

      public boolean add(StateMachineListener listener)
    • createStartState

      public State createStartState(String name) throws ConfigException
      Throws:
      ConfigException
    • createState

      public State createState(String name)
    • createState

      public State createState(String name, boolean isEndState)
    • startMachine

      public void startMachine(boolean startThread) throws ConfigException
      Throws:
      ConfigException
    • eventHappens

      public void eventHappens(Event event) throws ConfigException
      Throws:
      ConfigException
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • kill

      public void kill()
      This will kill the internal thread that fires the next event.
    • isMachineRunning

      public boolean isMachineRunning()
    • waitUntilDone

      public boolean waitUntilDone(long timeout)
      Returns:
    • getState

      public State getState()
    • getFromMachineState

      public Object getFromMachineState(Object key)
    • putFromMachineState

      public Object putFromMachineState(String key, Object value)