File tree Expand file tree Collapse file tree 6 files changed +16
-4
lines changed
Expand file tree Collapse file tree 6 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 11<?php
2+
23declare (strict_types=1 );
34
45namespace Danon \IntervalTree \Interval ;
56
67use DateTimeInterface ;
78use InvalidArgumentException ;
9+
810use function count ;
911
1012final class DateTimeInterval implements IntervalInterface
Original file line number Diff line number Diff line change 11<?php
2+
23declare (strict_types=1 );
34
45namespace Danon \IntervalTree \Interval ;
Original file line number Diff line number Diff line change 11<?php
2+
23declare (strict_types=1 );
34
45namespace Danon \IntervalTree \Interval ;
56
67use InvalidArgumentException ;
8+
79use function count ;
810
911final class NumericInterval implements IntervalInterface
@@ -19,7 +21,7 @@ final class NumericInterval implements IntervalInterface
1921 private $ high ;
2022
2123 /**
22- * IntegerInterval constructor
24+ * NumericInterval constructor
2325 * @param int|float $low
2426 * @param int|float $high
2527 */
Original file line number Diff line number Diff line change 11<?php
2+
23declare (strict_types=1 );
34
45namespace Danon \IntervalTree ;
@@ -167,8 +168,10 @@ private function treeInsert(Node $insertNode): void
167168 }
168169
169170 /**
170- * After insertion insert_node may have red-colored parent, and this is a single possible violation
171+ * After insertion insert_node may have red-colored parent
172+ * And this is a single possible violation
171173 * Go upwards to the root and re-color until violation will be resolved
174+ *
172175 * @param Node $insertNode
173176 */
174177 private function insertFixup (Node $ insertNode ): void
@@ -259,9 +262,11 @@ private function treeDelete(Node $deleteNode): void
259262 private function deleteFixup (Node $ fixNode ): void
260263 {
261264 $ currentNode = $ fixNode ;
262- while ($ currentNode !== $ this ->root
265+ while (
266+ $ currentNode !== $ this ->root
263267 && $ currentNode ->getParent () !== null
264- && $ currentNode ->getColor ()->isBlack ()) {
268+ && $ currentNode ->getColor ()->isBlack ()
269+ ) {
265270 if ($ currentNode === $ currentNode ->getParent ()->getLeft ()) {
266271 $ brotherNode = $ currentNode ->getParent ()->getRight ();
267272 if ($ brotherNode ->getColor ()->isRed ()) {
Original file line number Diff line number Diff line change 11<?php
2+
23declare (strict_types=1 );
34
45namespace Danon \IntervalTree ;
Original file line number Diff line number Diff line change 11<?php
2+
23declare (strict_types=1 );
34
45namespace Danon \IntervalTree ;
You can’t perform that action at this time.
0 commit comments