Sha256: d4148ea19d25e4aa169193af3c0dd56196087be05827d1cc685095bce82d9442

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

/*
 *  Main authors:
 *     Guido Tack <tack@gecode.org>
 *
 *  Copyright:
 *     Guido Tack, 2006
 *
 *  Last modified:
 *     $Date: 2006-08-25 17:31:32 +0200 (Fri, 25 Aug 2006) $ by $Author: tack $
 *     $Revision: 3573 $
 *
 *  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 {

  forceinline
  ProjectorSet::ProjectorSet(void) : _ps(0), _count(0), _arity(0) {}

  forceinline void
  ProjectorSet::update(Space* home, bool share, ProjectorSet& p) {
    _ps.update(share, p._ps);
    _count = p._count;
    _arity = p._arity;
  }
  
  forceinline int
  ProjectorSet::arity(void) const { return _arity; }

  template <bool negated>
  inline ExecStatus
  ProjectorSet::propagate(Space* home, ViewArray<Set::SetView>& x) {
    int failedCount = 0;
    for (int i=_count; i--; ) {
      ExecStatus es = _ps[i].propagate<negated>(home, x);
      switch (es) {
      case ES_FAILED:
	if (!negated)
	  return ES_FAILED;
	failedCount++;
	break;
      case ES_SUBSUMED:
	return ES_SUBSUMED;
      default:
	break;
      }
    }
    return failedCount==_count ? ES_FAILED : ES_NOFIX;
  }

  forceinline int
  ProjectorSet::size(void) const { return _count; }

  forceinline const Projector&
  ProjectorSet::operator[](int i) const { return _ps[i]; }

}

// STATISTICS: set-prop

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gecoder-with-gecode-0.7.1 ext/gecode-1.3.1/gecode/set/projectors/projector-set.icc