//•Получение разности двух интервалов. Может получиться 1 или 2 отдельных куска public Range[] GetRangesDifference(Range range) { if (!IsRangeOverlap(range)) { return(new Range[] { new Range(From, To) }); } if (DoubleComparison.IsAMoreB(range.From, From) && DoubleComparison.IsAMoreOrEqualB(range.To, To)) { return(new Range[] { new Range(From, range.From) }); } else if (DoubleComparison.IsAMoreB(range.From, From) && DoubleComparison.IsAMoreB(To, range.To)) { return(new Range[] { new Range(From, range.From), new Range(range.To, To) }); } else if (DoubleComparison.IsAMoreOrEqualB(From, range.From) && DoubleComparison.IsAMoreB(To, range.To)) { return(new Range[] { new Range(range.To, To) }); } else { return(new Range[] { }); } }
private bool IsRangeOverlapWithEdges(Range range) // есть наложение крайними точками интервалов { return(!DoubleComparison.IsAMoreB(From, range.To) && !DoubleComparison.IsAMoreB(range.From, To)); }