/**
  * 进入一个活跃状态,如果状态是原子状态,添加到当前的states Enter an active state If the state is atomic also record it add
  * it to the current states
  *
  * @param state state to enter
  */
 public void enterState(final EnterableState state) {
   if (!activeStates.add(state)) {
     throw new IllegalStateException("State " + state.getId() + " already added.");
   }
   if (state.isAtomicState()) {
     if (!atomicStates.add(state)) {
       throw new IllegalStateException("Atomic state " + state.getId() + " already added.");
     }
   }
 }
 /**
  * Exit an active state If the state is atomic also remove it from current states
  *
  * <p>退出一个活跃的状态,
  *
  * @param state state to exit
  */
 public void exitState(final EnterableState state) {
   if (!activeStates.remove(state)) {
     throw new IllegalStateException("State " + state.getId() + " not active.");
   }
   atomicStates.remove(state);
 }