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());
92 if (getContext() == ctx) {
95 return create(ctx, Native.translate(getContext().nCtx(), getNativeObject(), ctx.
nCtx()));
105 return Z3_ast_kind.fromInt(Native.getAstKind(getContext().nCtx(),
179 return Native.astToString(getContext().nCtx(), getNativeObject());
187 return Native.astToString(getContext().nCtx(), getNativeObject());
196 Native.incRef(getContext().nCtx(), getNativeObject());
200 void addToReferenceQueue() {
201 getContext().getReferenceQueue().storeReference(
this, ASTRef::new);
204 static AST create(Context ctx,
long obj)
206 switch (
Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)))
209 return new FuncDecl<>(ctx, obj);
212 boolean isLambda = !Native.isQuantifierExists(ctx.nCtx(), obj) && !Native.isQuantifierForall(ctx.nCtx(), obj);
214 return new Lambda(ctx, obj);
216 return new Quantifier(ctx, obj);
219 return Sort.create(ctx, obj);
223 return Expr.create(ctx, obj);
225 throw new Z3Exception(
"Unknown AST kind");
229 private static class ASTRef
extends Z3ReferenceQueue.Reference<AST> {
231 private ASTRef(AST referent, ReferenceQueue<Z3Object> q) {
236 void decRef(Context ctx,
long z3Obj) {
237 Native.decRef(ctx.nCtx(), z3Obj);