29 * Description goes here 30 * 31 * @author Ken Cavanaugh 32 */ 33 public interface Action 34 { 35 /** Called by the state engine to perform an action 36 * before a state transition takes place. The FSM is 37 * passed so that the Action may set the next state in 38 * cases when that is required. FSM and Input together 39 * allow actions to be written that depend on the state and 40 * input, but this should generally be avoided, as the 41 * reason for a state machine in the first place is to cleanly 42 * separate the actions and control flow. Note that an 43 * action should complete in a timely manner. If the state machine 44 * is used for concurrency control with multiple threads, the 45 * action must not allow multiple threads to run simultaneously 46 * in the state machine, as the state could be corrupted. 47 * Any exception thrown by the Action for the transition 48 * will be propagated to doIt. 49 * @param FSM fsm is the state machine causing this action. 50 * @param Input in is the input that caused the transition. 51 */ 52 public void doIt( FSM fsm, Input in ) ; 53 } 54 55 // end of Action.java | 29 * Description goes here 30 * 31 * @author Ken Cavanaugh 32 */ 33 public interface Action 34 { 35 /** Called by the state engine to perform an action 36 * before a state transition takes place. The FSM is 37 * passed so that the Action may set the next state in 38 * cases when that is required. FSM and Input together 39 * allow actions to be written that depend on the state and 40 * input, but this should generally be avoided, as the 41 * reason for a state machine in the first place is to cleanly 42 * separate the actions and control flow. Note that an 43 * action should complete in a timely manner. If the state machine 44 * is used for concurrency control with multiple threads, the 45 * action must not allow multiple threads to run simultaneously 46 * in the state machine, as the state could be corrupted. 47 * Any exception thrown by the Action for the transition 48 * will be propagated to doIt. 49 * @param fsm the state machine causing this action. 50 * @param in the input that caused the transition. 51 */ 52 public void doIt( FSM fsm, Input in ) ; 53 } 54 55 // end of Action.java |