3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 10:55:50 +00:00

Java API: Added exception wrappers and build dependencies.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2012-11-30 15:39:25 +00:00
parent 654c02701c
commit 0c1f2a8281
47 changed files with 4908 additions and 4554 deletions

View file

@ -13,50 +13,56 @@ import java.math.BigInteger;
**/
public class BitVecNum extends BitVecExpr
{
/**
* Retrieve the int value.
*
* @throws Z3Exception
**/
public int Int() throws Z3Exception
{
Native.IntPtr res = new Native.IntPtr();
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int");
return res.value;
}
/**
* Retrieve the int value.
*
* @throws Z3Exception
**/
public int Int() throws Z3Exception
{
Native.IntPtr res = new Native.IntPtr();
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int");
return res.value;
}
/**
* Retrieve the 64-bit int value.
*
* @throws Z3Exception
**/
public long Long() throws Z3Exception
{
Native.LongPtr res = new Native.LongPtr();
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int64");
return res.value;
}
/**
* Retrieve the 64-bit int value.
*
* @throws Z3Exception
**/
public long Long() throws Z3Exception
{
Native.LongPtr res = new Native.LongPtr();
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int64");
return res.value;
}
/**
* Retrieve the BigInteger value.
**/
public BigInteger BigInteger()
{
return new BigInteger(this.toString());
}
/**
* Retrieve the BigInteger value.
**/
public BigInteger BigInteger()
{
return new BigInteger(this.toString());
}
/**
* Returns a string representation of the numeral.
**/
public String toString()
{
return Native.getNumeralString(Context().nCtx(), NativeObject());
}
/**
* Returns a string representation of the numeral.
**/
public String toString()
{
try
{
return Native.getNumeralString(Context().nCtx(), NativeObject());
} catch (Z3Exception e)
{
return "Z3Exception: " + e.getMessage();
}
}
BitVecNum(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
BitVecNum(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}