From e00fafdd285d8ad32e490cba09d0929dbcf9b2eb Mon Sep 17 00:00:00 2001 From: Isaac Trimble-Pederson Date: Thu, 12 Aug 2021 14:13:45 -0700 Subject: [PATCH] Switch to proper exclusive interval --- src/Interval.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Interval.php b/src/Interval.php index a20b646..f1eafed 100644 --- a/src/Interval.php +++ b/src/Interval.php @@ -37,7 +37,7 @@ public function intersect(Interval $otherInterval) public function intersectExclusive(Interval $otherInterval) { - return $this->equalTo($otherInterval); + return !$this->notIntersectExclusive($otherInterval); } public function notIntersect(Interval $otherInterval) @@ -45,6 +45,11 @@ public function notIntersect(Interval $otherInterval) return ($this->high < $otherInterval->low || $otherInterval->high < $this->low); } + public function notIntersectExclusive(Interval $otherInterval) + { + return ($this->high <= $otherInterval->low || $otherInterval->high <= $this->low); + } + public function merge(Interval $otherInterval) { return new Interval(