MCPcopy Create free account
hub / github.com/Gecode/gecode / exclude_full

Method exclude_full

gecode/set/var-imp/integerset.cpp:206–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204 }
205
206 bool
207 LUBndSet::exclude_full(Space& home, int mi, int ma, SetDelta& d) {
208 assert(ma >= mi);
209 assert(mi <= max() && ma >= min() &&
210 (mi > min() || ma < max()));
211 bool result=false;
212
213 RangeList* p = nullptr;
214 RangeList* c = fst();
215 d._lubMin = Limits::max+1;
216 while (c != nullptr) {
217 if (c->max() >= mi) {
218 if (c->min() > ma) { return result; } //in a hole
219
220 if (c->min()<mi && c->max() > ma) { //Range split:
221 RangeList* q =
222 new (home) RangeList(ma+1,c->max(),c->next());
223 c->max(mi-1);
224 if (c == lst()) {
225 lst(q);
226 }
227 c->next(q);
228 _size -= (ma-mi+1);
229 d._lubMin = mi;
230 d._lubMax = ma;
231 return true;
232 }
233
234 if (c->max() > ma) { //start of range clipped, end remains
235 d._lubMin = std::min(d._lubMin, c->min());
236 d._lubMax = ma;
237 _size-=(ma-c->min()+1);
238 c->min(ma+1);
239 return true;
240 }
241
242 if (c->min() < mi) { //end of range clipped, start remains
243 _size-=(c->max()-mi+1);
244 d._lubMin = mi;
245 d._lubMax = c->max();
246 c->max(mi-1);
247 result=true;
248 } else { //range *c destroyed
249 d._lubMin = c->min();
250 _size-=c->width();
251 RangeList *cend = c;
252 while ((cend->next()!=nullptr) && (cend->next()->max()<=ma)) {
253 cend = cend->next();
254 _size-=cend->width();
255 }
256 d._lubMax = cend->max();
257 if (fst()==c) {
258 fst(cend->next());
259 } else {
260 p->next(cend->next());
261 }
262 if (lst()==cend) {
263 lst(p);

Callers

nothing calls this directly

Calls 7

maxFunction · 0.50
minFunction · 0.50
maxMethod · 0.45
minMethod · 0.45
nextMethod · 0.45
widthMethod · 0.45
disposeMethod · 0.45

Tested by

no test coverage detected