Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private AllocatedCase _allocateCase(AppealCase appealCase, Hour currentHour)
        {
            Member chair;
            Member rapporteur;
            Member other;

            chair      = _allocateChair();
            rapporteur = _allocateRapporteur(chair);
            other      = _allocateOtherMember(chair, rapporteur);

            return(new AllocatedCase(
                       appealCase,
                       new CaseBoard(chair, rapporteur, other, _registrar),
                       currentHour));
        }
Ejemplo n.º 3
0
        internal void SetFinish(Hour currentHour)
        {
            if (Enqueue == null)
            {
                throw new InvalidOperationException("Cannot set Finish before setting Enqueue.");
            }
            if (Start == null)
            {
                throw new InvalidOperationException("Cannot set Finish before setting Start.");
            }
            if (Finish != null)
            {
                throw new InvalidOperationException("Finish can only be set once.");
            }

            Finish = currentHour;
        }
Ejemplo n.º 4
0
        internal void Enqueue(Hour currentHour, AllocatedCase ac)
        {
            switch (ac.Stage)
            {
            case CaseStage.Summons:
                _summonsQueue.Enqueue(currentHour, ac);
                break;

            case CaseStage.Decision:
                _decisionQueue.Enqueue(currentHour, ac);
                break;

            case CaseStage.OP:
            case CaseStage.Finished:
            case CaseStage.Undefined:
                throw new InvalidOperationException("Appeal is not in Summons or Decision stage.");
            }
        }
Ejemplo n.º 5
0
        internal void DoWork(Hour currentHour)
        {
            _incoming.EnqueueForNextStage(currentHour);
            _opSchedule.UpdateSchedule(currentHour);

            foreach (AllocatedCase startedCase in _opSchedule.StartedCases)
            {
                startedCase.RecordOPStart(currentHour);
            }

            foreach (AllocatedCase finishedCase in  _opSchedule.FinishedCases)
            {
                finishedCase.RecordOPFinished(currentHour);
                finishedCase.EnqueueForWork(currentHour);
            }

            _circulation.EnqueueForNextStage(currentHour);
        }
Ejemplo n.º 6
0
        internal override BoardReport DoWork(Hour currentHour)
        {
            BoardReport boardReport = new BoardReport(_members);

            _registrar.DoWork(currentHour);

            foreach (Member member in _members)
            {
                //working
                AllocatedCase currentCase = _registrar.GetCurrentCase(currentHour, member);
                WorkReport    report      = _memberWork(currentHour, currentCase, member);
                boardReport.Add(member, report);

                //boardReport.Add(member, _memberWork(currentHour, member));
            }

            return(boardReport);
        }
Ejemplo n.º 7
0
        //working
        // used only in
        //  AllocatedCase.DoWorkAndMakeReport
        //  RecordFinishedWork (unsed)
        internal void RecordFinishedWork(WorkerRole role, Hour currentHour)
        {
            switch (Stage)
            {
            case CaseStage.Summons:
                SetSummonsFinish(role, currentHour);
                break;

            case CaseStage.Decision:
                SetDecisionFinish(role, currentHour);
                break;

            case CaseStage.OP:
                SetOPFinished(currentHour);
                break;

            default:
                throw new InvalidOperationException("CaseRecord.Recordwork: there is no work to do.");
            }
        }
Ejemplo n.º 8
0
        //working
        //  used only in AllocatedCase.EnqueueForWork
        internal void RecordEnqueuedForWork(WorkerRole role, Hour currentHour)
        {
            switch (Stage)
            {
            case CaseStage.Summons:
                SetSummonsEnqueue(role, currentHour);
                break;

            case CaseStage.Decision:
                SetDecisionEnqueue(role, currentHour);
                break;

            case CaseStage.OP:
                SetOPEnqueue(currentHour);
                break;

            default:
                throw new InvalidOperationException("CaseRecord.EnqueueForWork: Case is not in Summons or Decision stage.");
            }
        }
Ejemplo n.º 9
0
        //working
        // used only in
        //  AllocatedCase.RecordStartOfWork (unused)
        //  AllocatedCase._setNewWorker (used)
        internal void RecordStartOfWork(WorkerRole role, Hour currentHour)
        {
            switch (Stage)
            {
            case CaseStage.Summons:
                SetSummonsStart(role, currentHour);
                break;

            case CaseStage.Decision:
                SetDecisionStart(role, currentHour);
                break;

            case CaseStage.OP:
                SetOPStart(currentHour);
                break;

            default:
                throw new InvalidOperationException("CaseRecord.RecordStartOfWork: no summons or decision work to start.");
            }
        }
