InsertWithoutMergingUnchecked inserts the given segment into the given gap and returns an iterator to the inserted segment. All existing iterators (including gap, but not including the returned iterator) are invalidated. Preconditions: - r.Start >= gap.Start(). - r.End <= gap.End().
(gap GapIterator, r Range, val Value)
| 437 | // - r.Start >= gap.Start(). |
| 438 | // - r.End <= gap.End(). |
| 439 | func (s *Set) InsertWithoutMergingUnchecked(gap GapIterator, r Range, val Value) Iterator { |
| 440 | gap = gap.node.rebalanceBeforeInsert(gap) |
| 441 | splitMaxGap := trackGaps != 0 && (gap.node.nrSegments == 0 || gap.Range().Length() == gap.node.maxGap.Get()) |
| 442 | copy(gap.node.keys[gap.index+1:], gap.node.keys[gap.index:gap.node.nrSegments]) |
| 443 | copy(gap.node.values[gap.index+1:], gap.node.values[gap.index:gap.node.nrSegments]) |
| 444 | gap.node.keys[gap.index] = r |
| 445 | gap.node.values[gap.index] = val |
| 446 | gap.node.nrSegments++ |
| 447 | if splitMaxGap { |
| 448 | gap.node.updateMaxGapLeaf() |
| 449 | } |
| 450 | return Iterator(gap) |
| 451 | } |
| 452 | |
| 453 | // InsertRange inserts the given segment into the set. If the new segment can |
| 454 | // be merged with adjacent segments, InsertRange will do so. InsertRange |
no test coverage detected