main page
modules
namespaces
classes
files
Gecode home
Generated on Wed Jan 1 2020 10:37:59 for Gecode by
doxygen
1.8.16
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
* This file is part of Gecode, the generic constraint
10
* development environment:
11
* http://www.gecode.org
12
*
13
* Permission is hereby granted, free of charge, to any person obtaining
14
* a copy of this software and associated documentation files (the
15
* "Software"), to deal in the Software without restriction, including
16
* without limitation the rights to use, copy, modify, merge, publish,
17
* distribute, sublicense, and/or sell copies of the Software, and to
18
* permit persons to whom the Software is furnished to do so, subject to
19
* the following conditions:
20
*
21
* The above copyright notice and this permission notice shall be
22
* included in all copies or substantial portions of the Software.
23
*
24
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
*
32
*/
33
34
namespace
Test
{
namespace
Set {
35
36
inline
37
std::string
38
SetTest::str
(
int
i
) {
39
std::stringstream s;
40
s <<
i
;
41
return
s.str();
42
}
43
44
inline
45
std::string
46
SetTest::str
(
Gecode::SetRelType
srt) {
47
switch
(srt) {
48
case
Gecode::SRT_EQ
:
return
"Eq"
;
49
case
Gecode::SRT_LQ
:
return
"Lq"
;
50
case
Gecode::SRT_LE
:
return
"Le"
;
51
case
Gecode::SRT_GQ
:
return
"Gq"
;
52
case
Gecode::SRT_GR
:
return
"Gr"
;
53
case
Gecode::SRT_NQ
:
return
"Nq"
;
54
case
Gecode::SRT_SUB
:
return
"Sub"
;
55
case
Gecode::SRT_SUP
:
return
"Sup"
;
56
case
Gecode::SRT_DISJ
:
return
"Disj"
;
57
case
Gecode::SRT_CMPL
:
return
"Cmpl"
;
58
}
59
return
""
;
60
}
61
62
inline
63
std::string
64
SetTest::str
(
Gecode::SetOpType
sot) {
65
switch
(sot) {
66
case
Gecode::SOT_UNION
:
return
"Union"
;
67
case
Gecode::SOT_DUNION
:
return
"DUnion"
;
68
case
Gecode::SOT_INTER
:
return
"Inter"
;
69
case
Gecode::SOT_MINUS
:
return
"Minus"
;
70
}
71
return
""
;
72
}
73
74
inline
75
std::string
76
SetTest::str
(
const
Gecode::IntArgs
&
x
) {
77
std::string s =
""
;
78
for
(
int
i
=0;
i
<
x
.size()-1;
i
++)
79
s +=
str
(
x
[
i
]) +
","
;
80
return
"["
+ s +
str
(
x
[
x
.size()-1]) +
"]"
;
81
}
82
83
inline
84
SetRelTypes::SetRelTypes
(
void
)
85
:
i
(sizeof(srts)/sizeof(
Gecode
::
SetRelType
)-1) {}
86
inline
bool
87
SetRelTypes::operator()
(
void
)
const
{
88
return
i>=0;
89
}
90
inline
void
91
SetRelTypes::operator++
(
void
) {
92
i--;
93
}
94
inline
Gecode::SetRelType
95
SetRelTypes::srt
(
void
)
const
{
96
return
srts[i];
97
}
98
99
inline
100
SetOpTypes::SetOpTypes
(
void
)
101
:
i
(sizeof(sots)/sizeof(
Gecode
::
SetOpType
)-1) {}
102
inline
bool
103
SetOpTypes::operator()
(
void
)
const
{
104
return
i>=0;
105
}
106
inline
void
107
SetOpTypes::operator++
(
void
) {
108
i--;
109
}
110
inline
Gecode::SetOpType
111
SetOpTypes::sot
(
void
)
const
{
112
return
sots[i];
113
}
114
115
}}
116
117
// STATISTICS: test-set
Test::Set::SetOpTypes::operator()
bool operator()(void) const
Test whether iterator is done.
Definition:
set.hpp:103
Gecode::SRT_LQ
Less or equal ( )
Definition:
set.hh:650
Gecode::SetOpType
SetOpType
Common operations for sets.
Definition:
set.hh:660
Gecode::SRT_GQ
Greater or equal ( )
Definition:
set.hh:652
Gecode::SRT_SUB
Subset ( )
Definition:
set.hh:646
Gecode::SRT_SUP
Superset ( )
Definition:
set.hh:647
Gecode::SOT_INTER
Intersection
Definition:
set.hh:663
Gecode::SRT_DISJ
Disjoint ( )
Definition:
set.hh:648
Gecode
Gecode toplevel namespace
x
Node * x
Pointer to corresponding Boolean expression node.
Definition:
bool-expr.cpp:249
Gecode::SRT_EQ
Equality ( )
Definition:
set.hh:644
Test::Set::SetRelTypes::srt
Gecode::SetRelType srt(void) const
Return current relation type.
Definition:
set.hpp:95
Gecode::SOT_UNION
Union.
Definition:
set.hh:661
Test::Set::SetOpTypes::sot
Gecode::SetOpType sot(void) const
Return current operation type.
Definition:
set.hpp:111
Gecode::SetRelType
SetRelType
Common relation types for sets.
Definition:
set.hh:643
Gecode::SRT_LE
Less ( )
Definition:
set.hh:651
Gecode::SRT_GR
Greater ( )
Definition:
set.hh:653
Gecode::SRT_NQ
Disequality ( )
Definition:
set.hh:645
Test::Set::SetTest::str
static std::string str(Gecode::SetRelType srt)
Map set relation to string.
Definition:
set.hpp:46
Gecode::SRT_CMPL
Complement.
Definition:
set.hh:649
Gecode::SOT_DUNION
Disjoint union.
Definition:
set.hh:662
Test::Set::SetRelTypes::operator()
bool operator()(void) const
Test whether iterator is done.
Definition:
set.hpp:87
Test
General test support.
Definition:
afc.cpp:39
Test::Set::SetRelTypes::SetRelTypes
SetRelTypes(void)
Initialize iterator.
Definition:
set.hpp:84
Test::Set::SetOpTypes::operator++
void operator++(void)
Increment to next operation type.
Definition:
set.hpp:107
Gecode::SOT_MINUS
Difference.
Definition:
set.hh:664
Test::Set::SetRelTypes::operator++
void operator++(void)
Increment to next relation type.
Definition:
set.hpp:91
Gecode::IntArgs
Passing integer arguments.
Definition:
int.hh:628
Test::Set::SetOpTypes::SetOpTypes
SetOpTypes(void)
Initialize iterator.
Definition:
set.hpp:100
Test::Int::Basic::i
Gecode::IntArgs i({1, 2, 3, 4})