Ejemplo n.º 1
0
 private static void WeighClassActivity(ClassActivityBuilder classActivity, ClassTime classTime, WeighActivityHour weightFunc)
 {
     for (int hour = classTime.Start.Hour + 1; hour <= classTime.End.Hour; hour++)
     {
         weightFunc(classActivity, hour);
     }
 }
Ejemplo n.º 2
0
        private static void WeightActivity(ClassActivityBuilder classActivity, ClassTime classTime)
        {
            WeighActivityHour weightFunc;

            if (classTime.Day == DayOfWeek.Thursday)
            {
                weightFunc = WeighClassActivity_Thursday;
            }
            else
            {
                weightFunc = WeighClassActivity_OtherDay;
            }

            WeighClassActivity(classActivity, classTime, weightFunc);
        }
Ejemplo n.º 3
0
        private bool HasLaunchBreak()
        {
            for (DayOfWeek day = DayOfWeek.Sunday; day <= DayOfWeek.Saturday; day++)
            {
                var launchTime = new ClassTime(day, ClassHourTime.FromParts(12, false), ClassHourTime.FromParts(15, false));
                IEnumerable <ClassTime> intersection = ScheduleTimes.IntersectWith(launchTime);
                if (intersection.IsEmpty())
                {
                    continue;
                }

                ClassHourTime prevEnd = launchTime.Start;
                ClassHourTime currentStart;
                bool          validDay = false;
                foreach (ClassTime classTime in intersection)
                {
                    currentStart = classTime.Start;
                    if (HasAtLeastOneHourSpace(prevEnd, currentStart))
                    {
                        validDay = true;
                        break;
                    }

                    prevEnd = classTime.End;
                }

                if (!validDay)
                {
                    currentStart = launchTime.End;
                    if (HasAtLeastOneHourSpace(prevEnd, currentStart))
                    {
                        validDay = true;
                    }
                }
                if (!validDay)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 4
0
        internal IEnumerable <ClassTime> GetClassTimes()
        {
            IEnumerable <ClassTime> times = null;

            if (ClassTimes_Concreate.Any())
            {
                times = ClassTimes_Concreate.ToList();
            }
            else if (ClassTime != null)
            {
                times = EnumerableExtensions.AsEnumerable(ClassTime.CreateClassTime())
                        .ToList();
            }
            else if (ClassTimes.Any())
            {
                times = BuildClassTimes(ClassTimes);
            }

            return(times);
        }