/// <summary> /// Initializes a new instance of FunctionState /// </summary> /// <param name="stateName">The zero-based index of the state</param> /// <param name="isAccept">Indicates if the state is an accept state of the state machine</param> /// <param name="stateFunction">SMStateFuncion delegate which points to the method /// to be executed as state function of the state machine</param> /// <param name="stateFunctionParameters">The parameters to be pased to the state function</param> public EnumeratedFunctionState(T stateName, SMEnumeratedStateFuncion <T> stateFunction, bool isAccept, object stateFunctionParameters) { if (!typeof(T).IsEnum) { throw new Exception("This class must be implemented only with enumerations"); } this.isAcceptState = isAccept; if (this.StateNumber < 0) { throw new ArgumentOutOfRangeException("Parameter stateNumber must be greater or equal than zero"); } this.stateName = stateName; if (stateFunction == null) { throw new ArgumentNullException(); } this.stateFunction = stateFunction; this.stateFunctionParameters = stateFunctionParameters; }
/// <summary> /// Initializes a new instance of FunctionState /// </summary> /// <param name="stateName">The zero-based index of the state</param> /// <param name="isAccept">Indicates if the state is an accept state of the state machine</param> /// <param name="stateFunction">SMStateFuncion delegate which points to the method /// to be executed as state function of the state machine</param> public EnumeratedFunctionState(T stateName, SMEnumeratedStateFuncion <T> stateFunction, bool isAccept) : this(stateName, stateFunction, isAccept, null) { }
/// <summary> /// Initializes a new instance of FunctionState /// </summary> /// <param name="stateName">The zero-based index of the state</param> /// <param name="stateFunction">SMStateFuncion delegate which points to the method /// to be executed as state function of the state machine</param> /// <param name="stateFunctionParameters">The parameters to be pased to the state function</param> public EnumeratedFunctionState(T stateName, SMEnumeratedStateFuncion <T> stateFunction, object stateFunctionParameters) : this(stateName, stateFunction, false, stateFunctionParameters) { }
/// <summary> /// Initializes a new instance of FunctionState /// </summary> /// <param name="stateName">The zero-based index of the state</param> /// <param name="stateFunction">SMStateFuncion delegate which points to the method /// to be executed as state function of the state machine</param> public EnumeratedFunctionState(T stateName, SMEnumeratedStateFuncion <T> stateFunction) : this(stateName, stateFunction, false, null) { }