~ubuntu-branches/ubuntu/natty/gecode/natty

« back to all changes in this revision

Viewing changes to int/var/int.cc

  • Committer: Bazaar Package Importer
  • Author(s): Kari Pahula
  • Date: 2005-12-24 07:51:25 UTC
  • Revision ID: james.westby@ubuntu.com-20051224075125-klkiqofvbfvusfvt
Tags: upstream-1.0.0.dfsg.1
ImportĀ upstreamĀ versionĀ 1.0.0.dfsg.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Main authors:
 
3
 *     Christian Schulte <schulte@gecode.org>
 
4
 *
 
5
 *  Copyright:
 
6
 *     Christian Schulte, 2002
 
7
 *
 
8
 *  Last modified:
 
9
 *     $Date: 2005-10-11 17:57:38 +0200 (Tue, 11 Oct 2005) $ by $Author: tack $
 
10
 *     $Revision: 2334 $
 
11
 *
 
12
 *  This file is part of Gecode, the generic constraint
 
13
 *  development environment:
 
14
 *     http://www.gecode.org
 
15
 *
 
16
 *  See the file "LICENSE" for information on usage and
 
17
 *  redistribution of this file, and for a
 
18
 *     DISCLAIMER OF ALL WARRANTIES.
 
19
 *
 
20
 */
 
21
 
 
22
#include "int.hh"
 
23
 
 
24
namespace Gecode {
 
25
 
 
26
  IntVar::IntVar(Space* home, int min, int max)
 
27
    : var(new (home) Int::IntVarImp(home,min,max)) {
 
28
    if ((min < Limits::Int::int_min) || (max > Limits::Int::int_max))
 
29
      throw Int::VariableOutOfRangeDomain("IntVar");
 
30
    if (min > max)
 
31
      throw Int::VariableEmptyDomain("IntVar");
 
32
  }
 
33
 
 
34
  IntVar::IntVar(Space* home, const IntSet& ds)
 
35
    : var(new (home) Int::IntVarImp(home,ds)) {
 
36
    if ((ds.min() < Limits::Int::int_min) || (ds.max() > Limits::Int::int_max))
 
37
      throw Int::VariableOutOfRangeDomain("IntVar");
 
38
    if (ds.size() == 0)
 
39
      throw Int::VariableEmptyDomain("IntVar");
 
40
  }
 
41
 
 
42
}
 
43
 
 
44
// STATISTICS: int-var
 
45