1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- /*===============================================================================
- * PseudoState
- *
- * Change history
- * When Who Comment
- * ---------- ------ ------------------------------------
- * 2006-07-18 RMa Changed transition handling.
- * 2006-02-03 RMa FXCop updates: protected methods.
- * 2006-01-27 RMa Removed interface Event. Use Event class instead.
- * 2005-12-05 RMa This header added.
- *
- ---------------------------------------------------------------------------------*/
- namespace Wayne.Lib.StateEngine
- {
- /// <summary>
- /// A pseudo state is a state that can be entered, but it must transition directly.
- /// The state machine can not stay in this state,but must continue directly. Therefore
- /// the Enter, and exit methods are sealed and can not be overriden. Insted, the abstract method CreatePseudoStateTransition method
- /// must be overriden. It receives the entry information and must return a transition direclty.
- /// The pseudo state can be used to implement choce states, and is the base class for initial states.
- /// </summary>
- abstract public class PseudoState : State
- {
- #region Sealed Methods
- /// <summary>
- /// The Exit method may not be used in a Pseudo state.
- /// It must transition directly after enter.
- /// </summary>
- protected sealed override void Enter(StateEntry stateEntry, ref Transition transition)
- {
- base.Enter(stateEntry, ref transition);
- transition = this.CreatePseudoStateTransition(stateEntry);
- }
- /// <summary>
- /// The Exit method may not be used in a Pseudo state.
- /// It must transition directly after enter.
- /// </summary>
- protected override sealed void Exit()
- {
- base.Exit();
- }
-
- #endregion
- #region Abstract Methods
- /// <summary>
- /// The CreatePseudoStateTransition method must be overriden. It receives the state
- /// entry, and must make a new transition directly.
- /// </summary>
- /// <param name="stateEntry"></param>
- /// <returns></returns>
- protected abstract Transition CreatePseudoStateTransition(StateEntry stateEntry);
- #endregion
- }
- /// <summary>
- /// Initial state is the first state to be entered in a state machine. There should only be one initial state, and
- /// the state engine automatically enters that state at startup. It is a pseudo state so it must direclty transition to
- /// another state.
- ///
- /// The class does not introduce any new behaviour from pseudostate, but marks that it is an intial state.
- /// </summary>
- abstract public class InitialState : PseudoState
- {
- }
- }
|