Skip to content

Commit f11ca04

Browse files
committed
util: Delete function SortedDisjointIntervalList::GrowRightByOne which is unused
1 parent 352e3ae commit f11ca04

File tree

2 files changed

+0
-53
lines changed

2 files changed

+0
-53
lines changed

ortools/util/sorted_interval_list.cc

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -949,48 +949,6 @@ SortedDisjointIntervalList::Iterator SortedDisjointIntervalList::InsertInterval(
949949
return it;
950950
}
951951

952-
SortedDisjointIntervalList::Iterator SortedDisjointIntervalList::GrowRightByOne(
953-
int64_t value, int64_t* newly_covered) {
954-
auto it = intervals_.upper_bound({value, kint64max});
955-
auto it_prev = it;
956-
957-
// No interval containing or adjacent to "value" on the left (i.e. below).
958-
if (it != begin()) {
959-
--it_prev;
960-
}
961-
if (it == begin() || ((value != kint64min) && it_prev->end < value - 1)) {
962-
*newly_covered = value;
963-
if (it == end() || it->start != value + 1) {
964-
// No interval adjacent to "value" on the right: insert a singleton.
965-
return intervals_.insert(it, {value, value});
966-
} else {
967-
// There is an interval adjacent to "value" on the right. Extend it by
968-
// one. Note that we already know that there won't be a merge with another
969-
// interval on the left, since there were no interval adjacent to "value"
970-
// on the left.
971-
DCHECK_EQ(it->start, value + 1);
972-
const_cast<ClosedInterval*>(&(*it))->start = value;
973-
return it;
974-
}
975-
}
976-
977-
// At this point, "it_prev" points to an interval containing or adjacent to
978-
// "value" on the left: grow it by one, and if it now touches the next
979-
// interval, merge with it.
980-
CHECK_NE(kint64max, it_prev->end) << "Cannot grow right by one: the interval "
981-
"that would grow already ends at "
982-
"kint64max";
983-
*newly_covered = it_prev->end + 1;
984-
if (it != end() && it_prev->end + 2 == it->start) {
985-
// We need to merge it_prev with 'it'.
986-
const_cast<ClosedInterval*>(&(*it_prev))->end = it->end;
987-
intervals_.erase(it);
988-
} else {
989-
const_cast<ClosedInterval*>(&(*it_prev))->end = it_prev->end + 1;
990-
}
991-
return it_prev;
992-
}
993-
994952
template <class T>
995953
void SortedDisjointIntervalList::InsertAll(const std::vector<T>& starts,
996954
const std::vector<T>& ends) {

ortools/util/sorted_interval_list.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -616,17 +616,6 @@ class SortedDisjointIntervalList {
616616
*/
617617
Iterator InsertInterval(int64_t start, int64_t end);
618618

619-
/**
620-
* If value is in an interval, increase its end by one, otherwise insert the
621-
* interval [value, value]. In both cases, this returns an iterator to the
622-
* new/modified interval (possibly merged with others) and fills newly_covered
623-
* with the new value that was just added in the union of all the intervals.
624-
*
625-
* If this causes an interval ending at kint64max to grow, it will die with a
626-
* CHECK fail.
627-
*/
628-
Iterator GrowRightByOne(int64_t value, int64_t* newly_covered);
629-
630619
/**
631620
* Adds all intervals [starts[i]..ends[i]].
632621
*

0 commit comments

Comments
 (0)