3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00
z3/src/api/java/BitVecNum.java
Christoph M. Wintersteiger 4b18c8f9c4 Java API: syntactic adjustments, getters, setters,
... convenience parameters, etc.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
2013-01-17 19:31:02 +00:00

69 lines
1.6 KiB
Java

/**
* This file was automatically generated from BitVecNum.cs
* w/ further modifications by:
* @author Christoph M. Wintersteiger (cwinter)
**/
package com.microsoft.z3;
import java.math.BigInteger;
/**
* Bit-vector numerals
**/
public class BitVecNum extends BitVecExpr
{
/**
* Retrieve the int value.
*
* @throws Z3Exception
**/
public int getInt() throws Z3Exception
{
Native.IntPtr res = new Native.IntPtr();
if (Native.getNumeralInt(getContext().nCtx(), getNativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int");
return res.value;
}
/**
* Retrieve the 64-bit int value.
*
* @throws Z3Exception
**/
public long getLong() throws Z3Exception
{
Native.LongPtr res = new Native.LongPtr();
if (Native.getNumeralInt64(getContext().nCtx(), getNativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int64");
return res.value;
}
/**
* Retrieve the BigInteger value.
**/
public BigInteger getBigInteger()
{
return new BigInteger(this.toString());
}
/**
* Returns a string representation of the numeral.
**/
public String toString()
{
try
{
return Native.getNumeralString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e)
{
return "Z3Exception: " + e.getMessage();
}
}
BitVecNum(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
}