00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 namespace Gecode {
00023
00033
00034
00041 template <class View, PropCond pcs, PropCond pci>
00042 class IntSetPropagator : public Propagator {
00043 protected:
00044 View x0;
00045 Gecode::Int::IntView x1;
00047 IntSetPropagator(Space* home,bool,IntSetPropagator&);
00049 IntSetPropagator(Space* home,View,Gecode::Int::IntView,bool=false);
00050 public:
00052 virtual PropCost cost(void) const;
00054 virtual size_t dispose(Space* home);
00055 };
00056
00058
00059 template <class View, PropCond pcs, PropCond pci>
00060 IntSetPropagator<View,pcs,pci>::IntSetPropagator
00061 (Space* home, View y0, Gecode::Int::IntView y1, bool fd)
00062 : Propagator(home,fd), x0(y0), x1(y1) {
00063 x0.subscribe(home,this,pcs);
00064 x1.subscribe(home,this,pci);
00065 }
00066
00067 template <class View, PropCond pcs, PropCond pci>
00068 forceinline
00069 IntSetPropagator<View,pcs,pci>::IntSetPropagator
00070 (Space* home, bool share, IntSetPropagator<View,pcs,pci>& p)
00071 : Propagator(home,share,p) {
00072 x0.update(home,share,p.x0);
00073 x1.update(home,share,p.x1);
00074 }
00075
00076 template <class View, PropCond pcs, PropCond pci>
00077 PropCost
00078 IntSetPropagator<View,pcs,pci>::cost(void) const {
00079 return PC_BINARY_LO;
00080 }
00081
00082 template <class View, PropCond pcs, PropCond pci>
00083 size_t
00084 IntSetPropagator<View,pcs,pci>::dispose(Space* home) {
00085 if (!home->failed()) {
00086 x0.cancel(home,this,pcs);
00087 x1.cancel(home,this,pci);
00088 }
00089 (void) Propagator::dispose(home);
00090 return sizeof(*this);
00091 }
00092
00093 }
00094
00095
00096