private void _scheduleOP(TechnicalMember rapporteur) { uint startDay = _getOPStartDay(); OP op = new OP(_chair, rapporteur, startDay, _opDuration); _opQueue.Enqueue(op); }
public OP(Chair ch, TechnicalMember rapporteur, uint startDay, uint duration) { _chair = ch; _rapporteur = rapporteur; _startDay = startDay; _endDay = startDay + duration / Board.__HoursPerDay; _startHour = startDay * Board.__HoursPerDay; _endHour = _startHour + duration - 1; }
public Board(Chair ch, TechnicalMember m) { _hour = 0; _totalHours = __simulationWeeks * __daysPerWeek * __hoursPerDay; _reportLog = new List <BoardWorkReport>(); _opQueue = new Queue <OP>(); _chair = ch; _technicalMembers = new List <TechnicalMember>(); _technicalMembers.Add(m); _chairSummonsHours = ch.SummonsHours; _chairDecisionHours = ch.DecisionHours; _memberSummonsHours = m.SummonsHours; _memberDecisionHours = m.DecisionHours; }
protected Decision(TechnicalMember m, uint workhours) : base(m, workhours) { }
public Decision(TechnicalMember m) : base(m) { }
protected Summons(TechnicalMember m, uint workhours) : base(m, workhours) { }
public Summons(TechnicalMember m) : base(m) { }
protected Work(TechnicalMember m, uint workhours) { _rapporteur = m; _workHours = workhours; }
public Work(TechnicalMember m) { _rapporteur = m; _workHours = 0; }
private void _work() { OPScheduled = false; // see if anyone is busy with op prepration of the op itself bool chairBusyWithOP; bool rapporteurBusyWithOP; TechnicalMember opRapporteur; if (_opQueue.Count > 0) { OP op = _opQueue.Peek(); chairBusyWithOP = op.ChairIsBusy(_hour); rapporteurBusyWithOP = op.RapporteurIsbusy(_hour); if (rapporteurBusyWithOP) { opRapporteur = op.Rapporteur; } else { opRapporteur = null; } } else { chairBusyWithOP = false; rapporteurBusyWithOP = false; opRapporteur = null; } // make sure each tech member has a summons to work on foreach (TechnicalMember m in _technicalMembers) { if (m.SummonsQueueIsEmpty) { m.EnqueueSummons(new Summons(m), _hour); } } // chair and each tech member works if (chairBusyWithOP) { _chair.DoOPWork(); } else { _chair.Work(); } foreach (TechnicalMember m in _technicalMembers) { if (opRapporteur == m) { m.DoOPWork(); } else { m.Work(); } } // process chair output if (!chairBusyWithOP) { switch (_chair.OutputType) { case OutputTypes.Summons: _scheduleOP(_chair.Output.Rapporteur); OPScheduled = true; break; case OutputTypes.Decision: break; case OutputTypes.Nothing: break; } } //process member outputs foreach (TechnicalMember m in _technicalMembers) { if (!(opRapporteur == m)) { switch (m.OutputType) { case Board.OutputTypes.Summons: _chair.EnqueueSummons(m.Output as Summons, _hour); break; case Board.OutputTypes.Decision: _chair.EnqueueDecision(m.Output as Decision, _hour); break; case Board.OutputTypes.Nothing: break; } } } // if OP is finished, dequeue it and push a decision onto the member's queue if (_opQueue.Count > 0) { if (_opQueue.Peek().IsOver(_hour)) { TechnicalMember member = _opQueue.Peek().Rapporteur; member.EnqueueDecision(new Decision(member), _hour); _opQueue.Dequeue(); } } // if OP has been scheduled, keep track of the time it is scheduled for if (OPScheduled) { OPScheduledForDay = _opQueue.Last().StartDay; } else { OPScheduledForDay = 0; } }
public TechniclMemberReport(TechnicalMember m) : base(m) { }