Sha256: e248c9f0c70bc13595e7c85d59b0f7a706bff04d1a317630a7e1b5c8dafd13a4

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2004
 *
 *  Last modified:
 *     $Date: 2006-08-04 15:23:45 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $
 *     $Revision: 3509 $
 *
 *  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/element.hh"

namespace Gecode {

  using namespace Int;

  void
  element(Space* home, const IntArgs& c, IntVar x0, IntVar x1,
	  IntConLevel) {
    if (home->failed()) return;
    Element::IntSharedArray cs(c.size());
    for (int i = c.size(); i--; )
      if ((c[i] < Limits::Int::int_min) || (c[i] > Limits::Int::int_max))
	throw NumericalOverflow("Int::element");
      else
	cs[i] = c[i];
    GECODE_ES_FAIL(home,(Element::Int<IntView,IntView>::post(home,cs,x0,x1)));
  }

  void
  element(Space* home, const IntVarArgs& c, IntVar x0, IntVar x1,
	  IntConLevel icl) {
    if (home->failed()) return;
    Element::IdxView<IntView>* iv = Element::IdxView<IntView>::init(home,c);
    if (icl == ICL_BND) {
      GECODE_ES_FAIL(home,(Element::ViewBnd<IntView,IntView>
			   ::post(home,iv,c.size(),x0,x1)));
    } else {
      GECODE_ES_FAIL(home,(Element::ViewDom<IntView,IntView>
			   ::post(home,iv,c.size(),x0,x1)));
    }
  }

}

// STATISTICS: int-post

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gecoder-with-gecode-0.7.1 ext/gecode-1.3.1/gecode/int/element.cc