added prev method
This commit is contained in:
parent
49e81139b5
commit
8dd85104ef
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user