File tree 6 files changed +16
-4
lines changed
6 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
declare (strict_types=1 );
3
4
4
5
namespace Danon \IntervalTree \Interval ;
5
6
6
7
use DateTimeInterface ;
7
8
use InvalidArgumentException ;
9
+
8
10
use function count ;
9
11
10
12
final class DateTimeInterval implements IntervalInterface
Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
declare (strict_types=1 );
3
4
4
5
namespace Danon \IntervalTree \Interval ;
Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
declare (strict_types=1 );
3
4
4
5
namespace Danon \IntervalTree \Interval ;
5
6
6
7
use InvalidArgumentException ;
8
+
7
9
use function count ;
8
10
9
11
final class NumericInterval implements IntervalInterface
@@ -19,7 +21,7 @@ final class NumericInterval implements IntervalInterface
19
21
private $ high ;
20
22
21
23
/**
22
- * IntegerInterval constructor
24
+ * NumericInterval constructor
23
25
* @param int|float $low
24
26
* @param int|float $high
25
27
*/
Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
declare (strict_types=1 );
3
4
4
5
namespace Danon \IntervalTree ;
@@ -167,8 +168,10 @@ private function treeInsert(Node $insertNode): void
167
168
}
168
169
169
170
/**
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
171
173
* Go upwards to the root and re-color until violation will be resolved
174
+ *
172
175
* @param Node $insertNode
173
176
*/
174
177
private function insertFixup (Node $ insertNode ): void
@@ -259,9 +262,11 @@ private function treeDelete(Node $deleteNode): void
259
262
private function deleteFixup (Node $ fixNode ): void
260
263
{
261
264
$ currentNode = $ fixNode ;
262
- while ($ currentNode !== $ this ->root
265
+ while (
266
+ $ currentNode !== $ this ->root
263
267
&& $ currentNode ->getParent () !== null
264
- && $ currentNode ->getColor ()->isBlack ()) {
268
+ && $ currentNode ->getColor ()->isBlack ()
269
+ ) {
265
270
if ($ currentNode === $ currentNode ->getParent ()->getLeft ()) {
266
271
$ brotherNode = $ currentNode ->getParent ()->getRight ();
267
272
if ($ brotherNode ->getColor ()->isRed ()) {
Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
declare (strict_types=1 );
3
4
4
5
namespace Danon \IntervalTree ;
Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
declare (strict_types=1 );
3
4
4
5
namespace Danon \IntervalTree ;
You can’t perform that action at this time.
0 commit comments