/*===============================================================================
* 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
{
///
/// 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.
///
abstract public class PseudoState : State
{
#region Sealed Methods
///
/// The Exit method may not be used in a Pseudo state.
/// It must transition directly after enter.
///
protected sealed override void Enter(StateEntry stateEntry, ref Transition transition)
{
base.Enter(stateEntry, ref transition);
transition = this.CreatePseudoStateTransition(stateEntry);
}
///
/// The Exit method may not be used in a Pseudo state.
/// It must transition directly after enter.
///
protected override sealed void Exit()
{
base.Exit();
}
#endregion
#region Abstract Methods
///
/// The CreatePseudoStateTransition method must be overriden. It receives the state
/// entry, and must make a new transition directly.
///
///
///
protected abstract Transition CreatePseudoStateTransition(StateEntry stateEntry);
#endregion
}
///
/// 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.
///
abstract public class InitialState : PseudoState
{
}
}