/* * Main authors: * Guido Tack * * Contributing authors: * Christian Schulte * Gabor Szokoli * * Copyright: * Guido Tack, 2004 * Christian Schulte, 2004 * Gabor Szokoli, 2004 * * Last modified: * $Date: 2006-03-31 16:57:12 +0200 (Fri, 31 Mar 2006) $ by $Author: tack $ * $Revision: 3146 $ * * 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 Set { /* * Constructors and access * */ forceinline SetView::SetView(void) {} forceinline SetView::SetView(const SetVar& y) : VariableViewBase(y.variable()) {} /* * Variable information * */ forceinline bool SetView::assigned(void) const { return var->assigned(); } forceinline unsigned int SetView::glbSize(void) const { return var->glbSize(); } forceinline unsigned int SetView::lubSize(void) const { return var->lubSize(); } forceinline unsigned int SetView::unknownSize(void) const { return var->lubSize() - var->glbSize(); } forceinline bool SetView::contains(int i) const { return (var->knownIn(i)); } forceinline bool SetView::notContains(int i) const { return (var->knownOut(i)); } forceinline unsigned int SetView::cardMin(void) const { return var->cardMin(); } forceinline unsigned int SetView::cardMax(void) const { return var->cardMax(); } forceinline int SetView::lubMin(void) const { return var->lubMin(); } forceinline int SetView::lubMax(void) const { return var->lubMax(); } forceinline int SetView::lubMinN(int n) const { return var->lubMinN(n); } forceinline int SetView::lubMaxN(int n) const { return var->lubMaxN(n); } forceinline int SetView::glbMin(void) const { return var->glbMin(); } forceinline int SetView::glbMax(void) const { return var->glbMax(); } /* * Tells * */ forceinline ModEvent SetView::cardMin(Space* home, unsigned int m) { return var-> cardMin(home, m); } forceinline ModEvent SetView::cardMax(Space* home, unsigned int m) { return var-> cardMax(home, m); } forceinline ModEvent SetView::include (Space* home,int from, int to) { return (var->include(home,from,to)); } forceinline ModEvent SetView::include (Space* home,int n) { return (var->include(home,n)); } forceinline ModEvent SetView::exclude (Space* home,int n) { return (var->exclude(home, n)); } forceinline ModEvent SetView::intersect (Space* home,int from, int to) { return (var->intersect(home,from,to)); } forceinline ModEvent SetView::intersect (Space* home,int n) { return (var->intersect(home,n)); } template ModEvent SetView::includeI (Space* home, I& iter) { return (var->includeI(home, iter)); } forceinline ModEvent SetView::exclude (Space* home,int from, int to) { return (var->exclude(home,from,to)); } template ModEvent SetView::excludeI(Space* home, I& iter) { return var->excludeI(home, iter); } template ModEvent SetView::intersectI(Space* home, I& iter) { return var->intersectI(home, iter); } /* * Cloning * */ forceinline void SetView::update(Space* home, bool share, SetView& y) { var = y.var->copy(home,share); } /** * \brief %Range iterator for least upper bound of set variable views * \ingroup TaskActorSetView */ template <> class LubRanges : public LubRanges { public: /// \name Constructors and initialization //@{ /// Default constructor LubRanges(void); /// Initialize with ranges for view \a x LubRanges(const SetView& x); /// Initialize with ranges for view \a x void init(const SetView& x); //@} }; forceinline LubRanges::LubRanges(void) {} forceinline LubRanges::LubRanges(const SetView& x) : LubRanges(x.variable()) {} forceinline void LubRanges::init(const SetView& x) { LubRanges::init(x.variable()); } /** * \brief %Range iterator for greatest lower bound of set variable views * \ingroup TaskActorSetView */ template <> class GlbRanges : public GlbRanges { public: /// \name Constructors and initialization //@{ /// Default constructor GlbRanges(void); /// Initialize with ranges for view \a x GlbRanges(const SetView& x); /// Initialize with ranges for view \a x void init(const SetView& x); }; forceinline GlbRanges::GlbRanges(void) {} forceinline GlbRanges::GlbRanges(const SetView& x) : GlbRanges(x.variable()) {} forceinline void GlbRanges::init(const SetView& x) { GlbRanges::init(x.variable()); } }} // STATISTICS: set-var