added prev method

master
Vyacheslav N. Boyko 2018-01-09 17:08:05 +03:00
parent 49e81139b5
commit 8dd85104ef
1 changed files with 11 additions and 0 deletions

View File

@ -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;