Skip to content

v2.0.0 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 93 commits into from
Sep 23, 2021
Merged
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
573cd2b
Up to php 7.3
dan-on Apr 18, 2021
afcb5a1
Add type hints
dan-on Apr 18, 2021
1a14290
Add getters to low and high
dan-on Apr 18, 2021
66da55a
Add getters to key and value
dan-on Apr 18, 2021
bdae494
Add strict types
dan-on Apr 18, 2021
ff22d35
Add getters/setters to left and right node
dan-on Apr 18, 2021
6c975ac
Add type hints
dan-on Apr 18, 2021
b5ed08b
Remove foreach method
dan-on Apr 18, 2021
efec487
Remove useless methods
dan-on Apr 18, 2021
84578e5
Fix return type
dan-on Apr 18, 2021
7d50441
Fix return type
dan-on Apr 18, 2021
cf7c6fc
Refactor exists()
dan-on Apr 18, 2021
e987569
Fix comments
dan-on Apr 18, 2021
e86b11d
Add settigns/getters for node->parent
dan-on Apr 18, 2021
abe2e3b
Add settigns/getters for left and right node
dan-on Apr 18, 2021
d107092
Fix remove and add test
dan-on Apr 19, 2021
9d281dc
Remove composer.lock
dan-on Apr 22, 2021
f975ac9
Remove getKeys() method
dan-on Apr 22, 2021
1bcd317
Remove unused variables
dan-on Apr 22, 2021
7692cb4
Remove unused variables
dan-on Apr 22, 2021
dd7112c
Remove unused method
dan-on Apr 22, 2021
d9c501f
Add named constructor fromArray() for Interval
dan-on Apr 22, 2021
44becd2
Refactoring
dan-on Apr 24, 2021
299051e
Fix type-hinting
dan-on Apr 24, 2021
ef0087b
Fix access modifiers
dan-on Apr 24, 2021
b2599be
Fix access modifiers
dan-on Apr 24, 2021
8bb25f4
Recalc -> recalculation
dan-on Apr 24, 2021
cb5fbc4
Add strict types
dan-on Apr 24, 2021
878defe
Fix get parent possible null pointer exception
dan-on Apr 24, 2021
3fdb550
Fix access modifies
dan-on Apr 24, 2021
141d448
Fix possible null pointer exceptions
dan-on Apr 24, 2021
1f1c2b2
Add type-hinting
dan-on May 1, 2021
428c740
Remove key interval cloning
dan-on May 22, 2021
e17da7a
Add null coalescing operation for reduce cognitive load
dan-on May 22, 2021
6743b09
cs fix
dan-on May 22, 2021
18f9f76
CS fix in treeSearch() method
dan-on May 22, 2021
98b7e24
cs fixes
dan-on May 22, 2021
5d1a3dd
cs fixes in deleteFixup
dan-on May 22, 2021
631c175
cs fixes in insertFixup
dan-on May 22, 2021
d449787
cs fixes
dan-on May 22, 2021
f41519a
Add NodeColor and refactoring
dan-on Jul 7, 2021
bd1fe75
Change condition on remove method
dan-on Jul 7, 2021
6b3d791
Add phpstan
dan-on Jul 7, 2021
bd2b712
phpstan up to 5 level
dan-on Jul 7, 2021
6680691
phpstan up to 7 level
dan-on Jul 8, 2021
7ec838f
add psalm
dan-on Jul 8, 2021
80dfbc2
add phpinsights
dan-on Jul 9, 2021
e944b2d
change recursion to stack
dan-on Jul 10, 2021
c9c27dd
Rename item to pair
dan-on Jul 10, 2021
d8174e5
Add isEmpty test
dan-on Jul 10, 2021
5a0a644
count() to empty() check change
dan-on Jul 10, 2021
c7aa03f
naming: key to interval
dan-on Jul 10, 2021
f8c7913
remove static comparableMax function
dan-on Jul 10, 2021
3d5cc9d
fix phpstan issues
dan-on Jul 10, 2021
8e5920f
remove unused import
dan-on Jul 10, 2021
3241c85
remove static comparable less than
dan-on Jul 10, 2021
807f9c9
remove useless getMax method from interval
dan-on Jul 10, 2021
e376ff9
iterateIntersections -> findIntersections
dan-on Jul 11, 2021
3c6d155
Add initial tree size check
dan-on Jul 21, 2021
9abf82f
refactoring (use methods)
dan-on Jul 21, 2021
e18accd
Fix updating parent max
dan-on Jul 23, 2021
e0ed908
Add updating parent max after insert (fix error in rare cases)
dan-on Aug 4, 2021
d91982f
Update .gitignore
dan-on Aug 4, 2021
7f3d9ec
Add psalm.xml
dan-on Aug 4, 2021
97c24de
Add benchmark comparing with brute force method
dan-on Aug 4, 2021
714e942
Add different types of intervals: integer and datetime
dan-on Aug 8, 2021
daccdeb
Integer interval change to numeric interval
dan-on Aug 19, 2021
8d1e879
NodeColor is final
dan-on Aug 25, 2021
8ea8727
Node is final
dan-on Aug 25, 2021
aa926b0
Add test coverage
dan-on Aug 25, 2021
523de79
Remove phpinsights
dan-on Aug 25, 2021
ec82f2a
Add phpcs with PSR12 ruleset
dan-on Aug 25, 2021
8bebb1b
Fix code style
dan-on Aug 25, 2021
83909cf
Add phpmd with ruleset
dan-on Aug 26, 2021
1ee3bb0
Configure rules
dan-on Aug 26, 2021
bc17eb7
Fix cs in interval tree test
dan-on Aug 26, 2021
34dab2c
Add bench script
dan-on Aug 26, 2021
3fc4c7b
findInteractions return Iterator<Pair>
dan-on Sep 22, 2021
69a2759
Remove return type-hint for insert method
dan-on Sep 22, 2021
129e30e
Fix cs
dan-on Sep 22, 2021
22ed959
Update PHPDoc
dan-on Sep 22, 2021
e774ca8
Update README.md
dan-on Sep 22, 2021
a98b819
Add phpunit config
dan-on Sep 22, 2021
4489169
Add LICENSE
dan-on Sep 22, 2021
559e78e
Update README.md
dan-on Sep 23, 2021
4cbd803
Add badges
dan-on Sep 23, 2021
b77948d
update composer.json
dan-on Sep 23, 2021
cbd6da7
change script name
dan-on Sep 23, 2021
afe5757
add github actions CI
dan-on Sep 23, 2021
9466d15
update github actions CI
dan-on Sep 23, 2021
4a02ac9
update github actions CI
dan-on Sep 23, 2021
0791026
try to decrease required php version
dan-on Sep 23, 2021
264a519
Up to php >=7.3
dan-on Sep 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove useless methods
  • Loading branch information
