/**
   * Constructor creates a StateMachine with its own thread.
   *
   * @param name of the state machine
   */
  protected StateMachine(String name) {
    mSmThread = new HandlerThread(name);
    mSmThread.start();
    Looper looper = mSmThread.getLooper();

    initStateMachine(name, looper);
  }
 /**
  * Constructor creates an StateMachine using the looper.
  *
  * @param name of the state machine
  */
 protected StateMachine(String name, Looper looper) {
   initStateMachine(name, looper);
 }