Z3
Z3Object.java
Go to the documentation of this file.
1
18package com.microsoft.z3;
19
24public abstract class Z3Object {
25
26 private final Context m_ctx;
27 private final long m_n_obj;
28
29 Z3Object(Context ctx, long obj) {
30 m_ctx = ctx;
31 checkNativeObject(obj);
32 m_n_obj = obj;
33 incRef();
34 addToReferenceQueue();
35 }
36
41 abstract void addToReferenceQueue();
42
46 abstract void incRef();
47
54 void checkNativeObject(long obj) {}
55
56 long getNativeObject()
57 {
58 return m_n_obj;
59 }
60
61 static long getNativeObject(Z3Object s)
62 {
63 if (s == null)
64 return 0;
65 return s.getNativeObject();
66 }
67
68 Context getContext()
69 {
70 return m_ctx;
71 }
72
73 static long[] arrayToNative(Z3Object[] a)
74 {
75 if (a == null)
76 return null;
77 long[] an = new long[a.length];
78 for (int i = 0; i < a.length; i++)
79 an[i] = (a[i] == null) ? 0 : a[i].getNativeObject();
80 return an;
81 }
82
83 static int arrayLength(Z3Object[] a)
84 {
85 return (a == null) ? 0 : a.length;
86 }
87}