| 38 | namespace Gecode { |
| 39 | |
| 40 | void |
| 41 | circuit(Home home, int offset, const IntVarArgs& x, IntPropLevel ipl) { |
| 42 | Int::Limits::nonnegative(offset,"Int::circuit"); |
| 43 | if (x.size() == 0) |
| 44 | throw Int::TooFewArguments("Int::circuit"); |
| 45 | if (same(x)) |
| 46 | throw Int::ArgumentSame("Int::circuit"); |
| 47 | GECODE_POST; |
| 48 | ViewArray<Int::IntView> xv(home,x); |
| 49 | |
| 50 | if (offset == 0) { |
| 51 | typedef Int::NoOffset<Int::IntView> NOV; |
| 52 | NOV no; |
| 53 | if (vbd(ipl) == IPL_DOM) { |
| 54 | GECODE_ES_FAIL((Int::Circuit::Dom<Int::IntView,NOV> |
| 55 | ::post(home,xv,no))); |
| 56 | } else { |
| 57 | GECODE_ES_FAIL((Int::Circuit::Val<Int::IntView,NOV> |
| 58 | ::post(home,xv,no))); |
| 59 | } |
| 60 | } else { |
| 61 | typedef Int::Offset OV; |
| 62 | OV off(-offset); |
| 63 | if (vbd(ipl) == IPL_DOM) { |
| 64 | GECODE_ES_FAIL((Int::Circuit::Dom<Int::IntView,OV> |
| 65 | ::post(home,xv,off))); |
| 66 | } else { |
| 67 | GECODE_ES_FAIL((Int::Circuit::Val<Int::IntView,OV> |
| 68 | ::post(home,xv,off))); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | void |
| 73 | circuit(Home home, const IntVarArgs& x, IntPropLevel ipl) { |
| 74 | circuit(home,0,x,ipl); |
no test coverage detected