package com.jscape.util.fsm;

/**
 * @author Alex Usun
 */
public interface StateTransitions {

    State stateFor(State currentState, Event event)
            throws IllegalTransitionException;

    class IllegalTransitionException
            extends FSMException {

        private static final long serialVersionUID = -6255221772712405447L;

        public final State state;
        public final Event event;

        public IllegalTransitionException(State state, Event event) {
            this.state = state;
            this.event = event;
        }

        @Override
        public String toString() {
            return "Illegal FSM transition: "
                    + "state=" + this.state
                    + ", event=" + this.event;
        }
    }
}
