37 if (o ==
this)
return true;
38 if (!(o instanceof
AST))
return false;
42 (getContext().
nCtx() == casted.getContext().
nCtx()) &&
43 (Native.isEqAst(getContext().nCtx(), getNativeObject(), casted.getNativeObject()));
60 return Integer.compare(
getId(), other.
getId());
71 return Native.getAstHash(getContext().nCtx(), getNativeObject());
80 return Native.getAstId(getContext().nCtx(), getNativeObject());
90 return Native.getDepth(getContext().nCtx(), getNativeObject());
102 if (getContext() == ctx) {
105 return create(ctx, Native.translate(getContext().nCtx(), getNativeObject(), ctx.
nCtx()));
115 return Z3_ast_kind.fromInt(Native.getAstKind(getContext().nCtx(),
189 return Native.astToString(getContext().nCtx(), getNativeObject());
197 return Native.astToString(getContext().nCtx(), getNativeObject());
206 Native.incRef(getContext().nCtx(), getNativeObject());
210 void addToReferenceQueue() {
211 getContext().getReferenceQueue().storeReference(
this, ASTRef::new);
214 static AST create(Context ctx,
long obj)
216 switch (
Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)))
219 return new FuncDecl<>(ctx, obj);
222 boolean isLambda = !Native.isQuantifierExists(ctx.nCtx(), obj) && !Native.isQuantifierForall(ctx.nCtx(), obj);
224 return new Lambda(ctx, obj);
226 return new Quantifier(ctx, obj);
229 return Sort.create(ctx, obj);
233 return Expr.create(ctx, obj);
235 throw new Z3Exception(
"Unknown AST kind");
239 private static class ASTRef
extends Z3ReferenceQueue.Reference<AST> {
241 private ASTRef(AST referent, ReferenceQueue<Z3Object> q) {
246 void decRef(Context ctx,
long z3Obj) {
247 Native.decRef(ctx.nCtx(), z3Obj);