Java enum-based state machine (FSM): Passing in events
Why not have events call the right callback on state directly? public enum State { abstract State processFoo(); abstract State processBar(); State processBat() { return this; } // A default implementation, so that states that do not use this event do not have to implement it anyway. … State1 { State processFoo() { return State2; … Read more