public static StateEngine create() { return new StateEngineImpl(); } }
/** * Perform the transition for the given input in the current state. This proceeds as follows: * <p> * Let S be the current state of the FSM. If there are guarded actions for S with input in, evaluate their guards * successively until all have been evaluted, or one returns a non-DISABLED Result. * <ol> * <li>If a DEFERED result is returned, retry the input * <li>If a ENABLED result is returned, the action for the guarded action is the current action * <li>Otherwise there is no enabled action. If S has a default action and next state, use them; otherwise use the * state engine default action (the next state is always the current state). * </ol> * After the action is available, the transition proceeds as follows: * <ol> * <li>If the next state is not the current state, execute the current state postAction method. * <li>Execute the action. * <li>If the next state is not the current state, execute the next state preAction method. * <li>Set the current state to the next state. * </ol> */ public void doIt(Input in) { stateEngine.doIt(this, in, debug); }
public void done() throws IllegalStateException { mustBeInitializing(); // optimize FSM here if desired. For example, we could choose different strategies for implementing the state // transition function based on the distribution of values for states and input labels. initializing = false; }
nextState = getDefaultNextState(currentState); action = getDefaultAction(currentState); performStateTransition(fsm, in, nextState, action, debug);
public StateEngine setDefault(State oldState, State newState) throws IllegalArgumentException, IllegalStateException { return setDefault(oldState, emptyAction, newState); }
public FSM makeFSM(State startState) throws IllegalStateException { mustNotBeInitializing(); return new FSMImpl(this, startState); }
public void doIt(FSM fsm, Input in, boolean debug) { // This method is present only for debugging. // innerDoIt does the actual transition. if (debug) ORBUtility.dprint(this, "doIt enter: currentState = " + fsm.getState() + " in = " + in); try { innerDoIt(fsm, in, debug); } finally { if (debug) ORBUtility.dprint(this, "doIt exit"); } }
nextState = getDefaultNextState(currentState); action = getDefaultAction(currentState); performStateTransition(fsm, in, nextState, action, debug);
public StateEngine setDefault(State oldState) throws IllegalArgumentException, IllegalStateException { return setDefault(oldState, oldState); }
public FSM makeFSM(State startState) throws IllegalStateException { mustNotBeInitializing(); return new FSMImpl(this, startState); }
public void doIt(FSM fsm, Input in, boolean debug) { // This method is present only for debugging. // innerDoIt does the actual transition. if (debug) ORBUtility.dprint(this, "doIt enter: currentState = " + fsm.getState() + " in = " + in); try { innerDoIt(fsm, in, debug); } finally { if (debug) ORBUtility.dprint(this, "doIt exit"); } }
public void setDefaultAction(Action act) throws IllegalStateException { mustBeInitializing(); defaultAction = act; }
public StateEngine setDefault(State oldState, State newState) throws IllegalArgumentException, IllegalStateException { return setDefault(oldState, emptyAction, newState); }
public static StateEngine create() { return new StateEngineImpl(); } }
/** * Perform the transition for the given input in the current state. This proceeds as follows: * <p> * Let S be the current state of the FSM. If there are guarded actions for S with input in, evaluate their guards * successively until all have been evaluted, or one returns a non-DISABLED Result. * <ol> * <li>If a DEFERED result is returned, retry the input * <li>If a ENABLED result is returned, the action for the guarded action is the current action * <li>Otherwise there is no enabled action. If S has a default action and next state, use them; otherwise use the * state engine default action (the next state is always the current state). * </ol> * After the action is available, the transition proceeds as follows: * <ol> * <li>If the next state is not the current state, execute the current state postAction method. * <li>Execute the action. * <li>If the next state is not the current state, execute the next state preAction method. * <li>Set the current state to the next state. * </ol> */ public void doIt(Input in) { stateEngine.doIt(this, in, debug); }
public void setDefaultAction(Action act) throws IllegalStateException { mustBeInitializing(); defaultAction = act; }
public StateEngine setDefault(State oldState) throws IllegalArgumentException, IllegalStateException { return setDefault(oldState, oldState); }
public void done() throws IllegalStateException { mustBeInitializing(); // optimize FSM here if desired. For example, we could choose different strategies for implementing the state // transition function based on the distribution of values for states and input labels. initializing = false; }
public StateEngine add(State oldState, Input input, Action action, State newState) throws IllegalArgumentException, IllegalStateException { mustBeInitializing(); StateImpl oldStateImpl = (StateImpl) oldState; GuardedAction ta = new GuardedAction(action, newState); oldStateImpl.addGuardedAction(input, ta); return this; }
public StateEngine add(State oldState, Input input, Action action, State newState) throws IllegalArgumentException, IllegalStateException { mustBeInitializing(); StateImpl oldStateImpl = (StateImpl) oldState; GuardedAction ta = new GuardedAction(action, newState); oldStateImpl.addGuardedAction(input, ta); return this; }