added prev method

This commit is contained in:
Vyacheslav N. Boyko 2018-01-09 17:08:05 +03:00
parent 49e81139b5
commit 8dd85104ef

View File

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