Sha256: 00f27aec5f9eef343a1571c78c4ca66bd30723797d6f12cdfda4528489a76056

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

/*
 *  Main authors:
 *     Guido Tack <tack@gecode.org>
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Contributing authors:
 *     Gabor Szokoli <szokoli@gecode.org>
 *
 *  Copyright:
 *     Guido Tack, 2004
 *     Christian Schulte, 2004
 *     Gabor Szokoli, 2004
 *
 *  Last modified:
 *     $Date: 2006-03-29 14:18:06 +0200 (Wed, 29 Mar 2006) $ by $Author: tack $
 *     $Revision: 3130 $
 *
 *  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 { namespace Sequence {

  /*
   * "Sequenced union" propagator
   *
   */

  forceinline
  SeqU::SeqU(Space* home, ViewArray<SetView>& x, SetView y)
    : NaryOnePropagator<SetView,PC_SET_ANY>(home,x, y) {}

  forceinline
  SeqU::SeqU(Space* home, bool share, SeqU& p)
    : NaryOnePropagator<SetView,PC_SET_ANY>(home,share,p) {
    unionOfDets.update(home, p.unionOfDets);
  }

  forceinline ExecStatus
  SeqU::post(Space* home, ViewArray<SetView> x, SetView y) {
    switch (x.size()) {
    case 0:
      GECODE_ME_CHECK(y.cardMax(home, 0));
      return ES_OK;
    case 1:
      return Rel::Eq<SetView,SetView>::post(home, x[0], y);
    default:
      if (x.shared() || x.shared(y))
	return ES_FAILED;
      (void) new (home) SeqU(home,x,y);
      return ES_OK;
    }
  }

}}}

// 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/sequence/seq-u.icc