Generated on Wed Nov 1 15:04:45 2006 for Gecode by doxygen 1.4.5

projector-set.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2006
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-08-25 17:31:32 +0200 (Fri, 25 Aug 2006) $ by $Author: tack $
00010  *     $Revision: 3573 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 namespace Gecode {
00023 
00024   forceinline
00025   ProjectorSet::ProjectorSet(void) : _ps(0), _count(0), _arity(0) {}
00026 
00027   forceinline void
00028   ProjectorSet::update(Space* home, bool share, ProjectorSet& p) {
00029     _ps.update(share, p._ps);
00030     _count = p._count;
00031     _arity = p._arity;
00032   }
00033   
00034   forceinline int
00035   ProjectorSet::arity(void) const { return _arity; }
00036 
00037   template <bool negated>
00038   inline ExecStatus
00039   ProjectorSet::propagate(Space* home, ViewArray<Set::SetView>& x) {
00040     int failedCount = 0;
00041     for (int i=_count; i--; ) {
00042       ExecStatus es = _ps[i].propagate<negated>(home, x);
00043       switch (es) {
00044       case ES_FAILED:
00045         if (!negated)
00046           return ES_FAILED;
00047         failedCount++;
00048         break;
00049       case ES_SUBSUMED:
00050         return ES_SUBSUMED;
00051       default:
00052         break;
00053       }
00054     }
00055     return failedCount==_count ? ES_FAILED : ES_NOFIX;
00056   }
00057 
00058   forceinline int
00059   ProjectorSet::size(void) const { return _count; }
00060 
00061   forceinline const Projector&
00062   ProjectorSet::operator[](int i) const { return _ps[i]; }
00063 
00064 }
00065 
00066 // STATISTICS: set-prop