Esempio n. 1
0
 public InfectiousDiseaseDepartment(UInt32 LookoutCapacity, UInt32 DoctorsCount, UInt32 TotalCountOfPacients, UInt32 TimeSpeed)
 {
     this._RandomSource     = new Random();
     this.LookoutCapacity   = LookoutCapacity;
     this.PatientsLeftCount = TotalCountOfPacients;
     this._Lookout          = new List <Patient>();
     this._Queue            = new List <Patient>();
     this._Doctors          = new Doctor[DoctorsCount];
     for (var Index = 0; Index < DoctorsCount; Index++)
     {
         _Doctors[Index] = HumanFactory.SpawnDoctor();
         _Doctors[Index].FinishedAppointment += OnDoctorFinishedAppointment;
         _Doctors[Index].RequiredAssistance  += OnDoctorRequiresAssistance;
     }
     #region Initializing timers
     _EnqueueTimer               = new System.Timers.Timer(TimeSpeed);
     _EnqueueTimer.Elapsed      += new ElapsedEventHandler(OnEnqueueTimerElapsed);
     _AddToLookoutTimer          = new System.Timers.Timer(TimeSpeed);
     _AddToLookoutTimer.Elapsed += new ElapsedEventHandler(OnAddToLookoutTimerElapsed);
     _InfectQueueTimer           = new System.Timers.Timer(TimeSpeed);
     _InfectQueueTimer.Elapsed  += new ElapsedEventHandler(OnInfectQueueTimerElapsed);
     #endregion
     #region Initializing mutexes
     _QueueLocker        = new Mutex();
     _LookoutLocker      = new Mutex();
     _HistoryLocker      = new Mutex();
     _RandomSourceLocker = new Mutex();
     #endregion
 }