Example #1
0
        public bool GetPotentialConflictingDorms(int thisDorm, SortedSet <int> dormsBeingCleared, IDictionary <int, InterDormTracking> dormPriorities)
        {
            if (HasMultiDormOptions)
            {
                if (dormsBeingCleared != null && dormsBeingCleared.Count > 0)
                {
                    foreach (var otherDorm in dormPriorities.Keys)
                    {
                        if (otherDorm != thisDorm)
                        {
                            var tracker = dormPriorities[otherDorm];
                            if (tracker.IncludeInResolving())
                            {
                                if (dormsBeingCleared.Contains(otherDorm))
                                {
                                    DormsToClear.Add(otherDorm);
                                    tracker.Options = 0;
                                }
                                else
                                {
                                    IncludedDorms.Add(otherDorm);
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (var otherDorm in dormPriorities.Keys)
                    {
                        if (otherDorm != thisDorm && dormPriorities[otherDorm].IncludeInResolving())
                        {
                            IncludedDorms.Add(otherDorm);
                        }
                    }
                }

                if (IncludedDorms.Count > 0)
                {
                    return(true);
                }
                else
                {
                    HasMultiDormOptions = false;
                }
            }
            return(false);
        }
Example #2
0
        public bool SelectDelegates()
        {
            DormsToClear.Remove(Dorm);
            if (ActivitiesToClear.Count > 0)
            {
                MainDelegates.Insert(0, o => ActivitiesToClear.Contains(o.Activity));
            }

            if (DoDormDelegates)
            {
                if (DormsToClear.Count > 0)
                {
                    //IncludedDorms.ExceptWith(DormsToClear);
                    DormDelegates.Add(o => DormsToClear.Contains(o.OtherDorm));
                }
                if (InterDormActivityConflicts.Count > 0)
                {
                    DormDelegates.Add(
                        o => InterDormActivityConflicts.TryGetValue(
                            o.OtherDorm,
                            out SortedSet <int> conflicts
                            ) && conflicts.Contains(o.Activity)
                        );
                }
                if (DormDelegates.Count > 0)
                {
                    if (MainDelegates.Count > 0)
                    {
                        MainDelegates.Insert(
                            MainDelegates.Count - 1,
                            o => o.HasOther && DormDelegates.Any(d => d(o))
                            );
                    }
                    else
                    {
                        MainDelegates.Add(o => o.HasOther && DormDelegates.Any(d => d(o)));
                    }
                }
            }

            return(MainDelegates.Count > 0);
        }
Example #3
0
 public void AddDormForClearing(int dorm)
 {
     DormsToClear.Add(dorm);
     IncludedDorms.Remove(dorm);
 }