dan-on committed Apr 18, 2021
commit efec487b9d42b0fb9027f6f5e7b51b3adadebd7c
44 changes: 0 additions & 44 deletions src/IntervalTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,6 @@ public function getKeys(): array
return $res;
}

/**
* Return array of values in the ascending keys order
* @return array
*/
public function getValues(): array
{
$res = [];
$this->treeWalk($this->root, function ($node) use (&$res) {
$res[] = $node->item->value;
});
return $res;
}

/**
* Returns array of items (<key,value> pairs) in the ascended keys order
*
* @return array
*/
public function getItems(): array
{
$res = [];
$this->treeWalk($this->root, function ($node) use (&$res) {
$res[] = (object) [
'key' => $node->item->key ? $node->item->key->output() : $node->item->key,
'value' => $node->item->value,
];
});
return $res;
}

/**
* Returns true if tree is empty
*
Expand Down Expand Up @@ -179,20 +149,6 @@ public function remove($key, $value): bool
return $deleteNode;
}

/**
* Value Mapper. Walk through every node and map node value to another value
*
* @param callback(value, key) - function to be called for each tree item
*/
public function map($callback)
{
$tree = new IntervalTree();
$this->treeWalk($this->root, function ($node) use (&$tree, $callback) {
return $tree->insert($node->item->key, $callback($node->item->value, $node->item->key));
});
return $tree;
}

public function recalcMax($node)
{
$nodeCurrent = $node;
Expand Down