| @@ 419-434 (lines=16) @@ | ||
| 416 | * |
|
| 417 | * @since 1.0.0 |
|
| 418 | */ |
|
| 419 | private function incBalance() |
|
| 420 | { |
|
| 421 | $this->information += 4; |
|
| 422 | ||
| 423 | if ($this->information >= 8) |
|
| 424 | { |
|
| 425 | if ($this->right->information < 0) |
|
| 426 | { |
|
| 427 | $this->right = $this->right->rotateRight(); |
|
| 428 | } |
|
| 429 | ||
| 430 | return $this->rotateLeft(); |
|
| 431 | } |
|
| 432 | ||
| 433 | return $this; |
|
| 434 | } |
|
| 435 | ||
| 436 | /** |
|
| 437 | * Decrement the balance of the node |
|
| @@ 443-458 (lines=16) @@ | ||
| 440 | * |
|
| 441 | * @since 1.0.0 |
|
| 442 | */ |
|
| 443 | private function decBalance() |
|
| 444 | { |
|
| 445 | $this->information -= 4; |
|
| 446 | ||
| 447 | if ($this->information < - 4) |
|
| 448 | { |
|
| 449 | if ($this->left->information >= 4) |
|
| 450 | { |
|
| 451 | $this->left = $this->left->rotateLeft(); |
|
| 452 | } |
|
| 453 | ||
| 454 | return $this->rotateRight(); |
|
| 455 | } |
|
| 456 | ||
| 457 | return $this; |
|
| 458 | } |
|
| 459 | ||
| 460 | /** |
|
| 461 | * Insert a key/value pair |
|