element.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "gecode/int/element.hh"
00023
00024 namespace Gecode {
00025
00026 using namespace Int;
00027
00028 void
00029 element(Space* home, const IntArgs& c, IntVar x0, IntVar x1,
00030 IntConLevel) {
00031 if (home->failed()) return;
00032 Element::IntSharedArray cs(c.size());
00033 for (int i = c.size(); i--; )
00034 if ((c[i] < Limits::Int::int_min) || (c[i] > Limits::Int::int_max))
00035 throw NumericalOverflow("Int::element");
00036 else
00037 cs[i] = c[i];
00038 if (Element::Int<IntView,IntView>::post(home,cs,x0,x1) == ES_FAILED)
00039 home->fail();
00040 }
00041
00042 void
00043 element(Space* home, const IntVarArgs& c, IntVar x0, IntVar x1,
00044 IntConLevel icl) {
00045 if (home->failed()) return;
00046 Element::IdxView<IntView>* iv = Element::IdxView<IntView>::init(home,c);
00047 if (icl == ICL_BND) {
00048 if (Element::ViewBnd<IntView,IntView>::post(home,iv,c.size(),x0,x1)
00049 == ES_FAILED)
00050 home->fail();
00051 } else {
00052 if (Element::ViewDom<IntView,IntView>::post(home,iv,c.size(),x0,x1)
00053 == ES_FAILED)
00054 home->fail();
00055 }
00056 }
00057
00058 }
00059
00060
00061
00062