main page
modules
namespaces
classes
files
Gecode home
Generated on Tue Mar 5 2013 22:37:30 for Gecode by
doxygen
1.8.3.1
test
set.hpp
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Guido Tack <tack@gecode.org>
5
*
6
* Copyright:
7
* Guido Tack, 2005
8
*
9
* Last modified:
10
* $Date: 2011-08-25 00:34:16 +1000 (Thu, 25 Aug 2011) $ by $Author: tack $
11
* $Revision: 12346 $
12
*
13
* This file is part of Gecode, the generic constraint
14
* development environment:
15
* http://www.gecode.org
16
*
17
* Permission is hereby granted, free of charge, to any person obtaining
18
* a copy of this software and associated documentation files (the
19
* "Software"), to deal in the Software without restriction, including
20
* without limitation the rights to use, copy, modify, merge, publish,
21
* distribute, sublicense, and/or sell copies of the Software, and to
22
* permit persons to whom the Software is furnished to do so, subject to
23
* the following conditions:
24
*
25
* The above copyright notice and this permission notice shall be
26
* included in all copies or substantial portions of the Software.
27
*
28
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
*
36
*/
37
38
namespace
Test {
namespace
Set {
39
40
inline
41
std::string
42
SetTest::str
(
int
i
) {
43
std::stringstream s;
44
s <<
i
;
45
return
s.str();
46
}
47
48
inline
49
std::string
50
SetTest::str
(
Gecode::SetRelType
srt) {
51
switch
(srt) {
52
case
Gecode::SRT_EQ
:
return
"Eq"
;
53
case
Gecode::SRT_LQ
:
return
"Lq"
;
54
case
Gecode::SRT_LE
:
return
"Le"
;
55
case
Gecode::SRT_GQ
:
return
"Gq"
;
56
case
Gecode::SRT_GR
:
return
"Gr"
;
57
case
Gecode::SRT_NQ
:
return
"Nq"
;
58
case
Gecode::SRT_SUB
:
return
"Sub"
;
59
case
Gecode::SRT_SUP
:
return
"Sup"
;
60
case
Gecode::SRT_DISJ
:
return
"Disj"
;
61
case
Gecode::SRT_CMPL
:
return
"Cmpl"
;
62
}
63
return
""
;
64
}
65
66
inline
67
std::string
68
SetTest::str
(
Gecode::SetOpType
sot) {
69
switch
(sot) {
70
case
Gecode::SOT_UNION
:
return
"Union"
;
71
case
Gecode::SOT_DUNION
:
return
"DUnion"
;
72
case
Gecode::SOT_INTER
:
return
"Inter"
;
73
case
Gecode::SOT_MINUS
:
return
"Minus"
;
74
}
75
return
""
;
76
}
77
78
inline
79
std::string
80
SetTest::str
(
const
Gecode::IntArgs
& x) {
81
std::string s =
""
;
82
for
(
int
i
=0;
i
<x.
size
()-1;
i
++)
83
s +=
str
(x[
i
]) +
","
;
84
return
"["
+ s +
str
(x[x.
size
()-1]) +
"]"
;
85
}
86
87
inline
88
SetRelTypes::SetRelTypes
(
void
)
89
:
i
(sizeof(srts)/sizeof(Gecode::
SetRelType
)-1) {}
90
inline
bool
91
SetRelTypes::operator()
(
void
)
const
{
92
return
i>=0;
93
}
94
inline
void
95
SetRelTypes::operator++
(
void
) {
96
i--;
97
}
98
inline
Gecode::SetRelType
99
SetRelTypes::srt
(
void
)
const
{
100
return
srts[i];
101
}
102
103
inline
104
SetOpTypes::SetOpTypes
(
void
)
105
:
i
(sizeof(sots)/sizeof(Gecode::
SetOpType
)-1) {}
106
inline
bool
107
SetOpTypes::operator()
(
void
)
const
{
108
return
i>=0;
109
}
110
inline
void
111
SetOpTypes::operator++
(
void
) {
112
i--;
113
}
114
inline
Gecode::SetOpType
115
SetOpTypes::sot
(
void
)
const
{
116
return
sots[i];
117
}
118
119
}}
120
121
// STATISTICS: test-set