Z3
 
Loading...
Searching...
No Matches
ASTVector.java
Go to the documentation of this file.
1
18package com.microsoft.z3;
19
20import java.lang.ref.ReferenceQueue;
21
25public class ASTVector extends Z3Object {
29 public int size()
30 {
31 return Native.astVectorSize(getContext().nCtx(), getNativeObject());
32 }
33
43 public AST get(int i)
44 {
45 return new AST(getContext(), Native.astVectorGet(getContext().nCtx(),
46 getNativeObject(), i));
47 }
48
49 public void set(int i, AST value)
50 {
51
52 Native.astVectorSet(getContext().nCtx(), getNativeObject(), i,
53 value.getNativeObject());
54 }
55
60 public void resize(int newSize)
61 {
62 Native.astVectorResize(getContext().nCtx(), getNativeObject(), newSize);
63 }
64
70 public void push(AST a)
71 {
72 Native.astVectorPush(getContext().nCtx(), getNativeObject(), a.getNativeObject());
73 }
74
83 {
84 return new ASTVector(getContext(), Native.astVectorTranslate(getContext()
85 .nCtx(), getNativeObject(), ctx.nCtx()));
86 }
87
91 @Override
92 public String toString() {
93 return Native.astVectorToString(getContext().nCtx(), getNativeObject());
94 }
95
96 public ASTVector(Context ctx, long obj)
97 {
98 super(ctx, obj);
99 }
100
101 public ASTVector(Context ctx)
102 {
103 super(ctx, Native.mkAstVector(ctx.nCtx()));
104 }
105
109 public AST[] ToArray()
110 {
111 int n = size();
112 AST[] res = new AST[n];
113 for (int i = 0; i < n; i++)
114 res[i] = AST.create(getContext(), get(i).getNativeObject());
115 return res;
116 }
117
121 public Expr<?>[] ToExprArray() {
122 int n = size();
123 Expr<?>[] res = new Expr[n];
124 for (int i = 0; i < n; i++)
125 res[i] = Expr.create(getContext(), get(i).getNativeObject());
126 return res;
127 }
128
133 {
134 int n = size();
135 BoolExpr[] res = new BoolExpr[n];
136 for (int i = 0; i < n; i++)
137 res[i] = (BoolExpr) Expr.create(getContext(), get(i).getNativeObject());
138 return res;
139 }
140
145 {
146 int n = size();
147 BitVecExpr[] res = new BitVecExpr[n];
148 for (int i = 0; i < n; i++)
149 res[i] = (BitVecExpr)Expr.create(getContext(), get(i).getNativeObject());
150 return res;
151 }
152
157 {
158 int n = size();
159 ArithExpr<?>[] res = new ArithExpr[n];
160 for (int i = 0; i < n; i++)
161 res[i] = (ArithExpr<?>)Expr.create(getContext(), get(i).getNativeObject());
162 return res;
163 }
164
169 {
170 int n = size();
171 ArrayExpr<?, ?>[] res = new ArrayExpr[n];
172 for (int i = 0; i < n; i++)
173 res[i] = (ArrayExpr<?, ?>)Expr.create(getContext(), get(i).getNativeObject());
174 return res;
175 }
176
181 {
182 int n = size();
183 DatatypeExpr<?>[] res = new DatatypeExpr[n];
184 for (int i = 0; i < n; i++)
185 res[i] = (DatatypeExpr<?>)Expr.create(getContext(), get(i).getNativeObject());
186 return res;
187 }
188
193 {
194 int n = size();
195 FPExpr[] res = new FPExpr[n];
196 for (int i = 0; i < n; i++)
197 res[i] = (FPExpr)Expr.create(getContext(), get(i).getNativeObject());
198 return res;
199 }
200
205 {
206 int n = size();
207 FPRMExpr[] res = new FPRMExpr[n];
208 for (int i = 0; i < n; i++)
209 res[i] = (FPRMExpr)Expr.create(getContext(), get(i).getNativeObject());
210 return res;
211 }
212
217 {
218 int n = size();
219 IntExpr[] res = new IntExpr[n];
220 for (int i = 0; i < n; i++)
221 res[i] = (IntExpr)Expr.create(getContext(), get(i).getNativeObject());
222 return res;
223 }
224
229 {
230 int n = size();
231 RealExpr[] res = new RealExpr[n];
232 for (int i = 0; i < n; i++)
233 res[i] = (RealExpr)Expr.create(getContext(), get(i).getNativeObject());
234 return res;
235 }
236
237 @Override
238 void incRef() {
239 Native.astVectorIncRef(getContext().nCtx(), getNativeObject());
240 }
241
242 @Override
243 void addToReferenceQueue() {
244 getContext().getReferenceQueue().storeReference(this, ASTVectorRef::new);
245 }
246
247 private static class ASTVectorRef extends Z3ReferenceQueue.Reference<ASTVector> {
248
249 private ASTVectorRef(ASTVector referent, ReferenceQueue<Z3Object> q) {
250 super(referent, q);
251 }
252
253 @Override
254 void decRef(Context ctx, long z3Obj) {
255 Native.astVectorDecRef(ctx.nCtx(), z3Obj);
256 }
257 }
258}
ArithExpr<?>[] ToArithExprExprArray()
BitVecExpr[] ToBitVecExprArray()
void resize(int newSize)
ArrayExpr<?, ?>[] ToArrayExprArray()
DatatypeExpr<?>[] ToDatatypeExprArray()
ASTVector(Context ctx, long obj)
ASTVector translate(Context ctx)