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(