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)); }
public override bool Equals(object obj) { if (!(obj is TimePoint)) { return(false); } TimePoint t = (TimePoint)obj; return(t.ClassOfDay == ClassOfDay && t.DayOfWeek == DayOfWeek && t.WeekKind == WeekKind); }