示例#1
0
        /// <summary>
        /// This will represent the passing of an arbitrary slice of time. The "real time" duration of it is not important, its duration could be decreased or increased
        /// to make the simulation proceed more quickly or more slowly.
        /// </summary>
        public StateTransition RegisterPassageOfTime()
        {
            if (_timeSlicesToWaitFor == 1)
            {
                return(_nextState);
            }

            return(StateTransition.Replace(
                       new TimeBasedTransitiveState(Colour, Status, _timeSlicesToWaitFor - 1, _nextState)
                       ));
        }
示例#2
0
        public TimeBasedTransitiveState(ColourOptions colour, StatusOptions status, int timeSlicesToWaitFor, StateTransition nextTransition)
        {
            if (!Enum.IsDefined(typeof(ColourOptions), colour))
            {
                throw new ArgumentOutOfRangeException("colour");
            }
            if (!Enum.IsDefined(typeof(StatusOptions), status))
            {
                throw new ArgumentOutOfRangeException("status");
            }
            if (timeSlicesToWaitFor <= 0)
            {
                throw new ArgumentOutOfRangeException("timeSlicesToWaitFor");
            }
            if (nextTransition == null)
            {
                throw new ArgumentNullException("nextTransition");
            }

            Colour = colour;
            Status = status;
            _timeSlicesToWaitFor = timeSlicesToWaitFor;
            _nextState           = nextTransition;
        }
示例#3
0
 public StateTransition RegisterCarQueueing()
 {
     return(StateTransition.NoChange());
 }