line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
| Copyright (c) 2013-2017, Nucleic Development Team. |
3
|
|
|
|
|
|
|
| |
4
|
|
|
|
|
|
|
| Distributed under the terms of the Modified BSD License. |
5
|
|
|
|
|
|
|
| |
6
|
|
|
|
|
|
|
| The full license is in the file LICENSE, distributed with this software. |
7
|
|
|
|
|
|
|
|----------------------------------------------------------------------------*/ |
8
|
|
|
|
|
|
|
#pragma once |
9
|
|
|
|
|
|
|
#include <exception> |
10
|
|
|
|
|
|
|
#include <string> |
11
|
|
|
|
|
|
|
#include "constraint.h" |
12
|
|
|
|
|
|
|
#include "variable.h" |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
namespace kiwi |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
class UnsatisfiableConstraint : public std::exception |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
public: |
21
|
0
|
|
|
|
|
|
UnsatisfiableConstraint(Constraint constraint) : m_constraint(std::move(constraint)) {} |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
~UnsatisfiableConstraint() noexcept {} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
const char *what() const noexcept |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
|
|
|
return "The constraint can not be satisfied."; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
const Constraint &constraint() const |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
return m_constraint; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
private: |
36
|
|
|
|
|
|
|
Constraint m_constraint; |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
class UnknownConstraint : public std::exception |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
public: |
43
|
0
|
|
|
|
|
|
UnknownConstraint(Constraint constraint) : m_constraint(std::move(constraint)) {} |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
~UnknownConstraint() noexcept {} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
const char *what() const noexcept |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
|
return "The constraint has not been added to the solver."; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
const Constraint &constraint() const |
53
|
|
|
|
|
|
|
{ |
54
|
|
|
|
|
|
|
return m_constraint; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
private: |
58
|
|
|
|
|
|
|
Constraint m_constraint; |
59
|
|
|
|
|
|
|
}; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
class DuplicateConstraint : public std::exception |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
public: |
65
|
0
|
|
|
|
|
|
DuplicateConstraint(Constraint constraint) : m_constraint(std::move(constraint)) {} |
66
|
|
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
|
~DuplicateConstraint() noexcept {} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
const char *what() const noexcept |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
|
|
|
return "The constraint has already been added to the solver."; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
const Constraint &constraint() const |
75
|
|
|
|
|
|
|
{ |
76
|
|
|
|
|
|
|
return m_constraint; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
private: |
80
|
|
|
|
|
|
|
Constraint m_constraint; |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
class UnknownEditVariable : public std::exception |
84
|
|
|
|
|
|
|
{ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
public: |
87
|
0
|
|
|
|
|
|
UnknownEditVariable(Variable variable) : m_variable(std::move(variable)) {} |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
~UnknownEditVariable() noexcept {} |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
const char *what() const noexcept |
92
|
|
|
|
|
|
|
{ |
93
|
0
|
|
|
|
|
|
return "The edit variable has not been added to the solver."; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
const Variable &variable() const |
97
|
|
|
|
|
|
|
{ |
98
|
|
|
|
|
|
|
return m_variable; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
private: |
102
|
|
|
|
|
|
|
Variable m_variable; |
103
|
|
|
|
|
|
|
}; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
class DuplicateEditVariable : public std::exception |
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
public: |
109
|
0
|
|
|
|
|
|
DuplicateEditVariable(Variable variable) : m_variable(std::move(variable)) {} |
110
|
|
|
|
|
|
|
|
111
|
0
|
0
|
|
|
|
|
~DuplicateEditVariable() noexcept {} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
const char *what() const noexcept |
114
|
|
|
|
|
|
|
{ |
115
|
0
|
|
|
|
|
|
return "The edit variable has already been added to the solver."; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
const Variable &variable() const |
119
|
|
|
|
|
|
|
{ |
120
|
|
|
|
|
|
|
return m_variable; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
private: |
124
|
|
|
|
|
|
|
Variable m_variable; |
125
|
|
|
|
|
|
|
}; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
class BadRequiredStrength : public std::exception |
128
|
|
|
|
|
|
|
{ |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
public: |
131
|
0
|
|
|
|
|
|
BadRequiredStrength() {} |
132
|
|
|
|
|
|
|
|
133
|
0
|
0
|
|
|
|
|
~BadRequiredStrength() noexcept {} |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
const char *what() const noexcept |
136
|
|
|
|
|
|
|
{ |
137
|
0
|
|
|
|
|
|
return "A required strength cannot be used in this context."; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
}; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
class InternalSolverError : public std::exception |
142
|
|
|
|
|
|
|
{ |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
public: |
145
|
|
|
|
|
|
|
InternalSolverError() : m_msg("An internal solver error ocurred.") {} |
146
|
|
|
|
|
|
|
|
147
|
0
|
0
|
|
|
|
|
InternalSolverError(const char *msg) : m_msg(msg) {} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
InternalSolverError(std::string msg) : m_msg(std::move(msg)) {} |
150
|
|
|
|
|
|
|
|
151
|
0
|
0
|
|
|
|
|
~InternalSolverError() noexcept {} |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
const char *what() const noexcept |
154
|
|
|
|
|
|
|
{ |
155
|
0
|
|
|
|
|
|
return m_msg.c_str(); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
private: |
159
|
|
|
|
|
|
|
std::string m_msg; |
160
|
|
|
|
|
|
|
}; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
} // namespace kiwi |