TdZdd
1.1
A top-down/breadth-first decision diagram manipulation framework
include
tdzdd
util
IntSubset.hpp
1
/*
2
* TdZdd: a Top-down/Breadth-first Decision Diagram Manipulation Framework
3
* by Hiroaki Iwashita <iwashita@erato.ist.hokudai.ac.jp>
4
* Copyright (c) 2014 ERATO MINATO Project
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a
7
* copy of this software and associated documentation files (the "Software"),
8
* to deal in the Software without restriction, including without limitation
9
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
* and/or sell copies of the Software, and to permit persons to whom the
11
* Software is furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
* DEALINGS IN THE SOFTWARE.
23
*/
24
25
#pragma once
26
27
#include <climits>
28
29
namespace
tdzdd
{
30
31
struct
IntSubset {
32
virtual
~IntSubset() {
33
}
34
35
virtual
bool
contains(
int
x)
const
= 0;
36
37
virtual
int
lowerBound()
const
{
38
return
0;
39
}
40
41
virtual
int
upperBound()
const
{
42
return
INT_MAX;
43
}
44
};
45
46
class
IntRange:
public
IntSubset {
47
int
const
min;
48
int
const
max;
49
int
const
step;
50
51
public
:
52
IntRange(
int
min = 0,
int
max = INT_MAX,
int
step = 1)
53
: min(min), max(max), step(step) {
54
}
55
56
bool
contains(
int
x)
const
{
57
if
(x < min || max < x)
return
false
;
58
return
(x - min) % step == 0;
59
}
60
61
int
lowerBound()
const
{
62
return
min;
63
}
64
65
int
upperBound()
const
{
66
return
max;
67
}
68
};
69
70
}
// namespace tdzdd
tdzdd
Definition:
DataTable.hpp:32
Generated on Sat Sep 19 2020 11:22:23 for TdZdd by
1.8.13