Ejemplo n.º 1
0
        public void ReMerge()
        {
            CourseTimes.Clear();
            int       timePointCount = TimePoints.Count;
            int       tempSpan       = 0;
            TimePoint tempPoint      = new TimePoint(-1, -1);

            for (int i = 0; i < timePointCount; i++)
            {
                if (TimePoints[i].DayOfWeek == tempPoint.DayOfWeek && TimePoints[i].ClassOfDay == (tempPoint.ClassOfDay + tempSpan) && TimePoints[i].WeekKind == tempPoint.WeekKind)
                {
                    tempSpan++;
                }
                else
                {
                    if (tempPoint.DayOfWeek != -1)
                    {
                        CourseTimes.Add(new CourseTime(tempPoint.DayOfWeek, tempPoint.ClassOfDay, tempSpan, tempPoint.WeekKind));
                    }
                    tempPoint = TimePoints[i];
                    tempSpan  = 1;
                }
            }
            CourseTimes.Add(new CourseTime(tempPoint.DayOfWeek, tempPoint.ClassOfDay, tempSpan, tempPoint.WeekKind));
        }
Ejemplo n.º 2
0
 public void Merge()
 {
     CourseTimes.Clear();
     TimePoints.Sort((a, b) =>
     {
         if (a.DayOfWeek != b.DayOfWeek)
         {
             return(Math.Sign(a.DayOfWeek - b.DayOfWeek));
         }
         return(Math.Sign(a.ClassOfDay - b.ClassOfDay));
     });
     ReMerge();
 }