diff --git a/src/MyNet.Utilities/Sequences/Interval.cs b/src/MyNet.Utilities/Sequences/Interval.cs index 3bac9e3..88681b6 100644 --- a/src/MyNet.Utilities/Sequences/Interval.cs +++ b/src/MyNet.Utilities/Sequences/Interval.cs @@ -24,6 +24,8 @@ private void SetIntervalInternal(T start, T end) public bool Contains(T value) => value.CompareTo(Start) >= 0 && value.CompareTo(End) <= 0; + public bool Contains(Interval interval) => interval.Start.CompareTo(Start) >= 0 && interval.End.CompareTo(End) <= 0; + public bool Intersect(Interval interval) => Start.CompareTo(interval.End) < 0 && interval.Start.CompareTo(End) < 0; public override bool Equals(object? obj) => obj is Interval vm && Start.Equals(vm.Start) && End.Equals(vm.End);