| 64 | |
| 65 | template<class View> |
| 66 | forceinline ExecStatus |
| 67 | ChannelInt<View>::post(Home home, |
| 68 | ViewArray<Gecode::Int::CachedView< |
| 69 | Gecode::Int::IntView> >& xs, |
| 70 | ViewArray<CachedView<View> >& ys) { |
| 71 | // Sharing of ys is taken care of in the propagator: |
| 72 | // The ys are propagated to be disjoint, so shared variables |
| 73 | // result in failure. |
| 74 | int xssize = xs.size(); |
| 75 | for (int i=ys.size(); i--;) { |
| 76 | GECODE_ME_CHECK(ys[i].exclude(home, xssize, Limits::max)); |
| 77 | GECODE_ME_CHECK(ys[i].exclude(home, Limits::min, -1)); |
| 78 | } |
| 79 | int yssize = ys.size(); |
| 80 | if (yssize > Gecode::Int::Limits::max) |
| 81 | return ES_FAILED; |
| 82 | for (int i=xs.size(); i--;) { |
| 83 | GECODE_ME_CHECK(xs[i].gq(home, 0)); |
| 84 | GECODE_ME_CHECK(xs[i].le(home, static_cast<int>(yssize))); |
| 85 | } |
| 86 | |
| 87 | (void) new (home) ChannelInt(home,xs,ys); |
| 88 | return ES_OK; |
| 89 | } |
| 90 | |
| 91 | template<class View> |
| 92 | PropCost |