Public Member Functions | |
| def | __init__ |
| def | __del__ |
| def | __len__ |
| def | __contains__ |
| def | __getitem__ |
| def | __setitem__ |
| def | __repr__ |
| def | erase |
| def | reset |
| def | keys |
Data Fields | |
| map | |
| ctx | |
| def __init__ | ( | self, | |
m = None, |
|||
ctx = None |
|||
| ) |
Definition at line 4999 of file z3py.py.
04999 05000 def __init__(self, m=None, ctx=None): 05001 self.map = None 05002 if m == None: 05003 self.ctx = _get_ctx(ctx) 05004 self.map = Z3_mk_ast_map(self.ctx.ref()) 05005 else: 05006 self.map = m 05007 assert ctx != None 05008 self.ctx = ctx 05009 Z3_ast_map_inc_ref(self.ctx.ref(), self.map)
| def __del__ | ( | self | ) |
| def __contains__ | ( | self, | |
| key | |||
| ) |
Return `True` if the map contains key `key`.
>>> M = AstMap()
>>> x = Int('x')
>>> M[x] = x + 1
>>> x in M
True
>>> x+1 in M
False
Definition at line 5027 of file z3py.py.
05027 05028 def __contains__(self, key): 05029 """Return `True` if the map contains key `key`. 05030 05031 >>> M = AstMap() 05032 >>> x = Int('x') 05033 >>> M[x] = x + 1 05034 >>> x in M 05035 True 05036 >>> x+1 in M 05037 False 05038 """ 05039 return Z3_ast_map_contains(self.ctx.ref(), self.map, key.as_ast())
| def __getitem__ | ( | self, | |
| key | |||
| ) |
Retrieve the value associated with key `key`.
>>> M = AstMap()
>>> x = Int('x')
>>> M[x] = x + 1
>>> M[x]
x + 1
Definition at line 5040 of file z3py.py.
05040 05041 def __getitem__(self, key): 05042 """Retrieve the value associated with key `key`. 05043 05044 >>> M = AstMap() 05045 >>> x = Int('x') 05046 >>> M[x] = x + 1 05047 >>> M[x] 05048 x + 1 05049 """ 05050 return _to_ast_ref(Z3_ast_map_find(self.ctx.ref(), self.map, key.as_ast()), self.ctx)
| def __len__ | ( | self | ) |
Return the size of the map.
>>> M = AstMap()
>>> len(M)
0
>>> x = Int('x')
>>> M[x] = IntVal(1)
>>> len(M)
1
Definition at line 5014 of file z3py.py.
05014 05015 def __len__(self): 05016 """Return the size of the map. 05017 05018 >>> M = AstMap() 05019 >>> len(M) 05020 0 05021 >>> x = Int('x') 05022 >>> M[x] = IntVal(1) 05023 >>> len(M) 05024 1 05025 """ 05026 return int(Z3_ast_map_size(self.ctx.ref(), self.map))
| def __repr__ | ( | self | ) |
| def __setitem__ | ( | self, | |
| k, | |||
| v | |||
| ) |
Add/Update key `k` with value `v`.
>>> M = AstMap()
>>> x = Int('x')
>>> M[x] = x + 1
>>> len(M)
1
>>> M[x]
x + 1
>>> M[x] = IntVal(1)
>>> M[x]
1
Definition at line 5051 of file z3py.py.
05051 05052 def __setitem__(self, k, v): 05053 """Add/Update key `k` with value `v`. 05054 05055 >>> M = AstMap() 05056 >>> x = Int('x') 05057 >>> M[x] = x + 1 05058 >>> len(M) 05059 1 05060 >>> M[x] 05061 x + 1 05062 >>> M[x] = IntVal(1) 05063 >>> M[x] 05064 1 05065 """ 05066 Z3_ast_map_insert(self.ctx.ref(), self.map, k.as_ast(), v.as_ast())
| def erase | ( | self, | |
| k | |||
| ) |
Remove the entry associated with key `k`.
>>> M = AstMap()
>>> x = Int('x')
>>> M[x] = x + 1
>>> len(M)
1
>>> M.erase(x)
>>> len(M)
0
Definition at line 5070 of file z3py.py.
05070 05071 def erase(self, k): 05072 """Remove the entry associated with key `k`. 05073 05074 >>> M = AstMap() 05075 >>> x = Int('x') 05076 >>> M[x] = x + 1 05077 >>> len(M) 05078 1 05079 >>> M.erase(x) 05080 >>> len(M) 05081 0 05082 """ 05083 Z3_ast_map_erase(self.ctx.ref(), self.map, k.as_ast())
| def keys | ( | self | ) |
Return an AstVector containing all keys in the map.
>>> M = AstMap()
>>> x = Int('x')
>>> M[x] = x + 1
>>> M[x+x] = IntVal(1)
>>> M.keys()
[x, x + x]
Definition at line 5099 of file z3py.py.
05099 05100 def keys(self): 05101 """Return an AstVector containing all keys in the map. 05102 05103 >>> M = AstMap() 05104 >>> x = Int('x') 05105 >>> M[x] = x + 1 05106 >>> M[x+x] = IntVal(1) 05107 >>> M.keys() 05108 [x, x + x] 05109 """ 05110 return AstVector(Z3_ast_map_keys(self.ctx.ref(), self.map), self.ctx)
| def reset | ( | self | ) |
Remove all entries from the map.
>>> M = AstMap()
>>> x = Int('x')
>>> M[x] = x + 1
>>> M[x+x] = IntVal(1)
>>> len(M)
2
>>> M.reset()
>>> len(M)
0
Definition at line 5084 of file z3py.py.
05084 05085 def reset(self): 05086 """Remove all entries from the map. 05087 05088 >>> M = AstMap() 05089 >>> x = Int('x') 05090 >>> M[x] = x + 1 05091 >>> M[x+x] = IntVal(1) 05092 >>> len(M) 05093 2 05094 >>> M.reset() 05095 >>> len(M) 05096 0 05097 """ 05098 Z3_ast_map_reset(self.ctx.ref(), self.map)
Definition at line 4999 of file z3py.py.
Referenced by ArithRef.__add__(), BitVecRef.__add__(), BitVecRef.__and__(), FuncDeclRef.__call__(), ArithRef.__div__(), BitVecRef.__div__(), ExprRef.__eq__(), Probe.__eq__(), ArithRef.__ge__(), BitVecRef.__ge__(), Probe.__ge__(), ArrayRef.__getitem__(), AstMap.__getitem__(), ApplyResult.__getitem__(), ArithRef.__gt__(), BitVecRef.__gt__(), Probe.__gt__(), BitVecRef.__invert__(), ArithRef.__le__(), BitVecRef.__le__(), Probe.__le__(), BitVecRef.__lshift__(), ArithRef.__lt__(), BitVecRef.__lt__(), Probe.__lt__(), ArithRef.__mod__(), BitVecRef.__mod__(), ArithRef.__mul__(), BitVecRef.__mul__(), ExprRef.__ne__(), Probe.__ne__(), ArithRef.__neg__(), BitVecRef.__neg__(), BitVecRef.__or__(), ArithRef.__pow__(), ArithRef.__radd__(), BitVecRef.__radd__(), BitVecRef.__rand__(), ArithRef.__rdiv__(), BitVecRef.__rdiv__(), BitVecRef.__rlshift__(), ArithRef.__rmod__(), BitVecRef.__rmod__(), ArithRef.__rmul__(), BitVecRef.__rmul__(), BitVecRef.__ror__(), ArithRef.__rpow__(), BitVecRef.__rrshift__(), BitVecRef.__rshift__(), ArithRef.__rsub__(), BitVecRef.__rsub__(), BitVecRef.__rxor__(), ArithRef.__sub__(), BitVecRef.__sub__(), BitVecRef.__xor__(), DatatypeSortRef.accessor(), Fixedpoint.add_rule(), Optimize.add_soft(), Tactic.apply(), AlgebraicNumRef.approx(), ExprRef.arg(), ApplyResult.as_expr(), Fixedpoint.assert_exprs(), QuantifierRef.body(), BoolSortRef.cast(), DatatypeSortRef.constructor(), ApplyResult.convert_model(), ExprRef.decl(), RatNumRef.denominator(), FuncDeclRef.domain(), ArraySortRef.domain(), Fixedpoint.get_answer(), Fixedpoint.get_assertions(), Fixedpoint.get_cover_delta(), Fixedpoint.get_rules(), AstMap.keys(), SortRef.kind(), ArrayRef.mk_default(), Optimize.model(), SortRef.name(), FuncDeclRef.name(), QuantifierRef.no_pattern(), RatNumRef.numerator(), Fixedpoint.param_descrs(), Optimize.param_descrs(), Tactic.param_descrs(), Fixedpoint.parse_file(), Fixedpoint.parse_string(), QuantifierRef.pattern(), Fixedpoint.query(), FuncDeclRef.range(), ArraySortRef.range(), DatatypeSortRef.recognizer(), Fixedpoint.set(), Optimize.set(), Tactic.solver(), ExprRef.sort(), BoolRef.sort(), QuantifierRef.sort(), ArithRef.sort(), BitVecRef.sort(), ArrayRef.sort(), DatatypeRef.sort(), Fixedpoint.statistics(), Optimize.statistics(), Solver.to_smt2(), Fixedpoint.update_rule(), QuantifierRef.var_name(), and QuantifierRef.var_sort().
Definition at line 4999 of file z3py.py.
Referenced by AstMap::__contains__(), AstMap::__del__(), AstMap::__getitem__(), AstMap::__len__(), AstMap::__repr__(), AstMap::__setitem__(), AstMap::erase(), AstMap::keys(), and AstMap::reset().
1.7.6.1