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
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace Gecode {
00039
00049
00050
00057 template <class View, PropCond pcs, PropCond pci>
00058 class IntSetPropagator : public Propagator {
00059 protected:
00060 View x0;
00061 Gecode::Int::IntView x1;
00063 IntSetPropagator(Space* home,bool,IntSetPropagator&);
00065 IntSetPropagator(Space* home,View,Gecode::Int::IntView);
00066 public:
00068 virtual PropCost cost(ModEventDelta med) const;
00070 virtual size_t dispose(Space* home);
00072 Reflection::ActorSpec spec(const Space* home, Reflection::VarMap& m,
00073 const Support::Symbol& name) const;
00074 };
00075
00077
00078 template <class View, PropCond pcs, PropCond pci>
00079 IntSetPropagator<View,pcs,pci>::IntSetPropagator
00080 (Space* home, View y0, Gecode::Int::IntView y1)
00081 : Propagator(home), x0(y0), x1(y1) {
00082 x0.subscribe(home,this,pcs);
00083 x1.subscribe(home,this,pci);
00084 }
00085
00086 template <class View, PropCond pcs, PropCond pci>
00087 forceinline
00088 IntSetPropagator<View,pcs,pci>::IntSetPropagator
00089 (Space* home, bool share, IntSetPropagator<View,pcs,pci>& p)
00090 : Propagator(home,share,p) {
00091 x0.update(home,share,p.x0);
00092 x1.update(home,share,p.x1);
00093 }
00094
00095 template <class View, PropCond pcs, PropCond pci>
00096 PropCost
00097 IntSetPropagator<View,pcs,pci>::cost(ModEventDelta) const {
00098 return PC_BINARY_LO;
00099 }
00100
00101 template <class View, PropCond pcs, PropCond pci>
00102 size_t
00103 IntSetPropagator<View,pcs,pci>::dispose(Space* home) {
00104 if (!home->failed()) {
00105 x0.cancel(home,this,pcs);
00106 x1.cancel(home,this,pci);
00107 }
00108 (void) Propagator::dispose(home);
00109 return sizeof(*this);
00110 }
00111
00112 template <class View, PropCond pcs, PropCond pci>
00113 Reflection::ActorSpec
00114 IntSetPropagator<View,pcs,pci>::spec(const Space* home,
00115 Reflection::VarMap& m,
00116 const Support::Symbol& name) const {
00117 Reflection::ActorSpec s(name);
00118 return s << x0.spec(home, m)
00119 << x1.spec(home, m);
00120 }
00121
00122 }
00123
00124
00125