Search in sources :

Example 51 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer

use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer in project java-smt by sosy-lab.

the class CVC4FormulaCreator method convertValue.

@Override
public Object convertValue(Expr expForType, Expr value) {
    final Type type = expForType.getType();
    final Type valueType = value.getType();
    if (value.getKind() == Kind.BOUND_VARIABLE) {
        // CVC4 does not allow model values for bound vars
        return value.toString();
    } else if (valueType.isBoolean()) {
        return value.getConstBoolean();
    } else if (valueType.isInteger() && type.isInteger()) {
        return new BigInteger(value.getConstRational().toString());
    } else if (valueType.isReal() && type.isReal()) {
        Rational rat = value.getConstRational();
        return org.sosy_lab.common.rationals.Rational.of(new BigInteger(rat.getNumerator().toString()), new BigInteger(rat.getDenominator().toString()));
    } else if (valueType.isBitVector()) {
        Integer bv = value.getConstBitVector().getValue();
        if (bv.fitsSignedLong()) {
            return BigInteger.valueOf(bv.getUnsignedLong());
        } else {
            // default
            return value.toString();
        }
    } else if (valueType.isFloatingPoint()) {
        return parseFloatingPoint(value);
    } else if (valueType.isString()) {
        return value.getConstString().toString();
    } else {
        // String serialization for unknown terms.
        return value.toString();
    }
}
Also used : Integer(edu.stanford.CVC4.Integer) UnsignedInteger(com.google.common.primitives.UnsignedInteger) BigInteger(java.math.BigInteger) FloatingPointType(org.sosy_lab.java_smt.api.FormulaType.FloatingPointType) CVC4.vectorType(edu.stanford.CVC4.vectorType) Type(edu.stanford.CVC4.Type) BitVectorType(edu.stanford.CVC4.BitVectorType) FormulaType(org.sosy_lab.java_smt.api.FormulaType) ArrayFormulaType(org.sosy_lab.java_smt.api.FormulaType.ArrayFormulaType) ArrayType(edu.stanford.CVC4.ArrayType) FunctionType(edu.stanford.CVC4.FunctionType) Rational(edu.stanford.CVC4.Rational) BigInteger(java.math.BigInteger)

Aggregations

Integer (org.jpl7.Integer)19 INTEGER (org.mozilla.jss.asn1.INTEGER)15 BigInteger (java.math.BigInteger)11 Test (org.junit.Test)10 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer)9 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column)8 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint)7 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean)7 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char)7 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal)7 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double)7 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Float (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Float)7 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Smallint (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Smallint)7 Map (java.util.Map)6 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary)6 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob)6 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob)6 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date)6 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime)6 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time)6