Beispiel #1
0
        public PatientGenerator()
        {
            _hospitals   = MedWatchDAL.FindHospitals().ToList();
            _diseases    = MedWatchDAL.FindDiseases().ToList();
            _freeDoctors = new Dictionary <int, IList <int> >();
            _busyDoctors = new Dictionary <int, IList <int> >();
            _patientsTakenInChargeByDoctor = new List <IPatientTakenInChargeByDoctor>();
            _patientIds = new List <int>();
            _stopWatch  = new Stopwatch();

            // Assign doctors to each hospital
            foreach (var hospital in _hospitals)
            {
                var numberOfDoctors = hospital.AssignedDoctors;
                var doctorsList     = new List <int>(numberOfDoctors);
                for (var i = 0; i < numberOfDoctors; ++i)
                {
                    doctorsList.Add(GeneratorHelper.RandomNumericalValue(int.MaxValue));
                }
                _freeDoctors.Add(hospital.Id, doctorsList);
                _busyDoctors.Add(hospital.Id, new List <int>());
            }

            // Creates the patient arrival sorted dictionary
            _patientsArrival = new SortedDictionary <DiseasePriority, IList <IPatientArrival> >();
            for (var diseasePriority = DiseasePriority.VeryHigh; diseasePriority < DiseasePriority.Invalid; ++diseasePriority)
            {
                _patientsArrival.Add(diseasePriority, new List <IPatientArrival>());
            }
        }
Beispiel #2
0
        private static Dictionary <DiseaseType, Disease> InitDiseases()
        {
            var diseases = MedWatchDAL.FindDiseases();

            return(diseases.ToDictionary(d => d.Id));
        }