/* * Main authors: * Christian Schulte * * Copyright: * Christian Schulte, 2004 * * Last modified: * $Date: 2006-07-19 14:57:38 +0200 (Wed, 19 Jul 2006) $ by $Author: schulte $ * $Revision: 3413 $ * * This file is part of Gecode, the generic constraint * development environment: * http://www.gecode.org * * See the file "LICENSE" for information on usage and * redistribution of this file, and for a * DISCLAIMER OF ALL WARRANTIES. * */ namespace Gecode { namespace Int { namespace Dom { template forceinline ReIntSet::ReIntSet (Space* home, View x, const IntSet& s, BoolView b) : ReUnaryPropagator(home,x,b,true), is(s) {} template ExecStatus ReIntSet::post(Space* home, View x, const IntSet& s, BoolView b) { if (s.size() == 0) { GECODE_ME_CHECK(b.t_zero(home)); } else if (s.size() == 1) { return ReRange::post(home,x,s.min(),s.max(),b); } else { (void) new (home) ReIntSet(home,x,s,b); } return ES_OK; } template forceinline ReIntSet::ReIntSet(Space* home, bool share, ReIntSet& p) : ReUnaryPropagator(home,share,p) { is.update(share,p.is); } template Actor* ReIntSet::copy(Space* home, bool share) { return new (home) ReIntSet(home,share,*this); } template ExecStatus ReIntSet::propagate(Space* home) { IntSetRanges i_is(is); if (b.one()) { GECODE_ME_CHECK(x0.inter(home,i_is)); return ES_SUBSUMED; } if (b.zero()) { GECODE_ME_CHECK(x0.minus(home,i_is)); return ES_SUBSUMED; } ViewRanges i_x(x0); switch (Iter::Ranges::subsumes(i_is,i_x)) { case Iter::Ranges::SS_SUBSUMED: b.t_one_none(home); return ES_SUBSUMED; case Iter::Ranges::SS_EMPTY: b.t_zero_none(home); return ES_SUBSUMED; case Iter::Ranges::SS_NONE: break; default: GECODE_NEVER; } return ES_FIX; } }}} // STATISTICS: int-prop