match.icc
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
00023
00024
00025
00026
00027
00028 #include "gecode/set.hh"
00029 #include "gecode/int.hh"
00030 #include "gecode/set/rel.hh"
00031
00032 namespace Gecode { namespace Set { namespace Int {
00033
00034 forceinline
00035 Match::Match(Space* home, SetView y0, ViewArray< Gecode::Int::IntView >& ys)
00036 : Propagator(home), x0(y0), xs(ys) {
00037 x0.subscribe(home,this, PC_SET_ANY);
00038 xs.subscribe(home,this, Gecode::Int::PC_INT_BND);
00039 }
00040
00041 forceinline
00042 Match::Match(Space* home, bool share, Match& p)
00043 : Propagator(home,share,p) {
00044 x0.update(home,share,p.x0);
00045 xs.update(home,share,p.xs);
00046 }
00047
00048 forceinline ExecStatus
00049 Match::post(Space* home, SetView x0, ViewArray<Gecode::Int::IntView>& xs) {
00050 unsigned int xs_size = xs.size();
00051 GECODE_ME_CHECK(x0.cardMin(home,xs_size));
00052 GECODE_ME_CHECK(x0.cardMax(home,xs_size));
00053 if (xs_size==1) {
00054 SingletonView sv(xs[0]);
00055 GECODE_ES_CHECK((Rel::Eq<SetView,
00056 SingletonView>::post(home,x0, sv)));
00057 } else {
00058
00059
00060 (void) new (home) Match(home,x0,xs);
00061 }
00062 return ES_OK;
00063 }
00064
00065 }}}
00066
00067