Example #1
0
        public HierarchyBuilder(IStateDictionary <TState, TEvent> states, TState superStateId)
        {
            Ensure.ArgumentNotNull(states, "states");

            this.states     = states;
            this.superState = this.states[superStateId];
        }
Example #2
0
        public HierarchyBuilder(IStateDictionary <TState, TEvent> states, TState superStateId)
        {
            Guard.AgainstNullArgument("states", states);

            this.states     = states;
            this.superState = this.states[superStateId];
        }
Example #3
0
 public StateBehaviourBuilder(IState <TState, TInput> source, IStateDictionary <TState, TInput> states, IStateMachineContext <TState, TInput> context)
 {
     _source      = source;
     _states      = states;
     _context     = context;
     _transitions = new List <TransitionInfo>();
 }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StateMachine{TState,TEvent}"/> class.
        /// </summary>
        /// <param name="name">The name of this state machine used in log messages.</param>
        /// <param name="factory">The factory used to create internal instances.</param>
        public StateMachine(string name, IFactory <TState, TEvent> factory)
        {
            this.name       = name;
            this.factory    = factory ?? new StandardFactory <TState, TEvent>(this, this);
            this.states     = new StateDictionary <TState, TEvent>(this.factory);
            this.extensions = new List <IExtension <TState, TEvent> >();

            this.initialStateId = new Initializable <TState>();
        }
        public HierarchyBuilderTest()
        {
            this.superState = A.Fake <IState <string, int> >();
            A.CallTo(() => this.superState.Id).Returns(SuperState);
            this.states = A.Fake <IStateDictionary <string, int> >();
            A.CallTo(() => this.states[SuperState]).Returns(this.superState);

            this.testee = new HierarchyBuilder <string, int>(this.states, SuperState);
        }
        public HierarchyBuilderTest()
        {
            this.superState = A.Fake<IState<string, int>>();
            A.CallTo(() => this.superState.Id).Returns(SuperState);
            this.states = A.Fake<IStateDictionary<string, int>>();
            A.CallTo(() => this.states[SuperState]).Returns(this.superState);

            this.testee = new HierarchyBuilder<string, int>(this.states, SuperState);
        }
Example #7
0
 public StateMachine(string name, IStateMachineContext <TState, TInput> context)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     Name         = name;
     this.context = context;
     states       = new StateDictionary <TState, TInput>(this.context);
 }
Example #8
0
        public StateMachine(string name, IFactory <TState, TEvent> factory, Executer executer)
        {
            this.name = name;

            this.factory  = factory ?? new StandardFactory <TState, TEvent>(this);
            this.executer = executer;

            this.states         = new StateDictionary <TState, TEvent>(this.factory);
            this.currentStates  = new List <IState <TState, TEvent> >();
            this.initialStateId = new Initializable <TState>();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StateBuilder&lt;TState, TEvent&gt;"/> class.
 /// </summary>
 /// <param name="state">The state to build.</param>
 /// <param name="stateDictionary">The state dictionary of the state machine.</param>
 /// <param name="factory">The factory.</param>
 public StateBuilder(IState <TState, TEvent> state, IStateDictionary <TState, TEvent> stateDictionary, IFactory <TState, TEvent> factory)
 {
     this.state           = state;
     this.stateDictionary = stateDictionary;
     this.factory         = factory;
 }