before handler must be called right before switching to the next state
This commit is contained in:
parent
4712c1b423
commit
9db96a2b37
@ -149,9 +149,9 @@ public class Fsm<T extends Fsm, E> {
|
||||
return;
|
||||
}
|
||||
currentState.process(event);
|
||||
currentState.afterEvent();
|
||||
if (currentState.isFinish()) {
|
||||
done = true;
|
||||
currentState.afterEvent();
|
||||
return;
|
||||
}
|
||||
switchToNextState(event);
|
||||
@ -278,6 +278,7 @@ public class Fsm<T extends Fsm, E> {
|
||||
}
|
||||
|
||||
private void nextState(State<E> state, E event) {
|
||||
currentState.afterEvent();
|
||||
previousState = currentState;
|
||||
currentState = state;
|
||||
currentState.beforeEvent();
|
||||
|
Loading…
Reference in New Issue
Block a user