Skip to content

Commit 3fc4c7b

Browse files
committed
findInteractions return Iterator<Pair>
1 parent 34dab2c commit 3fc4c7b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/IntervalTree.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ public function isEmpty(): bool
4646
/**
4747
* Find nodes which intervals intersect with given interval
4848
* @param IntervalInterface $interval
49-
* @return Iterator<Node>
49+
* @return Iterator<Pair>
5050
*/
5151
public function findIntersections(IntervalInterface $interval): Iterator
5252
{
5353
$searchNode = Node::withPair(new Pair($interval));
5454
foreach ($this->treeSearchInterval($searchNode) as $node) {
55-
yield $node;
55+
yield $node->getPair();
5656
}
5757
}
5858

tests/IntervalTreeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ public function testFindIntersections(): void
4444
$checkInterval = [2, 3];
4545
$overlappingIntervals = [[0, 2], [0, 2], [0, 3], [1, 4], [2, 3], [3, 4]];
4646
$intersections = $this->tree->findIntersections(NumericInterval::fromArray($checkInterval));
47-
foreach ($intersections as $index => $node) {
47+
foreach ($intersections as $index => $pair) {
4848
$overlappingInterval = NumericInterval::fromArray($overlappingIntervals[$index]);
4949
$overlappingValue = implode('-', $overlappingIntervals[$index]);
5050
self::assertTrue($overlappingInterval->equalTo(NumericInterval::fromArray([
51-
$node->getPair()->getInterval()->getLow(),
52-
$node->getPair()->getInterval()->getHigh(),
51+
$pair->getInterval()->getLow(),
52+
$pair->getInterval()->getHigh(),
5353
])));
54-
self::assertEquals($overlappingValue, $node->getPair()->getValue());
54+
self::assertEquals($overlappingValue, $pair->getValue());
5555
}
5656
}
5757

0 commit comments

Comments
 (0)