util: Delete function SortedDisjointIntervalList::GrowRightByOne which is unused
This commit is contained in:
@@ -949,48 +949,6 @@ SortedDisjointIntervalList::Iterator SortedDisjointIntervalList::InsertInterval(
|
||||
return it;
|
||||
}
|
||||
|
||||
SortedDisjointIntervalList::Iterator SortedDisjointIntervalList::GrowRightByOne(
|
||||
int64_t value, int64_t* newly_covered) {
|
||||
auto it = intervals_.upper_bound({value, kint64max});
|
||||
auto it_prev = it;
|
||||
|
||||
// No interval containing or adjacent to "value" on the left (i.e. below).
|
||||
if (it != begin()) {
|
||||
--it_prev;
|
||||
}
|
||||
if (it == begin() || ((value != kint64min) && it_prev->end < value - 1)) {
|
||||
*newly_covered = value;
|
||||
if (it == end() || it->start != value + 1) {
|
||||
// No interval adjacent to "value" on the right: insert a singleton.
|
||||
return intervals_.insert(it, {value, value});
|
||||
} else {
|
||||
// There is an interval adjacent to "value" on the right. Extend it by
|
||||
// one. Note that we already know that there won't be a merge with another
|
||||
// interval on the left, since there were no interval adjacent to "value"
|
||||
// on the left.
|
||||
DCHECK_EQ(it->start, value + 1);
|
||||
const_cast<ClosedInterval*>(&(*it))->start = value;
|
||||
return it;
|
||||
}
|
||||
}
|
||||
|
||||
// At this point, "it_prev" points to an interval containing or adjacent to
|
||||
// "value" on the left: grow it by one, and if it now touches the next
|
||||
// interval, merge with it.
|
||||
CHECK_NE(kint64max, it_prev->end) << "Cannot grow right by one: the interval "
|
||||
"that would grow already ends at "
|
||||
"kint64max";
|
||||
*newly_covered = it_prev->end + 1;
|
||||
if (it != end() && it_prev->end + 2 == it->start) {
|
||||
// We need to merge it_prev with 'it'.
|
||||
const_cast<ClosedInterval*>(&(*it_prev))->end = it->end;
|
||||
intervals_.erase(it);
|
||||
} else {
|
||||
const_cast<ClosedInterval*>(&(*it_prev))->end = it_prev->end + 1;
|
||||
}
|
||||
return it_prev;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void SortedDisjointIntervalList::InsertAll(const std::vector<T>& starts,
|
||||
const std::vector<T>& ends) {
|
||||
|
||||
@@ -616,17 +616,6 @@ class SortedDisjointIntervalList {
|
||||
*/
|
||||
Iterator InsertInterval(int64_t start, int64_t end);
|
||||
|
||||
/**
|
||||
* If value is in an interval, increase its end by one, otherwise insert the
|
||||
* interval [value, value]. In both cases, this returns an iterator to the
|
||||
* new/modified interval (possibly merged with others) and fills newly_covered
|
||||
* with the new value that was just added in the union of all the intervals.
|
||||
*
|
||||
* If this causes an interval ending at kint64max to grow, it will die with a
|
||||
* CHECK fail.
|
||||
*/
|
||||
Iterator GrowRightByOne(int64_t value, int64_t* newly_covered);
|
||||
|
||||
/**
|
||||
* Adds all intervals [starts[i]..ends[i]].
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user