Ejemplo n.º 10
0
        internal WorkerRole EnqueueForNextWorker(Hour currentHour, AllocatedCase allocatedCase)
        {
            CaseWorker nextWorker = null;

            if (_workerQueues[CaseStage.Summons].Count > 0)
            {
                nextWorker = _workerQueues[CaseStage.Summons].Dequeue();
            }
            else if (_workerQueues[CaseStage.Decision].Count > 0)
            {
                nextWorker = _workerQueues[CaseStage.Decision].Dequeue();
            }

            if (nextWorker == null)
            {
                return(WorkerRole.None);
            }

            _registrar.EnqueueForWorker(currentHour, nextWorker, allocatedCase);
            return(nextWorker.Role);
        }
Ejemplo n.º 11
0
 internal override void AddToCirculationQueue(AllocatedCase allocatedCase, Hour currentHour)
 {
     _registrar.AddToCirculation(currentHour, allocatedCase);
 }
Ejemplo n.º 12
0
 internal void SetDecisionFinish(WorkerRole role, Hour currentHour) //ok
 {
     _decisionRecords[role].SetFinish(currentHour);
 }
Ejemplo n.º 13
0
 internal abstract bool IsBlocked(Hour hour, Member member);
Ejemplo n.º 14
0
 internal abstract void UpdateSchedule(Hour currentHour);
Ejemplo n.º 15
0
 internal abstract void Schedule(Hour currentHour, AllocatedCase allocatedCase);
Ejemplo n.º 16
0
 internal abstract AllocatedCase GetOPWork(Hour hour, Member member);
Ejemplo n.º 17
0
 internal void SetDecisionStart(WorkerRole role, Hour currentHour) //ok
 {
     _decisionRecords[role].SetStart(currentHour);
 }
Ejemplo n.º 18
0
 internal abstract BoardReport DoWork(Hour currentHour);
Ejemplo n.º 19
0
 internal void Enqueue(Hour hour, AllocatedCase t)
 {
     _queue.Enqueue(t);
     _timeOfEnqueuing[t] = hour;
 }
Ejemplo n.º 20
0
 internal void Enqueue(Hour currentHour, AllocatedCase ac, WorkerRole role)
 {
     _queues[role].Enqueue(currentHour, ac);
 }
Ejemplo n.º 21
0
 internal void SetOPFinished(Hour currentHour) //ok
 {
     OP.SetFinish(currentHour);
 }
Ejemplo n.º 22
0
 internal void ScheduleOP(Hour currentHour, AllocatedCase allocatedCase)
 {
     _registrar.ScheduleOP(currentHour, allocatedCase);
 }
Ejemplo n.º 23
0
 internal abstract AllocatedCase ProcessNewCase(AppealCase appealCase, Hour currentHour);
Ejemplo n.º 24
0
 internal BoardReport Read(Hour hour)
 {
     return(_reports[hour]);
 }
Ejemplo n.º 25
0
 internal abstract void AddToCirculationQueue(AllocatedCase allocatedCase, Hour currentHour);
Ejemplo n.º 26
0
 internal void SetDecisionEnqueue(WorkerRole role, Hour currentHour) //ok
 {
     _decisionRecords[role].SetEnqueue(currentHour);
 }
Ejemplo n.º 27
0
 internal void Enqueue(Hour currentHour, AllocatedCase allocatedCase)
 {
     _queue.Enqueue(currentHour, allocatedCase);
 }
Ejemplo n.º 28
0
 internal abstract void Add(Hour hour, AllocatedCase allocatedCase);
Ejemplo n.º 29
0
 internal void EnqueueForMember(Hour currentHour, CaseWorker worker, AllocatedCase allocatedCase)
 {
     _checkMemberIsRegistered(worker.Member);
     _memberQueues[worker.Member].Enqueue(currentHour, allocatedCase, worker.Role);
 }
Ejemplo n.º 30
0
 internal abstract bool HasOPWork(Hour hour, Member member);