コード例 #1
0
        internal void RegisterOP(AppealCase ac, Hour opStartHour, Hour opEndHour)
        {
            Hour start = opStartHour.Subtract(OPPREPARATIONHOURS);
            Hour end   = opEndHour;

            _opTimes.Add(ac, new SimulationTimeSpan(start, end));
        }
コード例 #2
0
 private void _getNextCase()
 {
     if (_chairQueue.Count > 0)
     {
         _currentCase = _chairQueue.Dequeue();
         _currentRole = Work.WorkRole.Chair;
         _initialiseCase();
         return;
     }
     if (_otherQueue.Count > 0)
     {
         _currentCase = _otherQueue.Dequeue();
         _currentRole = Work.WorkRole.Other;
         _initialiseCase();
         return;
     }
     if (_rapporteurQueue.Count > 0)
     {
         _currentCase = _rapporteurQueue.Dequeue();
         _currentRole = Work.WorkRole.Rapporteur;
         _initialiseCase();
         return;
     }
     _currentCase = null;
 }
コード例 #3
0
ファイル: CaseQueue.cs プロジェクト: pscrv/BoardSimulator
        internal void Enqueue(AppealCase appealCase)
        {
            if (appealCase.Stage == AppealCaseState.Stage.New)
            {
                appealCase.AdvanceState();
            }

            switch (appealCase.Stage)
            {
            case AppealCaseState.Stage.SummonsEnqueued:
            case AppealCaseState.Stage.SummonsStarted:
            case AppealCaseState.Stage.SummonsFinished:
                _summonsQueue.Enqueue(appealCase);
                break;

            case AppealCaseState.Stage.DecisionEnqueued:
            case AppealCaseState.Stage.DecisionStarted:
            case AppealCaseState.Stage.DecisionFinished:
                _decisionQueue.Enqueue(appealCase);
                break;

            default:
                throw new InvalidOperationException("Appeal is not in Summons or Decision stage.");
            }
        }
コード例 #4
0
ファイル: Allocation.cs プロジェクト: pscrv/BoardSimulator
 internal void NotifyOPSchedule(AppealCase ac, Hour opStartHour, Hour opEndHour)
 {
     foreach (Member member in _allocatedBoard)
     {
         member.RegisterOP(ac, opStartHour, opEndHour);
     }
 }
コード例 #5
0
        internal WorkReport DoWork()
        {
            AppealCase opCase = _opTimes.OPScheduledForCurrentHour;

            if (opCase != null)
            {
                return(new OPWorkReport(opCase));
            }


            if (_currentCase == null)
            {
                _getNextCase();
            }
            if (_currentCase == null)
            {
                return(new NullWorkReport());
            }

            _workCase();

            WorkReport report;

            if (_workCounter == 0)
            {
                report       = new WorkReport(_currentCase, _currentWorkType, _currentRole, Work.WorkState.Finished);
                _currentCase = null;
            }
            else
            {
                report = new WorkReport(_currentCase, _currentWorkType, _currentRole, Work.WorkState.Ongoing);
            }
            return(report);
        }
コード例 #6
0
ファイル: Board.cs プロジェクト: pscrv/BoardSimulator
        private Hour _scheduleOP(AppealCase appealCase)
        {
            // TODO: make a proper scheduler
            Hour startHour = SimulationTime.Future(OPLEADTIME);

            _scheduledOPs[appealCase] = startHour;
            return(startHour);
        }
コード例 #7
0
ファイル: Board.cs プロジェクト: pscrv/BoardSimulator
 private void _processIncomingCases()
 {
     while (_incomingCases.Count > 0)
     {
         AppealCase appealCase  = _incomingCases.Dequeue();
         Allocation allocation  = _allocate(appealCase);
         Member     firstWorker = allocation.Enqueue(appealCase);
         _activeCases[appealCase] = allocation;
     }
 }
コード例 #8
0
        internal Member()
        {
            _rapporteurQueue = new CaseQueuePair();
            _chairQueue      = new CaseQueuePair();
            _otherQueue      = new CaseQueuePair();
            _opTimes         = new OPList();

            _currentCase = null;
            _workCounter = 0;
        }
