/** Transition to the next state given the name of a valid transition. * @param actionName - the name of transition that is valid for the * current state. * @return the next state * @throws IllegalTransitionException */ public State nextState(String actionName) throws IllegalTransitionException { Transition t = currentState.getTransition(actionName); if( t == null ) { String msg = "No transition for action: '" + actionName + "' from state: '" + currentState.getName() + "'"; throw new IllegalTransitionException(msg); } State nextState = t.getTarget(); log.trace("nextState("+actionName+") = "+nextState); currentState = nextState; return currentState; }