$*.cpp
JniUtils.lo: src/cvc3/JniUtils.cpp .headers
- $(AM_V_CXX)$(LTCXXCOMPILE) -c $(JAVA_INCLUDES) -I . -o $@ $<
+ $(AM_V_CXX)$(LTCXXCOMPILE) -c $(JAVA_INCLUDES) $(JAVA_CPPFLAGS) -I . -o $@ $<
$(LIB_FILES:%=classes/cvc3/%.class): .classes
.classes:
jniGetCounterExample(Object ValidityChecker, boolean inOrder) throws Cvc3Exception;
private static native Object[]
jniGetConcreteModel(Object ValidityChecker) throws Cvc3Exception;
- private static native String
+ private static native Object
jniGetValue(Object ValidityChecker, Object Expr) throws Cvc3Exception;
+ private static native String
+ jniValue(Object ValidityChecker, Object Expr) throws Cvc3Exception;
private static native boolean
jniInconsistent1(Object ValidityChecker) throws Cvc3Exception;
private static native Object[]
return JniUtils.embedHashMap(model, Expr.class, Expr.class, embeddedManager());
}
- public FormulaValue getValue(Expr expr) throws Cvc3Exception {
- return FormulaValue.get(jniGetValue(embedded(), expr.embedded()));
+ public FormulaValue value(Expr expr) throws Cvc3Exception {
+ return FormulaValue.get(jniValue(embedded(), expr.embedded()));
+ }
+
+ public Expr getValue(Expr expr) throws Cvc3Exception {
+ return new ExprMut(
+ jniGetValue(embedded(), expr.embedded()),
+ embeddedManager());
}
public boolean inconsistent() throws Cvc3Exception {
vc->getCounterExample(result, inOrder);
return toJavaVCopy(env, result);
-DEFINITION: Java_cvc3_ValidityChecker_jniGetValue
+DEFINITION: Java_cvc3_ValidityChecker_jniValue
jstring m ValidityChecker vc c Expr expr
return toJava(env, vc->value(*expr));
+DEFINITION: Java_cvc3_ValidityChecker_jniGetValue
+jobject m ValidityChecker vc c Expr expr
+return embed_copy(env, vc->getValue(*expr));
+
DEFINITION: Java_cvc3_ValidityChecker_jniGetConcreteModel
jobjectArray m ValidityChecker vc
ExprMap<Expr> result;
FormulaValue ValidityChecker::value(const Expr& e) {
CheckArgument(e.getType() == d_em->booleanType(), e, "argument must be a formula");
- return d_smt->getValue(e).getConst<bool>() ? TRUE_VAL : FALSE_VAL;
+ try {
+ return d_smt->getValue(e).getConst<bool>() ? TRUE_VAL : FALSE_VAL;
+ } catch(CVC4::Exception& e) {
+ return UNKNOWN_VAL;
+ }
+}
+
+Expr ValidityChecker::getValue(const Expr& e) {
+ try {
+ return d_smt->getValue(e);
+ } catch(CVC4::ModalException& e) {
+ // by contract, we return null expr
+ return Expr();
+ }
}
bool ValidityChecker::inconsistent(std::vector<Expr>& assumptions) {
*/
virtual Proof getProof();
+ //! Evaluate an expression and return a concrete value in the model
+ /*! If the last query was not invalid, should return NULL expr */
+ virtual Expr getValue(const Expr& e);
+
//! Returns the TCC of the last assumption or query
/*! Returns Null if no assumptions or queries were performed. */
virtual Expr getTCC();