/** * Fire the specified transition. * * @param fsm the involved finite state machine * @param sender the event sender * @param condition the condition * @param params the event parameters */ public void fireTransition( FiniteStateMachineT fsm, Object sender, ConditionT condition, Params params) { if (this.transitions.containsKey(fsm.getState())) { this.transitions.get(fsm.getState()).fireTransition(fsm, sender, condition, params); } else { throw new IllegalArgumentException( "No handler registered for condition " + condition + " in state " + fsm.getState()); } }
/** * Change the state of the specified finite state machine. * * @param fsm the finite state machine * @param sender the event sender * @param condition the condition * @param params the event parameters * @param newState the new state */ void changeState( FiniteStateMachineT fsm, Object sender, ConditionT condition, Params params, StateT newState) { fsm.setState(sender, condition, params, newState); }