| 84 | */ |
| 85 | |
| 86 | ModEvent |
| 87 | IntVarImp::lq_full(Space& home, int m) { |
| 88 | assert((m >= dom.min()) && (m <= dom.max())); |
| 89 | int old_max = dom.max(); |
| 90 | ModEvent me = ME_INT_BND; |
| 91 | if (range()) { // Is already range... |
| 92 | dom.max(m); |
| 93 | if (assigned()) me = ME_INT_VAL; |
| 94 | } else if (m < fst()->next(nullptr)->min()) { // Becomes range... |
| 95 | dom.max(std::min(m,fst()->max())); |
| 96 | fst()->dispose(home,nullptr,lst()); |
| 97 | fst(nullptr); holes = 0; |
| 98 | if (assigned()) me = ME_INT_VAL; |
| 99 | } else { // Stays non-range... |
| 100 | RangeList* n = nullptr; |
| 101 | RangeList* c = lst(); |
| 102 | unsigned int h = 0; |
| 103 | while (m < c->min()) { |
| 104 | RangeList* p = c->prev(n); c->fix(n); |
| 105 | h += (c->min() - p->max() - 1); |
| 106 | n=c; c=p; |
| 107 | } |
| 108 | holes -= h; |
| 109 | int max_c = std::min(m,c->max()); |
| 110 | dom.max(max_c); c->max(max_c); |
| 111 | if (c != lst()) { |
| 112 | n->dispose(home,lst()); |
| 113 | c->next(n,nullptr); lst(c); |
| 114 | } |
| 115 | } |
| 116 | IntDelta d(dom.max()+1,old_max); |
| 117 | return notify(home,me,d); |
| 118 | } |
| 119 | |
| 120 | ModEvent |
| 121 | IntVarImp::gq_full(Space& home, int m) { |