public PlainStateBehaviourScheduler(IPlainStateMachine <TState, TTrigger> stateMachine,
                                     PlainStateCollection <TState, TTrigger> stateCollection, PlainTransitionCollection <TState, TTrigger> transitionCollection,
                                     PlainTransitionValidator <TState, TTrigger> transitionValidator,
                                     IEqualityComparer <TState> stateComparer, IEqualityComparer <TTrigger> triggerComparer)
 {
     _stateComparer       = stateComparer;
     _triggerComparer     = triggerComparer;
     _stateMachine        = stateMachine;
     _states              = stateCollection;
     _transitions         = transitionCollection;
     _transitionValidator = transitionValidator;
 }
示例#2
0
        public PlainStateMachine(IEqualityComparer <TState> stateComparer, IEqualityComparer <TTrigger> triggerComparer)
        {
            if (stateComparer == null)
            {
                throw new ArgumentNullException(nameof(stateComparer));
            }
            if (triggerComparer == null)
            {
                throw new ArgumentNullException(nameof(triggerComparer));
            }

            _stateComparer   = new StateEqualityComparer(stateComparer);
            _triggerComparer = new TriggerEqualityComparer(triggerComparer);

            _transitionComparer = new TransitionEqualityComparer <TState, TTrigger>(_stateComparer, _triggerComparer);

            _states = new PlainStateCollection <TState, TTrigger>(this, _stateComparer);
            _transitionValidator     = new PlainTransitionValidator <TState, TTrigger>(this, _transitionComparer);
            _transitions             = new PlainTransitionCollection <TState, TTrigger>(this, _stateComparer, _transitionComparer);
            _stateBehaviourScheduler = new PlainStateBehaviourScheduler <TState, TTrigger>(this, _states, _transitions, _transitionValidator, _stateComparer, _triggerComparer);
            _eventHandlers           = new PlainStateEventHandlerCollection <TState, TTrigger>(this, _stateComparer);
            _eventDispatcher         = new PlainEventDispatcher <TState, TTrigger>(_eventHandlers, _stateBehaviourScheduler);
        }