コード例 #9
0
ファイル: Board.cs プロジェクト: pscrv/BoardSimulator
        private void _processCirculatingCases()
        {
            while (_circulatingCases.Count > 0)
            {
                AppealCase appealCase = _circulatingCases.Dequeue();
                Allocation allocation = _activeCases[appealCase];
                Member     nextWorker = allocation.Enqueue(appealCase);

                if (nextWorker == null)
                {
                    appealCase.AdvanceState();
                    Hour opStartHour = _scheduleOP(appealCase);
                    Hour opEndHour   = opStartHour.Add(OPDURATION);
                    allocation.NotifyOPSchedule(appealCase, opStartHour, opEndHour);
                }
            }
        }
コード例 #10
0
ファイル: Board.cs プロジェクト: pscrv/BoardSimulator
        internal BoardLog DoWork()
        {
            _processCirculatingCases();
            _processIncomingCases();

            BoardLog log = new BoardLog();

            foreach (Member m in _members())
            {
                WorkReport report = m.DoWork();
                log.Add(m, report);

                if (report.State == Work.WorkState.Finished)
                {
                    AppealCase appealCase = report.Case;
                    _circulatingCases.Enqueue(appealCase);
                }
            }

            return(log);
        }
コード例 #11
0
ファイル: Allocation.cs プロジェクト: pscrv/BoardSimulator
        internal Member Enqueue(AppealCase appealCase)
        {
            switch (appealCase.Stage)
            {
            case AppealCaseState.Stage.New:
                appealCase.AdvanceState();
                break;

            case AppealCaseState.Stage.SummonsEnqueued:
                appealCase.AdvanceState();
                break;

            case AppealCaseState.Stage.SummonsStarted:
                break;

            case AppealCaseState.Stage.SummonsFinished:
                break;

            case AppealCaseState.Stage.OPPending:
                break;

            case AppealCaseState.Stage.OPFinsished:
                break;

            case AppealCaseState.Stage.DecisionEnqueued:
                break;

            case AppealCaseState.Stage.DecisionStarted:
                break;

            case AppealCaseState.Stage.DecisionFinished:
                break;

            default:
                break;
            }



            if (_allocatedBoard.SummonsWorkerCount == 0)
            {
                return(null);
            }

            Member member = _allocatedBoard.DequeueSummonsWorker();

            switch (_allocatedBoard.SummonsWorkerCount)
            {
            case 2:
                member.EnqueueRapporteurWork(appealCase);
                break;

            case 1:
                member.EnqueueOtherWork(appealCase);
                break;

            case 0:
                member.EnqueueChairWork(appealCase);
                break;

            default:
                throw new InvalidOperationException("Something is wrong with the number of summons workers.");
            }

            return(member);
        }
コード例 #12
0
 internal void EnqueueRapporteurWork(AppealCase appealCase)
 {
     _rapporteurQueue.Enqueue(appealCase);
 }
コード例 #13
0
ファイル: Board.cs プロジェクト: pscrv/BoardSimulator
 internal void EnqueueNewCase(AppealCase appealCase)
 {
     _incomingCases.Enqueue(appealCase);
 }
コード例 #14
0
ファイル: Board.cs プロジェクト: pscrv/BoardSimulator
 private Allocation _allocate(AppealCase appealCase)
 {
     // TODO: make a proper allocation
     return(new Allocation(_chair, _technical[0], _legal[0]));
 }
コード例 #15
0
 internal void EnqueueChairWork(AppealCase appealCase)
 {
     _chairQueue.Enqueue(appealCase);
 }
コード例 #16
0
 internal void EnqueueOtherWork(AppealCase appealCase)
 {
     _otherQueue.Enqueue(appealCase);
 }
コード例 #17
0
ファイル: TimeSpanList.cs プロジェクト: pscrv/BoardSimulator
 internal void Add(AppealCase ac, SimulationTimeSpan span)
 {
     _opTimes.Add(span);
     _cases[span] = ac;
 }