TryInsertWithoutMergingRange attempts to insert the given segment into the set. If successful, it returns an iterator to the inserted segment; all existing iterators (excluding the returned iterator) are invalidated. If the new segment would overlap an existing segment, TryInsertWithoutMergingRange
(r Range, val Value)
| 538 | // caller needs to do additional work between finding the gap and insertion, |
| 539 | // use InsertWithoutMerging instead. |
| 540 | func (s *Set) TryInsertWithoutMergingRange(r Range, val Value) Iterator { |
| 541 | if r.Length() <= 0 { |
| 542 | panic(fmt.Sprintf("invalid segment range %v", r)) |
| 543 | } |
| 544 | seg, gap := s.Find(r.Start) |
| 545 | if seg.Ok() { |
| 546 | return Iterator{} |
| 547 | } |
| 548 | if gap.End() < r.End { |
| 549 | return Iterator{} |
| 550 | } |
| 551 | return s.InsertWithoutMerging(gap, r, val) |
| 552 | } |
| 553 | |
| 554 | // Remove removes the given segment and returns an iterator to the vacated gap. |
| 555 | // All existing iterators (including seg, but not including the returned |
nothing calls this directly
no test coverage detected