| @@ 180-197 (lines=18) @@ | ||
| 177 | * |
|
| 178 | * @since 1.0.0 |
|
| 179 | */ |
|
| 180 | public function predecessor() |
|
| 181 | { |
|
| 182 | if ($this->information & 2) |
|
| 183 | { |
|
| 184 | $node = $this->left; |
|
| 185 | ||
| 186 | while ($node->information & 1) |
|
| 187 | { |
|
| 188 | $node = $node->right; |
|
| 189 | } |
|
| 190 | ||
| 191 | return $node; |
|
| 192 | } |
|
| 193 | else |
|
| 194 | { |
|
| 195 | return $this->left; |
|
| 196 | } |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * Get the successor |
|
| @@ 206-223 (lines=18) @@ | ||
| 203 | * |
|
| 204 | * @since 1.0.0 |
|
| 205 | */ |
|
| 206 | public function successor() |
|
| 207 | { |
|
| 208 | if ($this->information & 1) |
|
| 209 | { |
|
| 210 | $node = $this->right; |
|
| 211 | ||
| 212 | while ($node->information & 2) |
|
| 213 | { |
|
| 214 | $node = $node->left; |
|
| 215 | } |
|
| 216 | ||
| 217 | return $node; |
|
| 218 | } |
|
| 219 | else |
|
| 220 | { |
|
| 221 | return $this->right; |
|
| 222 | } |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| 226 | * Count the number of key/value pair |
|