public ClassTime?IntersectWith(ClassTime other) { if (!Overlaps(other)) { return(null); } return(new ClassTime(day, ClassHourTime.Max(start, other.start), ClassHourTime.Min(end, other.end))); }
public ClassTime?UnionIfOverlapsOrContinousWith(ClassTime other) { if (OverlapsOrContinousWith(other)) { var start = ClassHourTime.Min(this.start, other.start); var end = ClassHourTime.Max(this.end, other.end); return(new ClassTime(day, start, end)); } return(null); }