/* * Main authors: * Christian Schulte * * Copyright: * Christian Schulte, 2003 * * Last modified: * $Date: 2006-08-25 17:05:19 +0200 (Fri, 25 Aug 2006) $ by $Author: schulte $ * $Revision: 3572 $ * * 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. * */ #include "gecode/int/rel.hh" namespace Gecode { namespace Int { namespace Count { /* * Counting domain-consistent equality * */ template forceinline RelTest holds(VX x, ConstIntView y) { return rtest_eq_dom(x,y.val()); } template forceinline RelTest holds(VX x, VX y) { return rtest_eq_dom(x,y); } template forceinline ExecStatus post_true(Space* home, VX x, ConstIntView y) { GECODE_ME_CHECK(x.eq(home,y.val())); return ES_SUBSUMED; } template forceinline ExecStatus post_true(Space* home, ViewArray& x, ConstIntView y) { for (int i = x.size(); i--; ) GECODE_ME_CHECK(x[i].eq(home,y.val())); return ES_SUBSUMED; } template forceinline ExecStatus post_false(Space* home, VX x, ConstIntView y) { GECODE_ME_CHECK(x.nq(home,y.val())); return ES_SUBSUMED; } template forceinline ExecStatus post_false(Space* home, ViewArray& x, ConstIntView y) { for (int i = x.size(); i--; ) GECODE_ME_CHECK(x[i].nq(home,y.val())); return ES_SUBSUMED; } template forceinline ExecStatus post_true(Space* home, ViewArray& x, VX y) { ViewArray z(home,x.size()+1); z[x.size()] = y; for (int i = x.size(); i--; ) z[i] = x[i]; GECODE_ES_CHECK(Rel::NaryEqDom::post(home,z)); return ES_SUBSUMED; } template forceinline ExecStatus post_true(Space* home, VX x, VX y) { GECODE_ES_CHECK((Rel::EqDom::post(home,x,y))); return ES_SUBSUMED; } template forceinline ExecStatus post_false(Space* home, ViewArray& x, VX y) { for (int i = x.size(); i--; ) GECODE_ES_CHECK(Rel::Nq::post(home,x[i],y)); return ES_SUBSUMED; } template forceinline ExecStatus post_false(Space* home, VX x, VX y) { GECODE_ES_CHECK(Rel::Nq::post(home,x,y)); return ES_SUBSUMED; } }}} // STATISTICS: int-prop