Merges child i with child i+1 if their combined size is not too large
(i: index, maxSize: number)
| 956 | |
| 957 | /** Merges child i with child i+1 if their combined size is not too large */ |
| 958 | tryMerge(i: index, maxSize: number): boolean { |
| 959 | const children = this.children |
| 960 | if (i >= 0 && i + 1 < children.length) { |
| 961 | if (children[i]!.keys.length + children[i + 1]!.keys.length <= maxSize) { |
| 962 | if (children[i]!.isShared) |
| 963 | // cloned already UNLESS i is outside scan range |
| 964 | children[i] = children[i]!.clone() |
| 965 | children[i]!.mergeSibling(children[i + 1]!, maxSize) |
| 966 | children.splice(i + 1, 1) |
| 967 | this.keys.splice(i + 1, 1) |
| 968 | this.keys[i] = children[i]!.maxKey()! |
| 969 | return true |
| 970 | } |
| 971 | } |
| 972 | return false |
| 973 | } |
| 974 | |
| 975 | /** |
| 976 | * Move children from `rhs` into this. |
no test coverage detected