コード例 #1
0
        public ClassTime?IntersectWith(ClassTime other)
        {
            if (!Overlaps(other))
            {
                return(null);
            }

            return(new ClassTime(day, ClassHourTime.Max(start, other.start), ClassHourTime.Min(end, other.end)));
        }
コード例 #2
0
        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);
        }