/// <summary> /// Determines whether the range list contains a specific value <see cref="TValue"/>. /// </summary> /// <param name="value">The object to locate in the range list.</param> /// <returns> /// <c>true</c> if the <see cref="TValue"/> is found in the range list; otherwise, <c>false</c>. /// </returns> public bool Contains(TValue value) { if (IsEmpty) { return(false); } if (IsFull) { return(true); } var index = Values.BinarySearch(Range.Simple(value)); return(index >= 0); }
public void Intersect() { CheckIntersect(Range.Full <int>(), Range.Full <int>(), Range.Full <int>()); CheckIntersect(Range.Full <int>(), Range.Empty <int>(), Range.Empty <int>()); CheckIntersect(Range.Full <int>(), Range.StartsWith(10), Range.StartsWith(10)); CheckIntersect(Range.Empty <int>(), Range.Empty <int>(), Range.Empty <int>()); CheckIntersect(Range.EndsWith(10, true), Range.Create(0, 10, true, true), Range.Create(0, 10, true)); CheckIntersect(Range.EndsWith(10, false), Range.Create(0, 10, true, true), Range.Create(0, 10, true, false)); CheckIntersect(Range.EndsWith(10, false), Range.StartsWith(10, true)); CheckIntersect(Range.EndsWith(10, false), Range.StartsWith(10, false)); CheckIntersect(Range.EndsWith(10, true), Range.StartsWith(10, true), Range.Simple(10)); CheckIntersect(Range.EndsWith(10, true), Range.Create(0, 9, true), Range.Create(0, 9, true)); CheckIntersect(Range.EndsWith(10, true), Range.Create(0, 9, true, false), Range.Create(0, 9, true, false)); CheckIntersect(Range.Create(0, 10, true), Range.Create(0, 2, false, false), Range.Create(0, 2, false, false)); }