| 1187 | } |
| 1188 | |
| 1189 | Status SubarrayPartitioner::next_from_multi_range(bool* unsplittable) { |
| 1190 | // A new multi-range subarray may need to be put in the list and split |
| 1191 | if (state_.multi_range_.empty()) { |
| 1192 | auto s = subarray_.get_subarray(current_.start_, current_.end_); |
| 1193 | state_.multi_range_.push_front(std::move(s)); |
| 1194 | throw_if_not_ok(split_top_multi_range(unsplittable)); |
| 1195 | } |
| 1196 | |
| 1197 | // Loop until you find a partition that fits or unsplittable |
| 1198 | if (!*unsplittable) { |
| 1199 | bool must_split; |
| 1200 | do { |
| 1201 | auto& partition = state_.multi_range_.front(); |
| 1202 | must_split = this->must_split(&partition); |
| 1203 | if (must_split) |
| 1204 | RETURN_NOT_OK(split_top_multi_range(unsplittable)); |
| 1205 | } while (must_split && !*unsplittable); |
| 1206 | } |
| 1207 | |
| 1208 | // At this point, the top mulit-range is the next partition |
| 1209 | current_.partition_ = std::move(state_.multi_range_.front()); |
| 1210 | current_.split_multi_range_ = true; |
| 1211 | state_.multi_range_.pop_front(); |
| 1212 | if (state_.multi_range_.empty()) |
| 1213 | state_.start_ = current_.end_ + 1; |
| 1214 | |
| 1215 | return Status::Ok(); |
| 1216 | } |
| 1217 | |
| 1218 | Status SubarrayPartitioner::next_from_single_range(bool* unsplittable) { |
| 1219 | // Handle case where a new single range must be put in the list and split |
nothing calls this directly
no test coverage detected