Beispiel #1
0
        public void UpdateGraphForPerRisk()
        {
            List <IScheduleInput> newSchedules = new List <IScheduleInput>();
            bool existed;
            List <IScheduleInput> CopyOfOriginalSchedules = new List <IScheduleInput>(OriginalSchedules);
            List <IScheduleInput> PerRiskScheduleList     = new List <IScheduleInput>();
            HashSet <RITE>        ExplodedRiteSet         = new HashSet <RITE>();
            List <IScheduleInput> ExplodedRiteScheduleSet = new List <IScheduleInput>();

            foreach (IScheduleInput schedule in CopyOfOriginalSchedules)
            {
                if (schedule.IsPerRisk)
                {
                    PerRiskScheduleList.Add(schedule);
                    ScheduleTree.Remove(schedule.ScheduleName);
                    //TODO: also remove the schedule from the second key
                    OriginalSchedules.Remove(schedule);
                    ExplodedRiteSet.UnionWith(schedule.GetScheduleRITEList());
                }
            }

            foreach (RITE aRite in ExplodedRiteSet)
            {
                IScheduleInput newS = FormScheduleFromARITE(aRite, out existed);
                if (!existed)
                {
                    ExplodedRiteScheduleSet.Add(newS);
                }
            }

            GrowScheduleTree(ExplodedRiteScheduleSet, OriginalSchedules);
        }
Beispiel #2
0
        public ScheduleCompareOutcome CompareTwoSchedules(IScheduleInput s1, IScheduleInput s2)
        {
            HashSet <RITE> list1 = s1.GetScheduleRITEList();
            HashSet <RITE> list2 = s2.GetScheduleRITEList();

            if (list1.Count == list2.Count && list1.IsSubsetOf(list2))
            {
                if (s1.IsPerRisk == s2.IsPerRisk)
                {
                    return(ScheduleCompareOutcome.Equal);
                }
                else if (s1.IsPerRisk && !s2.IsPerRisk)
                {
                    return(ScheduleCompareOutcome.Parent);
                }
                else
                {
                    return(ScheduleCompareOutcome.Child);
                }
            }
            else if (list1.Count < list2.Count && list1.IsProperSubsetOf(list2))
            {
                return(ScheduleCompareOutcome.Parent);
            }
            else if (list1.Count > list2.Count && list1.IsProperSupersetOf(list2))
            {
                return(ScheduleCompareOutcome.Child);
            }
            else if (list1.Overlaps(list2))
            {
                return(ScheduleCompareOutcome.Overlap);
            }
            else
            {
                return(ScheduleCompareOutcome.Disjoin);
            }
        }