Z3
 
Loading...
Searching...
No Matches
ASTMap.java
Go to the documentation of this file.
1
18package com.microsoft.z3;
19
20import java.lang.ref.ReferenceQueue;
21
25class ASTMap extends Z3Object {
33 public boolean contains(AST k)
34 {
35
36 return Native.astMapContains(getContext().nCtx(), getNativeObject(),
37 k.getNativeObject());
38 }
39
48 public AST find(AST k)
49 {
50 return new AST(getContext(), Native.astMapFind(getContext().nCtx(),
51 getNativeObject(), k.getNativeObject()));
52 }
53
59 public void insert(AST k, AST v)
60 {
61
62 Native.astMapInsert(getContext().nCtx(), getNativeObject(), k.getNativeObject(),
63 v.getNativeObject());
64 }
65
70 public void erase(AST k)
71 {
72 Native.astMapErase(getContext().nCtx(), getNativeObject(), k.getNativeObject());
73 }
74
78 public void reset()
79 {
80 Native.astMapReset(getContext().nCtx(), getNativeObject());
81 }
82
86 public int size()
87 {
88 return Native.astMapSize(getContext().nCtx(), getNativeObject());
89 }
90
96 public AST[] getKeys()
97 {
98 ASTVector av = new ASTVector(getContext(), Native.astMapKeys(getContext().nCtx(), getNativeObject()));
99 return av.ToArray();
100 }
101
105 @Override
106 public String toString()
107 {
108 return Native.astMapToString(getContext().nCtx(), getNativeObject());
109 }
110
111 ASTMap(Context ctx, long obj)
112 {
113 super(ctx, obj);
114 }
115
116 ASTMap(Context ctx)
117 {
118 super(ctx, Native.mkAstMap(ctx.nCtx()));
119 }
120
121 @Override
122 void incRef() {
123 Native.astMapIncRef(getContext().nCtx(), getNativeObject());
124 }
125
126 @Override
127 void addToReferenceQueue() {
128 getContext().getReferenceQueue().storeReference(this, ASTMapRef::new);
129 }
130
131 private static class ASTMapRef extends Z3ReferenceQueue.Reference<ASTMap> {
132
133 private ASTMapRef(ASTMap referent, ReferenceQueue<Z3Object> q) {
134 super(referent, q);
135 }
136
137 @Override
138 void decRef(Context ctx, long z3Obj) {
139 Native.astMapDecRef(ctx.nCtx(), z3Obj);
140 }
141 }
142}
String(name, ctx=None)
Definition z3py.py:11228