22
22
import org .sosy_lab .java_smt .api .Formula ;
23
23
import org .sosy_lab .java_smt .api .NumeralFormula .IntegerFormula ;
24
24
import org .sosy_lab .java_smt .api .NumeralFormula .RationalFormula ;
25
+ import org .sosy_lab .java_smt .api .SolverException ;
25
26
import org .sosy_lab .java_smt .api .StringFormula ;
26
27
27
28
@ SuppressWarnings ("ClassTypeParameterName" )
@@ -40,22 +41,22 @@ protected AbstractEvaluator(
40
41
@ SuppressWarnings ("unchecked" )
41
42
@ Nullable
42
43
@ Override
43
- public final <T extends Formula > T eval (T f ) {
44
+ public final <T extends Formula > T eval (T f ) throws InterruptedException , SolverException {
44
45
Preconditions .checkState (!isClosed ());
45
46
TFormulaInfo evaluation = evalImpl (creator .extractInfo (f ));
46
47
return evaluation == null ? null : (T ) creator .encapsulateWithTypeOf (evaluation );
47
48
}
48
49
49
50
@ Nullable
50
51
@ Override
51
- public final BigInteger evaluate (IntegerFormula f ) {
52
+ public final BigInteger evaluate (IntegerFormula f ) throws InterruptedException , SolverException {
52
53
Preconditions .checkState (!isClosed ());
53
54
return (BigInteger ) evaluateImpl (creator .extractInfo (f ));
54
55
}
55
56
56
57
@ Nullable
57
58
@ Override
58
- public Rational evaluate (RationalFormula f ) {
59
+ public Rational evaluate (RationalFormula f ) throws InterruptedException , SolverException {
59
60
Object value = evaluateImpl (creator .extractInfo (f ));
60
61
if (value instanceof BigInteger ) {
61
62
// We simplified the value internally. Here, we need to convert it back to Rational.
@@ -67,41 +68,43 @@ public Rational evaluate(RationalFormula f) {
67
68
68
69
@ Nullable
69
70
@ Override
70
- public final Boolean evaluate (BooleanFormula f ) {
71
+ public final Boolean evaluate (BooleanFormula f ) throws InterruptedException , SolverException {
71
72
Preconditions .checkState (!isClosed ());
72
73
return (Boolean ) evaluateImpl (creator .extractInfo (f ));
73
74
}
74
75
75
76
@ Nullable
76
77
@ Override
77
- public final String evaluate (StringFormula f ) {
78
+ public final String evaluate (StringFormula f ) throws InterruptedException , SolverException {
78
79
Preconditions .checkState (!isClosed ());
79
80
return (String ) evaluateImpl (creator .extractInfo (f ));
80
81
}
81
82
82
83
@ Nullable
83
84
@ Override
84
- public final String evaluate (EnumerationFormula f ) {
85
+ public final String evaluate (EnumerationFormula f ) throws InterruptedException , SolverException {
85
86
Preconditions .checkState (!isClosed ());
86
87
return (String ) evaluateImpl (creator .extractInfo (f ));
87
88
}
88
89
89
90
@ Override
90
- public final @ Nullable FloatingPointNumber evaluate (FloatingPointFormula f ) {
91
+ public final @ Nullable FloatingPointNumber evaluate (FloatingPointFormula f )
92
+ throws InterruptedException , SolverException {
91
93
Preconditions .checkState (!isClosed ());
92
94
return (FloatingPointNumber ) evaluateImpl (creator .extractInfo (f ));
93
95
}
94
96
95
97
@ Nullable
96
98
@ Override
97
- public final BigInteger evaluate (BitvectorFormula f ) {
99
+ public final BigInteger evaluate (BitvectorFormula f )
100
+ throws InterruptedException , SolverException {
98
101
Preconditions .checkState (!isClosed ());
99
102
return (BigInteger ) evaluateImpl (creator .extractInfo (f ));
100
103
}
101
104
102
105
@ Nullable
103
106
@ Override
104
- public final Object evaluate (Formula f ) {
107
+ public final Object evaluate (Formula f ) throws InterruptedException , SolverException {
105
108
Preconditions .checkState (!isClosed ());
106
109
Preconditions .checkArgument (
107
110
!(f instanceof ArrayFormula ),
@@ -114,15 +117,16 @@ public final Object evaluate(Formula f) {
114
117
* set in the model and evaluation aborts, return <code>null</code>.
115
118
*/
116
119
@ Nullable
117
- protected abstract TFormulaInfo evalImpl (TFormulaInfo formula );
120
+ protected abstract TFormulaInfo evalImpl (TFormulaInfo formula )
121
+ throws InterruptedException , SolverException ;
118
122
119
123
/**
120
124
* Simplify the given formula and replace all symbols with their model values. If a symbol is not
121
125
* set in the model and evaluation aborts, return <code>null</code>. Afterwards convert the
122
126
* formula into a Java object as far as possible, i.e., try to match a primitive or simple type.
123
127
*/
124
128
@ Nullable
125
- protected final Object evaluateImpl (TFormulaInfo f ) {
129
+ protected final Object evaluateImpl (TFormulaInfo f ) throws InterruptedException , SolverException {
126
130
Preconditions .checkState (!isClosed ());
127
131
TFormulaInfo evaluatedF = evalImpl (f );
128
132
return evaluatedF == null ? null : creator .convertValue (f , evaluatedF );
0 commit comments