@@ 426-441 (lines=16) @@ | ||
423 | * |
|
424 | * @since 1.0.0 |
|
425 | */ |
|
426 | private function _incBalance() |
|
427 | { |
|
428 | $this->information += 4; |
|
429 | ||
430 | if ($this->information >= 8) |
|
431 | { |
|
432 | if ($this->right->information < 0) |
|
433 | { |
|
434 | $this->right = $this->right->_rotateRight(); |
|
435 | } |
|
436 | ||
437 | return $this->_rotateLeft(); |
|
438 | } |
|
439 | ||
440 | return $this; |
|
441 | } |
|
442 | ||
443 | /** |
|
444 | * Decrement the balance of the node |
|
@@ 450-465 (lines=16) @@ | ||
447 | * |
|
448 | * @since 1.0.0 |
|
449 | */ |
|
450 | private function _decBalance() |
|
451 | { |
|
452 | $this->information -= 4; |
|
453 | ||
454 | if ($this->information < - 4) |
|
455 | { |
|
456 | if ($this->left->information >= 4) |
|
457 | { |
|
458 | $this->left = $this->left->_rotateLeft(); |
|
459 | } |
|
460 | ||
461 | return $this->_rotateRight(); |
|
462 | } |
|
463 | ||
464 | return $this; |
|
465 | } |
|
466 | ||
467 | /** |
|
468 | * Insert a key/value pair |