Пример #1
0
        private ScheduleOfRITEs BuildScheduleFromRITChars(string name, HashSet <long> EDSschedule)
        {
            ScheduleOfRITEs newSchedule = new ScheduleOfRITEs(name);

            foreach (long RITCharID in EDSschedule)
            {
                long RITEID = EDSDataExtract.CoverageIdAttrMap[RITCharID].RITExposureId;

                RITCharacteristic characteristicToAdd = _characteristics.Where(ritchar => ritchar.ID == RITCharID).FirstOrDefault();
                RITE ritetoAdd = _rites.Where(rite => rite.ExposureID == RITEID).FirstOrDefault();

                if (characteristicToAdd != null)
                {
                    newSchedule.AddCharacteristic(characteristicToAdd);
                }
                else
                {
                    throw new IndexOutOfRangeException("Error building schedule with RITCharacteristics: Cannot find RITCharacteristic with id = " + RITCharID + " in Exposure Data");
                }

                if (ritetoAdd != null)
                {
                    newSchedule.AddItem(ritetoAdd);
                }
                else
                {
                    throw new IndexOutOfRangeException("Error building schedule with RITEs: Cannot find RITE with id = " + RITEID + " in Exposure Data");
                }
            }

            return(newSchedule);
        }
Пример #2
0
        private ScheduleOfRITEs BuildScheduleFromRITChars2(string name, HashSet <long> EDSschedule)
        {
            ScheduleOfRITEs newSchedule = new ScheduleOfRITEs(name);

            foreach (long RITCharID in EDSschedule)
            {
                RITCharacteristic characteristicToAdd;
                if (!_characteristicsDict.TryGetValue(RITCharID, out characteristicToAdd))
                {
                    throw new IndexOutOfRangeException("Error building schedule with RITCharacteristics: Cannot find RITCharacteristic with id = " + RITCharID + " in Exposure Data");
                }
                newSchedule.AddCharacteristic(characteristicToAdd);

                //long RITEID = EDSDataExtract.CoverageIdAttrMap[RITCharID].RITExposureId;
                long RITEID = characteristicToAdd.ParentRITE.ExposureID;

                RITE ritetoAdd;
                if (!_ritesDict.TryGetValue(RITEID, out ritetoAdd))
                {
                    throw new IndexOutOfRangeException("Error building schedule with RITEs: Cannot find RITE with id = " + RITEID + " in Exposure Data");
                }
                newSchedule.AddItem(ritetoAdd);
            }

            return(newSchedule);
        }
Пример #3
0
        public void AddScheduleFromRITChars(string name, HashSet <RITCharacteristic> RITChars)
        {
            ScheduleOfRITEs newSchedule = new ScheduleOfRITEs(name);

            foreach (RITCharacteristic RITChar in RITChars)
            {
                newSchedule.AddItem(RITChar.ParentRITE);
                newSchedule.AddCharacteristic(RITChar);
            }
            _schedules.Add(newSchedule);
            _schedulesDict.Add(newSchedule.Name, newSchedule);
        }