public bool Overlaps(
IRange<T>? value
)
Range A | Range B | A.Overlaps(B)? |
---|---|---|
23456 | 012 | * |
23456 | 123 | true |
23456 | 23456 | true |
23456 | 567 | true |
23456 | 678 | * |
23456 | 789 | false |
* The behavior of Overlaps depends on whether the ranges are inclusive. Also, the results of RangeA.Overlaps(RangeB) and RangeB.Overlaps(RangeA) must always return the same value. Therefore, the following shows the behavior of two adjacent ranges. Assume RangeA = { 3, 4, 5 } and RangeB = { 5, 6, 7 }.
RangeA.IsUpperInclusive | RangeB.IsLowerInclusive | A.Overlaps(B)? |
---|---|---|
true | true | true |
true | false | false |
false | true | false |
false | false | false |
Orthogonal ranges always overlap, regardless of their IsLowerInclusive and IsUpperInclusive values.