int.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "gecode/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::IntVar");
00030 if (min > max)
00031 throw Int::VariableEmptyDomain("IntVar::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::IntVar");
00038 if (ds.size() == 0)
00039 throw Int::VariableEmptyDomain("IntVar::IntVar");
00040 }
00041
00042 void
00043 IntVar::init(Space* home, int min, int max) {
00044 if ((min < Limits::Int::int_min) || (max > Limits::Int::int_max))
00045 throw Int::VariableOutOfRangeDomain("IntVar::init");
00046 if (min > max)
00047 throw Int::VariableEmptyDomain("IntVar::init");
00048 var = new (home) Int::IntVarImp(home,min,max);
00049 }
00050
00051 void
00052 IntVar::init(Space* home, const IntSet& ds) {
00053 if ((ds.min() < Limits::Int::int_min) || (ds.max() > Limits::Int::int_max))
00054 throw Int::VariableOutOfRangeDomain("IntVar::init");
00055 if (ds.size() == 0)
00056 throw Int::VariableEmptyDomain("IntVar::init");
00057 var = new (home) Int::IntVarImp(home,ds);
00058 }
00059
00060 }
00061
00062
00063