int.cc
Go to the documentation of this file.00001 /* 00002 * Main authors: 00003 * Christian Schulte <schulte@gecode.org> 00004 * 00005 * Copyright: 00006 * Christian Schulte, 2002 00007 * 00008 * Last modified: 00009 * $Date: 2005-10-11 17:57:38 +0200 (Tue, 11 Oct 2005) $ by $Author: tack $ 00010 * $Revision: 2334 $ 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 #include "int.hh" 00023 00024 namespace Gecode { 00025 00026 IntVar::IntVar(Space* home, int min, int max) 00027 : var(new (home) Int::IntVarImp(home,min,max)) { 00028 if ((min < Limits::Int::int_min) || (max > Limits::Int::int_max)) 00029 throw Int::VariableOutOfRangeDomain("IntVar"); 00030 if (min > max) 00031 throw Int::VariableEmptyDomain("IntVar"); 00032 } 00033 00034 IntVar::IntVar(Space* home, const IntSet& ds) 00035 : var(new (home) Int::IntVarImp(home,ds)) { 00036 if ((ds.min() < Limits::Int::int_min) || (ds.max() > Limits::Int::int_max)) 00037 throw Int::VariableOutOfRangeDomain("IntVar"); 00038 if (ds.size() == 0) 00039 throw Int::VariableEmptyDomain("IntVar"); 00040 } 00041 00042 } 00043 00044 // STATISTICS: int-var 00045