public void jumpToState(@Nonnull State newState){
  mStateLock.lock();
  try {
    if (newState.equals(mState)) {
      Log.d(TAG,"No op since jump to the same state.");
    }
 else {
      Log.d(TAG,"Change state : " + mState + " => "+ newState);
      mState.onLeave();
      mState=newState;
      Optional<State> nextState=mState.onEnter();
      while (nextState.isPresent()) {
        Log.d(TAG,"Forward state : " + mState + " => "+ nextState.get());
        mState.onLeave();
        mState=nextState.get();
        nextState=mState.onEnter();
      }
      mStateChangedCondition.signalAll();
    }
  }
  finally {
    mStateLock.unlock();
  }
}

public void jumpToState ( @ Nonnull State newState ) { mStateLock . lock ( ) ; try { if ( newState . equals ( mState ) ) { Log . d ( TAG , "No op since jump to the same state." ) ; } else { Log . d ( TAG , "Change state : " + mState + " => " + newState ) ; mState . onLeave ( ) ; mState = newState ; Optional < State > nextState = mState . onEnter ( ) ; while ( nextState . isPresent ( ) ) { Log . d ( TAG , "Forward state : " + mState + " => " + nextState . get ( ) ) ; mState . onLeave ( ) ; mState = nextState . get ( ) ; nextState = mState . onEnter ( ) ; } mStateChangedCondition . signalAll ( ) ; } } finally { mStateLock . unlock ( ) ; } }
jumps directly to a specific state .
