-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZ3Object.java
More file actions
115 lines (99 loc) · 2.12 KB
/
Z3Object.java
File metadata and controls
115 lines (99 loc) · 2.12 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* This file was automatically generated from Z3Object.cs
* w/ further modifications by:
* @author Christoph M. Wintersteiger (cwinter)
**/
package com.microsoft.z3;
/**
* Internal base class for interfacing with native Z3 objects. Should not be
* used externally.
**/
public class Z3Object extends IDisposable
{
/**
* Finalizer.
**/
protected void finalize() throws Z3Exception
{
dispose();
}
/**
* Disposes of the underlying native Z3 object.
**/
public void dispose() throws Z3Exception
{
if (m_n_obj != 0)
{
decRef(m_n_obj);
m_n_obj = 0;
}
if (m_ctx != null)
{
m_ctx.m_refCount--;
m_ctx = null;
}
}
private Context m_ctx = null;
private long m_n_obj = 0;
Z3Object(Context ctx)
{
ctx.m_refCount++;
m_ctx = ctx;
}
Z3Object(Context ctx, long obj) throws Z3Exception
{
ctx.m_refCount++;
m_ctx = ctx;
incRef(obj);
m_n_obj = obj;
}
void incRef(long o) throws Z3Exception
{
}
void decRef(long o) throws Z3Exception
{
}
void checkNativeObject(long obj) throws Z3Exception
{
}
long getNativeObject()
{
return m_n_obj;
}
void setNativeObject(long value) throws Z3Exception
{
if (value != 0)
{
checkNativeObject(value);
incRef(value);
}
if (m_n_obj != 0)
{
decRef(m_n_obj);
}
m_n_obj = value;
}
static long getNativeObject(Z3Object s)
{
if (s == null)
return 0;
return s.getNativeObject();
}
Context getContext()
{
return m_ctx;
}
static long[] arrayToNative(Z3Object[] a)
{
if (a == null)
return null;
long[] an = new long[a.length];
for (int i = 0; i < a.length; i++)
an[i] = (a[i] == null) ? 0 : a[i].getNativeObject();
return an;
}
static int arrayLength(Z3Object[] a)
{
return (a == null) ? 0 : a.length;
}
}