Exemplo n.º 1
0
        internal static SimulationTimeSpan Intersection(SimulationTimeSpan a, SimulationTimeSpan b)
        {
            Hour start = Hour.Max(a.Start, b.Start);
            Hour end   = Hour.Min(a.End, b.End);

            if (start > end)
            {
                return(null);
            }
            return(new SimulationTimeSpan(start, end));
        }
Exemplo n.º 2
0
        private static Dictionary <Hour, int> __scheduleArrivals(int arrivalsPerMonth, int lengthInHours)
        {
            Dictionary <Hour, int> schedule = new Dictionary <Hour, int>();
            SimulationTimeSpan     timespan = new SimulationTimeSpan(new Hour(0), new Hour(lengthInHours - 1));

            Hour hour = new Hour(0);

            while (hour <= timespan.End)
            {
                schedule[hour] = arrivalsPerMonth;
                hour           = hour.FirstHourOfNextMonth();
            }

            return(schedule);
        }
Exemplo n.º 3
0
        internal Simulation(
            int lengthInHours,
            BoardParameters boardParameters,
            int minimumDaysBetweenOP,
            int initialCaseCount,
            Dictionary <Hour, int> arriving)
        {
            OPSchedule opSchedule = new SimpleOPScheduler(minimumDaysBetweenOP);
            Registrar  registrar  = new Registrar(opSchedule);

            _board         = boardParameters.MakeBoard(registrar);
            _timeSpan      = new SimulationTimeSpan(new Hour(0), new Hour(lengthInHours - 1));
            _reports       = new HourlyReports();
            _arrivingCases = arriving;

            _assembleInitialCases(initialCaseCount);
        }