1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package org.sat4j.tools;
31
32 import java.io.PrintStream;
33 import java.io.PrintWriter;
34 import java.util.Map;
35
36 import org.sat4j.specs.ContradictionException;
37 import org.sat4j.specs.IConstr;
38 import org.sat4j.specs.ISolver;
39 import org.sat4j.specs.ISolverService;
40 import org.sat4j.specs.IVec;
41 import org.sat4j.specs.IVecInt;
42 import org.sat4j.specs.SearchListener;
43 import org.sat4j.specs.TimeoutException;
44
45
46
47
48
49
50
51
52 public abstract class SolverDecorator<T extends ISolver> implements ISolver {
53
54
55
56
57 private static final long serialVersionUID = 1L;
58
59 public boolean isDBSimplificationAllowed() {
60 return this.solver.isDBSimplificationAllowed();
61 }
62
63 public void setDBSimplificationAllowed(boolean status) {
64 this.solver.setDBSimplificationAllowed(status);
65 }
66
67
68
69
70
71
72 public void setTimeoutOnConflicts(int count) {
73 this.solver.setTimeoutOnConflicts(count);
74 }
75
76
77
78
79
80
81
82 public void printInfos(PrintWriter out, String prefix) {
83 this.solver.printInfos(out, prefix);
84 }
85
86
87
88
89
90
91
92 public void printInfos(PrintWriter out) {
93 this.solver.printInfos(out);
94 }
95
96
97
98
99
100
101 public boolean isSatisfiable(boolean global) throws TimeoutException {
102 return this.solver.isSatisfiable(global);
103 }
104
105
106
107
108
109
110
111 public boolean isSatisfiable(IVecInt assumps, boolean global)
112 throws TimeoutException {
113 return this.solver.isSatisfiable(assumps, global);
114 }
115
116
117
118
119
120
121 public void clearLearntClauses() {
122 this.solver.clearLearntClauses();
123 }
124
125
126
127
128
129
130 public int[] findModel() throws TimeoutException {
131 return this.solver.findModel();
132 }
133
134
135
136
137
138
139 public int[] findModel(IVecInt assumps) throws TimeoutException {
140 return this.solver.findModel(assumps);
141 }
142
143
144
145
146
147
148 public boolean model(int var) {
149 return this.solver.model(var);
150 }
151
152 public void setExpectedNumberOfClauses(int nb) {
153 this.solver.setExpectedNumberOfClauses(nb);
154 }
155
156
157
158
159
160
161 public int getTimeout() {
162 return this.solver.getTimeout();
163 }
164
165
166
167
168 public long getTimeoutMs() {
169 return this.solver.getTimeoutMs();
170 }
171
172
173
174
175
176
177 public String toString(String prefix) {
178 return this.solver.toString(prefix);
179 }
180
181 @Override
182 public String toString() {
183 return toString("");
184 }
185
186
187
188
189
190
191
192 @Deprecated
193 public void printStat(PrintStream out, String prefix) {
194 this.solver.printStat(out, prefix);
195 }
196
197 public void printStat(PrintWriter out, String prefix) {
198 this.solver.printStat(out, prefix);
199 }
200
201 public void printStat(PrintWriter out) {
202 this.solver.printStat(out);
203 }
204
205 private T solver;
206
207
208
209
210 public SolverDecorator(T solver) {
211 this.solver = solver;
212 }
213
214 @Deprecated
215 public int newVar() {
216 return this.solver.newVar();
217 }
218
219
220
221
222
223
224 public int newVar(int howmany) {
225 return this.solver.newVar(howmany);
226 }
227
228
229
230
231
232
233 public IConstr addClause(IVecInt literals) throws ContradictionException {
234 return this.solver.addClause(literals);
235 }
236
237 public void addAllClauses(IVec<IVecInt> clauses)
238 throws ContradictionException {
239 this.solver.addAllClauses(clauses);
240 }
241
242
243
244
245 public IConstr addBlockingClause(IVecInt literals)
246 throws ContradictionException {
247 return this.solver.addBlockingClause(literals);
248 }
249
250
251
252
253
254
255 public IConstr addAtMost(IVecInt literals, int degree)
256 throws ContradictionException {
257 return this.solver.addAtMost(literals, degree);
258 }
259
260
261
262
263
264
265 public IConstr addAtLeast(IVecInt literals, int degree)
266 throws ContradictionException {
267 return this.solver.addAtLeast(literals, degree);
268 }
269
270
271
272
273
274
275 public int[] model() {
276 return this.solver.model();
277 }
278
279
280
281
282
283
284 public boolean isSatisfiable() throws TimeoutException {
285 return this.solver.isSatisfiable();
286 }
287
288
289
290
291
292
293 public boolean isSatisfiable(IVecInt assumps) throws TimeoutException {
294 return this.solver.isSatisfiable(assumps);
295 }
296
297
298
299
300
301
302 public void setTimeout(int t) {
303 this.solver.setTimeout(t);
304 }
305
306
307
308
309
310
311 public void setTimeoutMs(long t) {
312 this.solver.setTimeoutMs(t);
313 }
314
315
316
317
318
319
320 public void expireTimeout() {
321 this.solver.expireTimeout();
322 }
323
324
325
326
327
328
329 public int nConstraints() {
330 return this.solver.nConstraints();
331 }
332
333
334
335
336
337
338 public int nVars() {
339 return this.solver.nVars();
340 }
341
342
343
344
345
346
347 public void reset() {
348 this.solver.reset();
349 }
350
351 public T decorated() {
352 return this.solver;
353 }
354
355
356
357
358
359
360
361 public T clearDecorated() {
362 T decorated = this.solver;
363 this.solver = null;
364 return decorated;
365 }
366
367
368
369
370
371
372 public boolean removeConstr(IConstr c) {
373 return this.solver.removeConstr(c);
374 }
375
376
377
378
379
380
381 public Map<String, Number> getStat() {
382 return this.solver.getStat();
383 }
384
385
386
387
388 public <S extends ISolverService> void setSearchListener(
389 SearchListener<S> sl) {
390 this.solver.setSearchListener(sl);
391 }
392
393
394
395
396 public int nextFreeVarId(boolean reserve) {
397 return this.solver.nextFreeVarId(reserve);
398 }
399
400
401
402
403 public boolean removeSubsumedConstr(IConstr c) {
404 return this.solver.removeSubsumedConstr(c);
405 }
406
407
408
409
410 public <S extends ISolverService> SearchListener<S> getSearchListener() {
411 return this.solver.getSearchListener();
412 }
413
414
415
416
417 public boolean isVerbose() {
418 return this.solver.isVerbose();
419 }
420
421
422
423
424 public void setVerbose(boolean value) {
425 this.solver.setVerbose(value);
426 }
427
428
429
430
431 public void setLogPrefix(String prefix) {
432 this.solver.setLogPrefix(prefix);
433 }
434
435
436
437
438 public String getLogPrefix() {
439 return this.solver.getLogPrefix();
440 }
441
442
443
444
445 public IVecInt unsatExplanation() {
446 return this.solver.unsatExplanation();
447 }
448
449
450
451
452 public int[] primeImplicant() {
453 return this.solver.primeImplicant();
454 }
455
456
457
458
459 public IConstr addExactly(IVecInt literals, int n)
460 throws ContradictionException {
461 return this.solver.addExactly(literals, n);
462 }
463
464
465
466
467 public int[] modelWithInternalVariables() {
468 return this.solver.modelWithInternalVariables();
469 }
470
471
472
473
474 public int realNumberOfVariables() {
475 return this.solver.realNumberOfVariables();
476 }
477
478
479
480
481 public void registerLiteral(int p) {
482 this.solver.registerLiteral(p);
483 }
484
485
486
487
488 public boolean isSolverKeptHot() {
489 return this.solver.isSolverKeptHot();
490 }
491
492
493
494
495 public void setKeepSolverHot(boolean value) {
496 this.solver.setKeepSolverHot(value);
497 }
498
499
500
501
502 public boolean primeImplicant(int p) {
503 return this.solver.primeImplicant(p);
504 }
505
506
507
508
509 public ISolver getSolvingEngine() {
510 return this.solver.getSolvingEngine();
511 }
512
513 }