Browse Source

added prev method

master
Vyacheslav N. Boyko 5 years ago
parent
commit
8dd85104ef
  1. 11
      src/main/java/ru/bvn13/fsm/FSM.java

11
src/main/java/ru/bvn13/fsm/FSM.java

@ -80,6 +80,17 @@ public class FSM { @@ -80,6 +80,17 @@ public class FSM {
nextState(nextState);
}
public void prev() throws FSMException {
if (done) {
return;
}
currentState.afterEvent();
if (getPreviousState() == null) {
return;
}
nextState(getPreviousState());
}
private void nextState(State state) {
state.beforeEvent();
previousState = currentState;

Loading…
Cancel
Save