| @@ 478-493 (lines=16) @@ | ||
| 475 | ||
| 476 | if ($cmp < 0) |
|
| 477 | { |
|
| 478 | if ($this->information & 2) |
|
| 479 | { |
|
| 480 | $leftBalance = $this->left->information & ~3; |
|
| 481 | $this->left = $this->left->insert($key, $value, $comparator); |
|
| 482 | ||
| 483 | if (($this->left->information & ~3) && ($this->left->information & ~3) != $leftBalance) |
|
| 484 | { |
|
| 485 | $node = $this->decBalance(); |
|
| 486 | } |
|
| 487 | } |
|
| 488 | else |
|
| 489 | { |
|
| 490 | $this->left = new static($key, $value, $this->left, $this); |
|
| 491 | $this->information |= 2; |
|
| 492 | $node = $this->decBalance(); |
|
| 493 | } |
|
| 494 | } |
|
| 495 | elseif ($cmp > 0) |
|
| 496 | { |
|
| @@ 495-513 (lines=19) @@ | ||
| 492 | $node = $this->decBalance(); |
|
| 493 | } |
|
| 494 | } |
|
| 495 | elseif ($cmp > 0) |
|
| 496 | { |
|
| 497 | if ($this->information & 1) |
|
| 498 | { |
|
| 499 | $rightBalance = $this->right->information & ~3; |
|
| 500 | $this->right = $this->right->insert($key, $value, $comparator); |
|
| 501 | ||
| 502 | if (($this->right->information & ~3) && ($this->right->information & ~3) != $rightBalance) |
|
| 503 | { |
|
| 504 | $node = $this->incBalance(); |
|
| 505 | } |
|
| 506 | } |
|
| 507 | else |
|
| 508 | { |
|
| 509 | $this->right = new static($key, $value, $this, $this->right); |
|
| 510 | $this->information |= 1; |
|
| 511 | $node = $this->incBalance(); |
|
| 512 | } |
|
| 513 | } |
|
| 514 | else |
|
| 515 | { |
|
| 516 | $this->value = $value; |
|