예제 #1
0
        //--------------------------------------------------------------------------------------------------
        // Constructor
        //--------------------------------------------------------------------------------------------------

        #region Constructor

        /// <summary>
        /// Basic constructor
        /// </summary>
        /// <param name="parentTimeLine"></param>
        /// <param name="config"></param>
        /// <param name="date"></param>
        public TimeAtom(SinglePerDayTimeLine parentTimeLine,
                        TimeAtomConfig config,
                        DateTime date)
        {
            _parentTimeLine = parentTimeLine;
            _startTime      = date.Date + TimeSpan.FromHours(config.StartTime);
            _endTime        = date.Date + TimeSpan.FromHours(config.EndTime);
            _slotsAtTime    = new List <Slot>();
            _blocked        = config.Blocked;
            _maxCapacity    = config.MaxCapacity;
            _nonBookable    = config.NonStartBookable;
        } // end of TimeAtom
예제 #2
0
파일: Slot.cs 프로젝트: jcol27/HCDESLib
        //--------------------------------------------------------------------------------------------------
        // Constructor
        //--------------------------------------------------------------------------------------------------

        #region Constructor

        /// <summary>
        /// Basic constructor
        /// </summary>
        /// <param name="parentTimeLine">Time line that the slot is hosted by</param>
        /// <param name="startTimeAtom">Start atom of the slot</param>
        /// <param name="coveredAtoms">All time atoms covered by the slot</param>
        /// <param name="endTime">End time of the slot</param>
        /// <param name="capacity">Capacity consumed by the slot</param>
        /// <param name="type">Type of slot</param>
        public Slot(SinglePerDayTimeLine parentTimeLine,
                    TimeAtom startTimeAtom,
                    TimeAtom[] coveredAtoms,
                    DateTime endTime,
                    double capacity,
                    string type)
        {
            _parentTimeLine = parentTimeLine;
            _startTimeAtom  = startTimeAtom;
            _startTime      = startTimeAtom.StartTime;
            _coveredAtoms   = coveredAtoms;
            _endTime        = endTime;
            _capacity       = capacity;
            _type           = type;
            _immediate      = false;
        } // end of Slot
예제 #3
0
        } // end of GeneralBookingModel

        #endregion

        #region Initialize

        /// <summary>
        /// Initialization of the booking model, the time lines are filled with the minimum number
        /// </summary>
        /// <param name="startTime">Start time of the booking model</param>
        public void Initialize(DateTime startTime)
        {
            _currentStartTime = startTime;

            DateTime currentTime = startTime;

            SinglePerDayTimeLine currentTimeLine = TimeLineConfiguration.GetFirstTimeLine(currentTime);

            _timeLines.Add(currentTimeLine);

            while (TimeLines.Count < MinimumActiveTimeLinesKept)
            {
                currentTimeLine = TimeLineConfiguration.GetNextTimeLine(currentTimeLine);
                _timeLines.Add(currentTimeLine);
            } // end while
            _currentEndTime = TimeLines.Last().EndTime;
        }     // end of Initialize
예제 #4
0
        } // end of GetFirstTimeLine

        #endregion

        #region GetNextTimeLine

        /// <summary>
        /// The next time line, counted from the last time line held in a booking model
        /// </summary>
        /// <param name="lastTimeLine">The last time line</param>
        /// <returns>Next time line on a day that is specified and not blocked</returns>
        public SinglePerDayTimeLine GetNextTimeLine(SinglePerDayTimeLine lastTimeLine)
        {
            DateTime nextDate = lastTimeLine.StartTime.Date + TimeSpan.FromDays(1);

            return(GetFirstTimeLine(nextDate));
        } // end of GetNextTimeLine
예제 #5
0
        } // end of TimeLineConstraints

        #endregion

        #region ConstraintsWithinTimeLine

        /// <summary>
        /// Method that defines constraints within a single time line, e.g. booking of different types to be
        /// balanced
        /// </summary>
        /// <param name="request">Request to be booked</param>
        /// <param name="timeLine">Time line for the booking</param>
        /// <param name="atom">Atom to be used as a start atom for a slot</param>
        /// <returns></returns>
        virtual public bool ConstraintsWithinTimeLine(SlotRequest request, SinglePerDayTimeLine timeLine, TimeAtom atom)
        {
            return(true);
        } // end of ConstraintsWithinTimeLine
예제 #6
0
        } // end of CancelSlot

        #endregion

        //--------------------------------------------------------------------------------------------------
        // Constraints
        //--------------------------------------------------------------------------------------------------

        #region TimeLineConstraints

        /// <summary>
        /// This method my be overwritten to specify constraints on time lines and requests, e.g. certain bookings
        /// only on specific days
        /// </summary>
        /// <param name="request"></param>
        /// <param name="timeLine"></param>
        /// <returns></returns>
        virtual public bool TimeLineConstraints(SlotRequest request, SinglePerDayTimeLine timeLine)
        {
            return(true);
        } // end of TimeLineConstraints