-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitVecNum.java
More file actions
68 lines (61 loc) · 1.55 KB
/
BitVecNum.java
File metadata and controls
68 lines (61 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* 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 a long");
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);
}
}