3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

Java API: syntactic adjustments, getters, setters,

... convenience parameters, etc.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2013-01-17 19:31:02 +00:00
parent 3abf397560
commit 4b18c8f9c4
63 changed files with 2939 additions and 2985 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_ast_kind;
/** /**
* The abstract syntax tree (AST) class. * The abstract syntax tree (AST) class.
@ -47,7 +47,7 @@ public class AST extends Z3Object
return false; return false;
} }
return this.NativeObject() == casted.NativeObject(); return this.getNativeObject() == casted.getNativeObject();
} }
/** /**
@ -70,9 +70,9 @@ public class AST extends Z3Object
return 1; return 1;
} }
if (Id() < oAST.Id()) if (getId() < oAST.getId())
return -1; return -1;
else if (Id() > oAST.Id()) else if (getId() > oAST.getId())
return +1; return +1;
else else
return 0; return 0;
@ -83,17 +83,22 @@ public class AST extends Z3Object
* *
* @return A hash code * @return A hash code
**/ **/
public int GetHashCode() throws Z3Exception public int hashCode()
{ {
return (int) Native.getAstHash(Context().nCtx(), NativeObject()); int r = 0;
try {
Native.getAstHash(getContext().nCtx(), getNativeObject());
}
catch (Z3Exception ex) {}
return r;
} }
/** /**
* A unique identifier for the AST (unique among all ASTs). * A unique identifier for the AST (unique among all ASTs).
**/ **/
public int Id() throws Z3Exception public int getId() throws Z3Exception
{ {
return Native.getAstId(Context().nCtx(), NativeObject()); return Native.getAstId(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -102,31 +107,31 @@ public class AST extends Z3Object
* *
* @return A copy of the AST which is associated with <paramref name="ctx"/> * @return A copy of the AST which is associated with <paramref name="ctx"/>
**/ **/
public AST Translate(Context ctx) throws Z3Exception public AST translate(Context ctx) throws Z3Exception
{ {
if (Context() == ctx) if (getContext() == ctx)
return this; return this;
else else
return new AST(ctx, Native.translate(Context().nCtx(), return new AST(ctx, Native.translate(getContext().nCtx(),
NativeObject(), ctx.nCtx())); getNativeObject(), ctx.nCtx()));
} }
/** /**
* The kind of the AST. * The kind of the AST.
**/ **/
public Z3_ast_kind ASTKind() throws Z3Exception public Z3_ast_kind getASTKind() throws Z3Exception
{ {
return Z3_ast_kind.fromInt(Native.getAstKind(Context().nCtx(), return Z3_ast_kind.fromInt(Native.getAstKind(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
* Indicates whether the AST is an Expr * Indicates whether the AST is an Expr
**/ **/
public boolean IsExpr() throws Z3Exception public boolean isExpr() throws Z3Exception
{ {
switch (ASTKind()) switch (getASTKind())
{ {
case Z3_APP_AST: case Z3_APP_AST:
case Z3_NUMERAL_AST: case Z3_NUMERAL_AST:
@ -141,41 +146,41 @@ public class AST extends Z3Object
/** /**
* Indicates whether the AST is an application * Indicates whether the AST is an application
**/ **/
public boolean IsApp() throws Z3Exception public boolean isApp() throws Z3Exception
{ {
return this.ASTKind() == Z3_ast_kind.Z3_APP_AST; return this.getASTKind() == Z3_ast_kind.Z3_APP_AST;
} }
/** /**
* Indicates whether the AST is a BoundVariable * Indicates whether the AST is a BoundVariable
**/ **/
public boolean IsVar() throws Z3Exception public boolean isVar() throws Z3Exception
{ {
return this.ASTKind() == Z3_ast_kind.Z3_VAR_AST; return this.getASTKind() == Z3_ast_kind.Z3_VAR_AST;
} }
/** /**
* Indicates whether the AST is a Quantifier * Indicates whether the AST is a Quantifier
**/ **/
public boolean IsQuantifier() throws Z3Exception public boolean isQuantifier() throws Z3Exception
{ {
return this.ASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST; return this.getASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST;
} }
/** /**
* Indicates whether the AST is a Sort * Indicates whether the AST is a Sort
**/ **/
public boolean IsSort() throws Z3Exception public boolean isSort() throws Z3Exception
{ {
return this.ASTKind() == Z3_ast_kind.Z3_SORT_AST; return this.getASTKind() == Z3_ast_kind.Z3_SORT_AST;
} }
/** /**
* Indicates whether the AST is a FunctionDeclaration * Indicates whether the AST is a FunctionDeclaration
**/ **/
public boolean IsFuncDecl() throws Z3Exception public boolean isFuncDecl() throws Z3Exception
{ {
return this.ASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST; return this.getASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST;
} }
/** /**
@ -185,7 +190,7 @@ public class AST extends Z3Object
{ {
try try
{ {
return Native.astToString(Context().nCtx(), NativeObject()); return Native.astToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -195,9 +200,9 @@ public class AST extends Z3Object
/** /**
* A string representation of the AST in s-expression notation. * A string representation of the AST in s-expression notation.
**/ **/
public String SExpr() throws Z3Exception public String getSExpr() throws Z3Exception
{ {
return Native.astToString(Context().nCtx(), NativeObject()); return Native.astToString(getContext().nCtx(), getNativeObject());
} }
AST(Context ctx) AST(Context ctx)
@ -210,29 +215,29 @@ public class AST extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
// Console.WriteLine("AST IncRef()"); // Console.WriteLine("AST IncRef()");
if (Context() == null) if (getContext() == null)
throw new Z3Exception("inc() called on null context"); throw new Z3Exception("inc() called on null context");
if (o == 0) if (o == 0)
throw new Z3Exception("inc() called on null AST"); throw new Z3Exception("inc() called on null AST");
Context().AST_DRQ().IncAndClear(Context(), o); getContext().ast_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
// Console.WriteLine("AST DecRef()"); // Console.WriteLine("AST DecRef()");
if (Context() == null) if (getContext() == null)
throw new Z3Exception("dec() called on null context"); throw new Z3Exception("dec() called on null context");
if (o == 0) if (o == 0)
throw new Z3Exception("dec() called on null AST"); throw new Z3Exception("dec() called on null AST");
Context().AST_DRQ().Add(o); getContext().ast_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
static AST Create(Context ctx, long obj) throws Z3Exception static AST create(Context ctx, long obj) throws Z3Exception
{ {
switch (Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj))) switch (Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)))
{ {
@ -241,11 +246,11 @@ public class AST extends Z3Object
case Z3_QUANTIFIER_AST: case Z3_QUANTIFIER_AST:
return new Quantifier(ctx, obj); return new Quantifier(ctx, obj);
case Z3_SORT_AST: case Z3_SORT_AST:
return Sort.Create(ctx, obj); return Sort.create(ctx, obj);
case Z3_APP_AST: case Z3_APP_AST:
case Z3_NUMERAL_AST: case Z3_NUMERAL_AST:
case Z3_VAR_AST: case Z3_VAR_AST:
return Expr.Create(ctx, obj); return Expr.create(ctx, obj);
default: default:
throw new Z3Exception("Unknown AST kind"); throw new Z3Exception("Unknown AST kind");
} }

View file

@ -5,9 +5,9 @@
package com.microsoft.z3; package com.microsoft.z3;
public class ASTDecRefQueue extends IDecRefQueue class ASTDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ public class ASTDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -18,11 +18,11 @@ class ASTMap extends Z3Object
* @return True if <paramref name="k"/> is a key in the map, false * @return True if <paramref name="k"/> is a key in the map, false
* otherwise. * otherwise.
**/ **/
public boolean Contains(AST k) throws Z3Exception public boolean contains(AST k) throws Z3Exception
{ {
return Native.astMapContains(Context().nCtx(), NativeObject(), return Native.astMapContains(getContext().nCtx(), getNativeObject(),
k.NativeObject()); k.getNativeObject());
} }
/** /**
@ -32,47 +32,47 @@ class ASTMap extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public AST Find(AST k) throws Z3Exception public AST find(AST k) throws Z3Exception
{ {
return new AST(Context(), Native.astMapFind(Context().nCtx(), return new AST(getContext(), Native.astMapFind(getContext().nCtx(),
NativeObject(), k.NativeObject())); getNativeObject(), k.getNativeObject()));
} }
/** /**
* Stores or replaces a new key/value pair in the map. <param name="k">The * Stores or replaces a new key/value pair in the map. <param name="k">The
* key AST</param> <param name="v">The value AST</param> * key AST</param> <param name="v">The value AST</param>
**/ **/
public void Insert(AST k, AST v) throws Z3Exception public void insert(AST k, AST v) throws Z3Exception
{ {
Native.astMapInsert(Context().nCtx(), NativeObject(), k.NativeObject(), Native.astMapInsert(getContext().nCtx(), getNativeObject(), k.getNativeObject(),
v.NativeObject()); v.getNativeObject());
} }
/** /**
* Erases the key <paramref name="k"/> from the map. <param name="k">An * Erases the key <paramref name="k"/> from the map. <param name="k">An
* AST</param> * AST</param>
**/ **/
public void Erase(AST k) throws Z3Exception public void erase(AST k) throws Z3Exception
{ {
Native.astMapErase(Context().nCtx(), NativeObject(), k.NativeObject()); Native.astMapErase(getContext().nCtx(), getNativeObject(), k.getNativeObject());
} }
/** /**
* Removes all keys from the map. * Removes all keys from the map.
**/ **/
public void Reset() throws Z3Exception public void reset() throws Z3Exception
{ {
Native.astMapReset(Context().nCtx(), NativeObject()); Native.astMapReset(getContext().nCtx(), getNativeObject());
} }
/** /**
* The size of the map * The size of the map
**/ **/
public int Size() throws Z3Exception public int size() throws Z3Exception
{ {
return Native.astMapSize(Context().nCtx(), NativeObject()); return Native.astMapSize(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -80,10 +80,10 @@ class ASTMap extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public ASTVector Keys() throws Z3Exception public ASTVector getKeys() throws Z3Exception
{ {
return new ASTVector(Context(), Native.astMapKeys(Context().nCtx(), return new ASTVector(getContext(), Native.astMapKeys(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
@ -93,7 +93,7 @@ class ASTMap extends Z3Object
{ {
try try
{ {
return Native.astMapToString(Context().nCtx(), NativeObject()); return Native.astMapToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -110,15 +110,15 @@ class ASTMap extends Z3Object
super(ctx, Native.mkAstMap(ctx.nCtx())); super(ctx, Native.mkAstMap(ctx.nCtx()));
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().ASTMap_DRQ().IncAndClear(Context(), o); getContext().astmap_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().ASTMap_DRQ().Add(o); getContext().astmap_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -14,9 +14,9 @@ class ASTVector extends Z3Object
/** /**
* The size of the vector * The size of the vector
**/ **/
public int Size() throws Z3Exception public int size() throws Z3Exception
{ {
return Native.astVectorSize(Context().nCtx(), NativeObject()); return Native.astVectorSize(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -29,33 +29,33 @@ class ASTVector extends Z3Object
**/ **/
public AST get(int i) throws Z3Exception public AST get(int i) throws Z3Exception
{ {
return new AST(Context(), Native.astVectorGet(Context().nCtx(), return new AST(getContext(), Native.astVectorGet(getContext().nCtx(),
NativeObject(), i)); getNativeObject(), i));
} }
public void set(int i, AST value) throws Z3Exception public void set(int i, AST value) throws Z3Exception
{ {
Native.astVectorSet(Context().nCtx(), NativeObject(), i, Native.astVectorSet(getContext().nCtx(), getNativeObject(), i,
value.NativeObject()); value.getNativeObject());
} }
/** /**
* Resize the vector to <paramref name="newSize"/>. <param * Resize the vector to <paramref name="newSize"/>. <param
* name="newSize">The new size of the vector.</param> * name="newSize">The new size of the vector.</param>
**/ **/
public void Resize(int newSize) throws Z3Exception public void resize(int newSize) throws Z3Exception
{ {
Native.astVectorResize(Context().nCtx(), NativeObject(), newSize); Native.astVectorResize(getContext().nCtx(), getNativeObject(), newSize);
} }
/** /**
* Add the AST <paramref name="a"/> to the back of the vector. The size is * Add the AST <paramref name="a"/> to the back of the vector. The size is
* increased by 1. <param name="a">An AST</param> * increased by 1. <param name="a">An AST</param>
**/ **/
public void Push(AST a) throws Z3Exception public void push(AST a) throws Z3Exception
{ {
Native.astVectorPush(Context().nCtx(), NativeObject(), a.NativeObject()); Native.astVectorPush(getContext().nCtx(), getNativeObject(), a.getNativeObject());
} }
/** /**
@ -65,10 +65,10 @@ class ASTVector extends Z3Object
* @return A new ASTVector * @return A new ASTVector
* @throws Z3Exception * @throws Z3Exception
**/ **/
public ASTVector Translate(Context ctx) throws Z3Exception public ASTVector translate(Context ctx) throws Z3Exception
{ {
return new ASTVector(Context(), Native.astVectorTranslate(Context() return new ASTVector(getContext(), Native.astVectorTranslate(getContext()
.nCtx(), NativeObject(), ctx.nCtx())); .nCtx(), getNativeObject(), ctx.nCtx()));
} }
/** /**
@ -78,7 +78,7 @@ class ASTVector extends Z3Object
{ {
try try
{ {
return Native.astVectorToString(Context().nCtx(), NativeObject()); return Native.astVectorToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -95,15 +95,15 @@ class ASTVector extends Z3Object
super(ctx, Native.mkAstVector(ctx.nCtx())); super(ctx, Native.mkAstVector(ctx.nCtx()));
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().ASTVector_DRQ().IncAndClear(Context(), o); getContext().astvector_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().ASTVector_DRQ().Add(o); getContext().astvector_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -19,11 +19,11 @@ public class AlgebraicNum extends ArithExpr
* *
* @return A numeral Expr of sort Real * @return A numeral Expr of sort Real
**/ **/
public RatNum ToUpper(int precision) throws Z3Exception public RatNum toUpper(int precision) throws Z3Exception
{ {
return new RatNum(Context(), Native.getAlgebraicNumberUpper(Context() return new RatNum(getContext(), Native.getAlgebraicNumberUpper(getContext()
.nCtx(), NativeObject(), precision)); .nCtx(), getNativeObject(), precision));
} }
/** /**
@ -33,21 +33,21 @@ public class AlgebraicNum extends ArithExpr
* *
* @return A numeral Expr of sort Real * @return A numeral Expr of sort Real
**/ **/
public RatNum ToLower(int precision) throws Z3Exception public RatNum toLower(int precision) throws Z3Exception
{ {
return new RatNum(Context(), Native.getAlgebraicNumberLower(Context() return new RatNum(getContext(), Native.getAlgebraicNumberLower(getContext()
.nCtx(), NativeObject(), precision)); .nCtx(), getNativeObject(), precision));
} }
/** /**
* Returns a string representation in decimal notation. <remarks>The result * Returns a string representation in decimal notation. <remarks>The result
* has at most <paramref name="precision"/> decimal places.</remarks> * has at most <paramref name="precision"/> decimal places.</remarks>
**/ **/
public String ToDecimal(int precision) throws Z3Exception public String toDecimal(int precision) throws Z3Exception
{ {
return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(), return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
precision); precision);
} }

View file

@ -15,10 +15,10 @@ public class ApplyResult extends Z3Object
/** /**
* The number of Subgoals. * The number of Subgoals.
**/ **/
public int NumSubgoals() throws Z3Exception public int getNumSubgoals() throws Z3Exception
{ {
return Native.applyResultGetNumSubgoals(Context().nCtx(), return Native.applyResultGetNumSubgoals(getContext().nCtx(),
NativeObject()); getNativeObject());
} }
/** /**
@ -26,13 +26,13 @@ public class ApplyResult extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Goal[] Subgoals() throws Z3Exception public Goal[] getSubgoals() throws Z3Exception
{ {
int n = NumSubgoals(); int n = getNumSubgoals();
Goal[] res = new Goal[n]; Goal[] res = new Goal[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new Goal(Context(), Native.applyResultGetSubgoal(Context() res[i] = new Goal(getContext(),
.nCtx(), NativeObject(), i)); Native.applyResultGetSubgoal(getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -43,10 +43,10 @@ public class ApplyResult extends Z3Object
* @return A model for <code>g</code> * @return A model for <code>g</code>
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Model ConvertModel(int i, Model m) throws Z3Exception public Model convertModel(int i, Model m) throws Z3Exception
{ {
return new Model(Context(), Native.applyResultConvertModel(Context() return new Model(getContext(),
.nCtx(), NativeObject(), i, m.NativeObject())); Native.applyResultConvertModel(getContext().nCtx(), getNativeObject(), i, m.getNativeObject()));
} }
/** /**
@ -56,7 +56,7 @@ public class ApplyResult extends Z3Object
{ {
try try
{ {
return Native.applyResultToString(Context().nCtx(), NativeObject()); return Native.applyResultToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -68,15 +68,15 @@ public class ApplyResult extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().ApplyResult_DRQ().IncAndClear(Context(), o); getContext().applyResult_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().ApplyResult_DRQ().Add(o); getContext().applyResult_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class ApplyResultDecRefQueue extends IDecRefQueue class ApplyResultDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class ApplyResultDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -15,20 +15,20 @@ public class ArraySort extends Sort
* The domain of the array sort. * The domain of the array sort.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Sort Domain() throws Z3Exception public Sort getDomain() throws Z3Exception
{ {
return Sort.Create(Context(), return Sort.create(getContext(),
Native.getArraySortDomain(Context().nCtx(), NativeObject())); Native.getArraySortDomain(getContext().nCtx(), getNativeObject()));
} }
/** /**
* The range of the array sort. * The range of the array sort.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Sort Range() throws Z3Exception public Sort getRange() throws Z3Exception
{ {
return Sort.Create(Context(), return Sort.create(getContext(),
Native.getArraySortRange(Context().nCtx(), NativeObject())); Native.getArraySortRange(getContext().nCtx(), getNativeObject()));
} }
ArraySort(Context ctx, long obj) throws Z3Exception ArraySort(Context ctx, long obj) throws Z3Exception
@ -38,7 +38,7 @@ public class ArraySort extends Sort
ArraySort(Context ctx, Sort domain, Sort range) throws Z3Exception ArraySort(Context ctx, Sort domain, Sort range) throws Z3Exception
{ {
super(ctx, Native.mkArraySort(ctx.nCtx(), domain.NativeObject(), super(ctx, Native.mkArraySort(ctx.nCtx(), domain.getNativeObject(),
range.NativeObject())); range.getNativeObject()));
} }
}; };

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class ASTMapDecRefQueue extends IDecRefQueue class ASTMapDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class ASTMapDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class ASTVectorDecRefQueue extends IDecRefQueue class ASTVectorDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class ASTVectorDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -16,15 +16,15 @@ public class BitVecExpr extends Expr
* The size of the sort of a bit-vector term. * The size of the sort of a bit-vector term.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public int SortSize() throws Z3Exception public int getSortSize() throws Z3Exception
{ {
return ((BitVecSort) Sort()).Size(); return ((BitVecSort) getSort()).getSize();
} }
/** /**
* Constructor for BitVecExpr </summary> * Constructor for BitVecExpr </summary>
**/ **/
protected BitVecExpr(Context ctx) BitVecExpr(Context ctx)
{ {
super(ctx); super(ctx);
} }

View file

@ -18,10 +18,10 @@ public class BitVecNum extends BitVecExpr
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public int Int() throws Z3Exception public int getInt() throws Z3Exception
{ {
Native.IntPtr res = new Native.IntPtr(); Native.IntPtr res = new Native.IntPtr();
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true) if (Native.getNumeralInt(getContext().nCtx(), getNativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int"); throw new Z3Exception("Numeral is not an int");
return res.value; return res.value;
} }
@ -31,10 +31,10 @@ public class BitVecNum extends BitVecExpr
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public long Long() throws Z3Exception public long getLong() throws Z3Exception
{ {
Native.LongPtr res = new Native.LongPtr(); Native.LongPtr res = new Native.LongPtr();
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true) if (Native.getNumeralInt64(getContext().nCtx(), getNativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int64"); throw new Z3Exception("Numeral is not an int64");
return res.value; return res.value;
} }
@ -42,7 +42,7 @@ public class BitVecNum extends BitVecExpr
/** /**
* Retrieve the BigInteger value. * Retrieve the BigInteger value.
**/ **/
public BigInteger BigInteger() public BigInteger getBigInteger()
{ {
return new BigInteger(this.toString()); return new BigInteger(this.toString());
} }
@ -54,7 +54,7 @@ public class BitVecNum extends BitVecExpr
{ {
try try
{ {
return Native.getNumeralString(Context().nCtx(), NativeObject()); return Native.getNumeralString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();

View file

@ -13,9 +13,9 @@ public class BitVecSort extends Sort
/** /**
* The size of the bit-vector sort. * The size of the bit-vector sort.
**/ **/
public int Size() throws Z3Exception public int getSize() throws Z3Exception
{ {
return Native.getBvSortSize(Context().nCtx(), NativeObject()); return Native.getBvSortSize(getContext().nCtx(), getNativeObject());
} }
BitVecSort(Context ctx, long obj) throws Z3Exception BitVecSort(Context ctx, long obj) throws Z3Exception

View file

@ -15,7 +15,7 @@ public class Constructor extends Z3Object
* The number of fields of the constructor. * The number of fields of the constructor.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public int NumFields() throws Z3Exception public int getNumFields() throws Z3Exception
{ {
init(); init();
return n; return n;
@ -35,7 +35,7 @@ public class Constructor extends Z3Object
* The function declaration of the tester. * The function declaration of the tester.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl TesterDecl() throws Z3Exception public FuncDecl getTesterDecl() throws Z3Exception
{ {
init(); init();
return m_testerDecl; return m_testerDecl;
@ -45,7 +45,7 @@ public class Constructor extends Z3Object
* The function declarations of the accessors * The function declarations of the accessors
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[] AccessorDecls() throws Z3Exception public FuncDecl[] getAccessorDecls() throws Z3Exception
{ {
init(); init();
return m_accessorDecls; return m_accessorDecls;
@ -56,7 +56,7 @@ public class Constructor extends Z3Object
**/ **/
protected void finalize() throws Z3Exception protected void finalize() throws Z3Exception
{ {
Native.delConstructor(Context().nCtx(), NativeObject()); Native.delConstructor(getContext().nCtx(), getNativeObject());
} }
private int n = 0; private int n = 0;
@ -70,9 +70,9 @@ public class Constructor extends Z3Object
{ {
super(ctx); super(ctx);
n = AST.ArrayLength(fieldNames); n = AST.arrayLength(fieldNames);
if (n != AST.ArrayLength(sorts)) if (n != AST.arrayLength(sorts))
throw new Z3Exception( throw new Z3Exception(
"Number of field names does not match number of sorts"); "Number of field names does not match number of sorts");
if (sortRefs != null && sortRefs.length != n) if (sortRefs != null && sortRefs.length != n)
@ -82,9 +82,9 @@ public class Constructor extends Z3Object
if (sortRefs == null) if (sortRefs == null)
sortRefs = new int[n]; sortRefs = new int[n];
setNativeObject(Native.mkConstructor(ctx.nCtx(), name.NativeObject(), setNativeObject(Native.mkConstructor(ctx.nCtx(), name.getNativeObject(),
recognizer.NativeObject(), n, Symbol.ArrayToNative(fieldNames), recognizer.getNativeObject(), n, Symbol.arrayToNative(fieldNames),
Sort.ArrayToNative(sorts), sortRefs)); Sort.arrayToNative(sorts), sortRefs));
} }
@ -95,13 +95,13 @@ public class Constructor extends Z3Object
Native.LongPtr constructor = new Native.LongPtr(); Native.LongPtr constructor = new Native.LongPtr();
Native.LongPtr tester = new Native.LongPtr(); Native.LongPtr tester = new Native.LongPtr();
long[] accessors = new long[n]; long[] accessors = new long[n];
Native.queryConstructor(Context().nCtx(), NativeObject(), n, Native.queryConstructor(getContext().nCtx(), getNativeObject(), n,
constructor, tester, accessors); constructor, tester, accessors);
m_constructorDecl = new FuncDecl(Context(), constructor.value); m_constructorDecl = new FuncDecl(getContext(), constructor.value);
m_testerDecl = new FuncDecl(Context(), tester.value); m_testerDecl = new FuncDecl(getContext(), tester.value);
m_accessorDecls = new FuncDecl[n]; m_accessorDecls = new FuncDecl[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
m_accessorDecls[i] = new FuncDecl(Context(), accessors[i]); m_accessorDecls[i] = new FuncDecl(getContext(), accessors[i]);
} }
} }

View file

@ -16,7 +16,7 @@ public class ConstructorList extends Z3Object
**/ **/
protected void finalize() throws Z3Exception protected void finalize() throws Z3Exception
{ {
Native.delConstructorList(Context().nCtx(), NativeObject()); Native.delConstructorList(getContext().nCtx(), getNativeObject());
} }
ConstructorList(Context ctx, long obj) throws Z3Exception ConstructorList(Context ctx, long obj) throws Z3Exception
@ -28,8 +28,8 @@ public class ConstructorList extends Z3Object
{ {
super(ctx); super(ctx);
setNativeObject(Native.mkConstructorList(Context().nCtx(), setNativeObject(Native.mkConstructorList(getContext().nCtx(),
(int) constructors.length, (int) constructors.length,
Constructor.ArrayToNative(constructors))); Constructor.arrayToNative(constructors)));
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -14,10 +14,10 @@ public class DatatypeSort extends Sort
/** /**
* The number of constructors of the datatype sort. * The number of constructors of the datatype sort.
**/ **/
public int NumConstructors() throws Z3Exception public int getNumConstructors() throws Z3Exception
{ {
return Native.getDatatypeSortNumConstructors(Context().nCtx(), return Native.getDatatypeSortNumConstructors(getContext().nCtx(),
NativeObject()); getNativeObject());
} }
/** /**
@ -25,13 +25,13 @@ public class DatatypeSort extends Sort
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[] Constructors() throws Z3Exception public FuncDecl[] getConstructors() throws Z3Exception
{ {
int n = NumConstructors(); int n = getNumConstructors();
FuncDecl[] res = new FuncDecl[n]; FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new FuncDecl(Context(), Native.getDatatypeSortConstructor( res[i] = new FuncDecl(getContext(), Native.getDatatypeSortConstructor(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -40,13 +40,13 @@ public class DatatypeSort extends Sort
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[] Recognizers() throws Z3Exception public FuncDecl[] getRecognizers() throws Z3Exception
{ {
int n = NumConstructors(); int n = getNumConstructors();
FuncDecl[] res = new FuncDecl[n]; FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new FuncDecl(Context(), Native.getDatatypeSortRecognizer( res[i] = new FuncDecl(getContext(), Native.getDatatypeSortRecognizer(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -55,22 +55,22 @@ public class DatatypeSort extends Sort
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[][] Accessors() throws Z3Exception public FuncDecl[][] getAccessors() throws Z3Exception
{ {
int n = NumConstructors(); int n = getNumConstructors();
FuncDecl[][] res = new FuncDecl[n][]; FuncDecl[][] res = new FuncDecl[n][];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
FuncDecl fd = new FuncDecl(Context(), FuncDecl fd = new FuncDecl(getContext(),
Native.getDatatypeSortConstructor(Context().nCtx(), Native.getDatatypeSortConstructor(getContext().nCtx(),
NativeObject(), i)); getNativeObject(), i));
int ds = fd.DomainSize(); int ds = fd.getDomainSize();
FuncDecl[] tmp = new FuncDecl[ds]; FuncDecl[] tmp = new FuncDecl[ds];
for (int j = 0; j < ds; j++) for (int j = 0; j < ds; j++)
tmp[j] = new FuncDecl(Context(), tmp[j] = new FuncDecl(getContext(),
Native.getDatatypeSortConstructorAccessor(Context() Native.getDatatypeSortConstructorAccessor(getContext()
.nCtx(), NativeObject(), i, j)); .nCtx(), getNativeObject(), i, j));
res[i] = tmp; res[i] = tmp;
} }
return res; return res;
@ -84,8 +84,8 @@ public class DatatypeSort extends Sort
DatatypeSort(Context ctx, Symbol name, Constructor[] constructors) DatatypeSort(Context ctx, Symbol name, Constructor[] constructors)
throws Z3Exception throws Z3Exception
{ {
super(ctx, Native.mkDatatype(ctx.nCtx(), name.NativeObject(), super(ctx, Native.mkDatatype(ctx.nCtx(), name.getNativeObject(),
(int) constructors.length, ArrayToNative(constructors))); (int) constructors.length, arrayToNative(constructors)));
} }
}; };

View file

@ -14,7 +14,7 @@ public class EnumSort extends Sort
/** /**
* The function declarations of the constants in the enumeration. * The function declarations of the constants in the enumeration.
**/ **/
public FuncDecl[] ConstDecls() public FuncDecl[] getConstDecls()
{ {
return _constdecls; return _constdecls;
} }
@ -22,7 +22,7 @@ public class EnumSort extends Sort
/** /**
* The constants in the enumeration. * The constants in the enumeration.
**/ **/
public Expr[] Consts() public Expr[] getConsts()
{ {
return _consts; return _consts;
} }
@ -30,7 +30,7 @@ public class EnumSort extends Sort
/** /**
* The test predicates for the constants in the enumeration. * The test predicates for the constants in the enumeration.
**/ **/
public FuncDecl[] TesterDecls() public FuncDecl[] getTesterDecls()
{ {
return _testerdecls; return _testerdecls;
} }
@ -46,7 +46,7 @@ public class EnumSort extends Sort
long[] n_constdecls = new long[n]; long[] n_constdecls = new long[n];
long[] n_testers = new long[n]; long[] n_testers = new long[n];
setNativeObject(Native.mkEnumerationSort(ctx.nCtx(), setNativeObject(Native.mkEnumerationSort(ctx.nCtx(),
name.NativeObject(), (int) n, Symbol.ArrayToNative(enumNames), name.getNativeObject(), (int) n, Symbol.arrayToNative(enumNames),
n_constdecls, n_testers)); n_constdecls, n_testers));
_constdecls = new FuncDecl[n]; _constdecls = new FuncDecl[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
@ -56,6 +56,6 @@ public class EnumSort extends Sort
_testerdecls[i] = new FuncDecl(ctx, n_testers[i]); _testerdecls[i] = new FuncDecl(ctx, n_testers[i]);
_consts = new Expr[n]; _consts = new Expr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
_consts[i] = ctx.MkApp(_constdecls[i], (Expr[])null); _consts[i] = ctx.mkApp(_constdecls[i], (Expr[])null);
} }
}; };

File diff suppressed because it is too large Load diff

View file

@ -14,10 +14,10 @@ public class FiniteDomainSort extends Sort
/** /**
* The size of the finite domain sort. * The size of the finite domain sort.
**/ **/
public long Size() throws Z3Exception public long getSize() throws Z3Exception
{ {
Native.LongPtr res = new Native.LongPtr(); Native.LongPtr res = new Native.LongPtr();
Native.getFiniteDomainSortSize(Context().nCtx(), NativeObject(), res); Native.getFiniteDomainSortSize(getContext().nCtx(), getNativeObject(), res);
return res.value; return res.value;
} }
@ -28,7 +28,7 @@ public class FiniteDomainSort extends Sort
FiniteDomainSort(Context ctx, Symbol name, long size) throws Z3Exception FiniteDomainSort(Context ctx, Symbol name, long size) throws Z3Exception
{ {
super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.NativeObject(), super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.getNativeObject(),
size)); size));
} }
} }

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_lbool;
/** /**
* Object for managing fixedpoints * Object for managing fixedpoints
@ -17,9 +17,9 @@ public class Fixedpoint extends Z3Object
/** /**
* A string that describes all available fixedpoint solver parameters. * A string that describes all available fixedpoint solver parameters.
**/ **/
public String Help() throws Z3Exception public String getHelp() throws Z3Exception
{ {
return Native.fixedpointGetHelp(Context().nCtx(), NativeObject()); return Native.fixedpointGetHelp(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -30,9 +30,9 @@ public class Fixedpoint extends Z3Object
public void setParameters(Params value) throws Z3Exception public void setParameters(Params value) throws Z3Exception
{ {
Context().CheckContextMatch(value); getContext().checkContextMatch(value);
Native.fixedpointSetParams(Context().nCtx(), NativeObject(), Native.fixedpointSetParams(getContext().nCtx(), getNativeObject(),
value.NativeObject()); value.getNativeObject());
} }
/** /**
@ -40,10 +40,10 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public ParamDescrs ParameterDescriptions() throws Z3Exception public ParamDescrs getParameterDescriptions() throws Z3Exception
{ {
return new ParamDescrs(Context(), Native.fixedpointGetParamDescrs( return new ParamDescrs(getContext(), Native.fixedpointGetParamDescrs(
Context().nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
} }
/** /**
@ -51,13 +51,13 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public void Assert(BoolExpr[] constraints) throws Z3Exception public void assert_(BoolExpr ... constraints) throws Z3Exception
{ {
Context().CheckContextMatch(constraints); getContext().checkContextMatch(constraints);
for (BoolExpr a : constraints) for (BoolExpr a : constraints)
{ {
Native.fixedpointAssert(Context().nCtx(), NativeObject(), Native.fixedpointAssert(getContext().nCtx(), getNativeObject(),
a.NativeObject()); a.getNativeObject());
} }
} }
@ -66,12 +66,12 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public void RegisterRelation(FuncDecl f) throws Z3Exception public void registerRelation(FuncDecl f) throws Z3Exception
{ {
Context().CheckContextMatch(f); getContext().checkContextMatch(f);
Native.fixedpointRegisterRelation(Context().nCtx(), NativeObject(), Native.fixedpointRegisterRelation(getContext().nCtx(), getNativeObject(),
f.NativeObject()); f.getNativeObject());
} }
/** /**
@ -79,12 +79,12 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public void AddRule(BoolExpr rule, Symbol name) throws Z3Exception public void addRule(BoolExpr rule, Symbol name) throws Z3Exception
{ {
Context().CheckContextMatch(rule); getContext().checkContextMatch(rule);
Native.fixedpointAddRule(Context().nCtx(), NativeObject(), Native.fixedpointAddRule(getContext().nCtx(), getNativeObject(),
rule.NativeObject(), AST.GetNativeObject(name)); rule.getNativeObject(), AST.getNativeObject(name));
} }
/** /**
@ -92,12 +92,11 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public void AddFact(FuncDecl pred, int[] args) throws Z3Exception public void addFact(FuncDecl pred, int ... args) throws Z3Exception
{ {
getContext().checkContextMatch(pred);
Context().CheckContextMatch(pred); Native.fixedpointAddFact(getContext().nCtx(), getNativeObject(),
Native.fixedpointAddFact(Context().nCtx(), NativeObject(), pred.getNativeObject(), (int) args.length, args);
pred.NativeObject(), (int) args.length, args);
} }
/** /**
@ -109,12 +108,12 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Status Query(BoolExpr query) throws Z3Exception public Status query(BoolExpr query) throws Z3Exception
{ {
Context().CheckContextMatch(query); getContext().checkContextMatch(query);
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQuery(Context().nCtx(), Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQuery(getContext().nCtx(),
NativeObject(), query.NativeObject())); getNativeObject(), query.getNativeObject()));
switch (r) switch (r)
{ {
case Z3_L_TRUE: case Z3_L_TRUE:
@ -134,13 +133,13 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Status Query(FuncDecl[] relations) throws Z3Exception public Status query(FuncDecl[] relations) throws Z3Exception
{ {
Context().CheckContextMatch(relations); getContext().checkContextMatch(relations);
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQueryRelations(Context() Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQueryRelations(getContext()
.nCtx(), NativeObject(), AST.ArrayLength(relations), AST .nCtx(), getNativeObject(), AST.arrayLength(relations), AST
.ArrayToNative(relations))); .arrayToNative(relations)));
switch (r) switch (r)
{ {
case Z3_L_TRUE: case Z3_L_TRUE:
@ -155,9 +154,9 @@ public class Fixedpoint extends Z3Object
/** /**
* Creates a backtracking point. <seealso cref="Pop"/> * Creates a backtracking point. <seealso cref="Pop"/>
**/ **/
public void Push() throws Z3Exception public void push() throws Z3Exception
{ {
Native.fixedpointPush(Context().nCtx(), NativeObject()); Native.fixedpointPush(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -165,9 +164,9 @@ public class Fixedpoint extends Z3Object
* thrown if Pop is called without a corresponding <code>Push</code> * thrown if Pop is called without a corresponding <code>Push</code>
* </remarks> <seealso cref="Push"/> * </remarks> <seealso cref="Push"/>
**/ **/
public void Pop() throws Z3Exception public void pop() throws Z3Exception
{ {
Native.fixedpointPop(Context().nCtx(), NativeObject()); Native.fixedpointPop(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -175,12 +174,12 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public void UpdateRule(BoolExpr rule, Symbol name) throws Z3Exception public void updateRule(BoolExpr rule, Symbol name) throws Z3Exception
{ {
Context().CheckContextMatch(rule); getContext().checkContextMatch(rule);
Native.fixedpointUpdateRule(Context().nCtx(), NativeObject(), Native.fixedpointUpdateRule(getContext().nCtx(), getNativeObject(),
rule.NativeObject(), AST.GetNativeObject(name)); rule.getNativeObject(), AST.getNativeObject(name));
} }
/** /**
@ -189,29 +188,29 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr GetAnswer() throws Z3Exception public Expr getAnswer() throws Z3Exception
{ {
long ans = Native.fixedpointGetAnswer(Context().nCtx(), NativeObject()); long ans = Native.fixedpointGetAnswer(getContext().nCtx(), getNativeObject());
return (ans == 0) ? null : Expr.Create(Context(), ans); return (ans == 0) ? null : Expr.create(getContext(), ans);
} }
/** /**
* Retrieve explanation why fixedpoint engine returned status Unknown. * Retrieve explanation why fixedpoint engine returned status Unknown.
**/ **/
public String GetReasonUnknown() throws Z3Exception public String getReasonUnknown() throws Z3Exception
{ {
return Native.fixedpointGetReasonUnknown(Context().nCtx(), return Native.fixedpointGetReasonUnknown(getContext().nCtx(),
NativeObject()); getNativeObject());
} }
/** /**
* Retrieve the number of levels explored for a given predicate. * Retrieve the number of levels explored for a given predicate.
**/ **/
public int GetNumLevels(FuncDecl predicate) throws Z3Exception public int getNumLevels(FuncDecl predicate) throws Z3Exception
{ {
return Native.fixedpointGetNumLevels(Context().nCtx(), NativeObject(), return Native.fixedpointGetNumLevels(getContext().nCtx(), getNativeObject(),
predicate.NativeObject()); predicate.getNativeObject());
} }
/** /**
@ -219,22 +218,22 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr GetCoverDelta(int level, FuncDecl predicate) throws Z3Exception public Expr getCoverDelta(int level, FuncDecl predicate) throws Z3Exception
{ {
long res = Native.fixedpointGetCoverDelta(Context().nCtx(), long res = Native.fixedpointGetCoverDelta(getContext().nCtx(),
NativeObject(), level, predicate.NativeObject()); getNativeObject(), level, predicate.getNativeObject());
return (res == 0) ? null : Expr.Create(Context(), res); return (res == 0) ? null : Expr.create(getContext(), res);
} }
/** /**
* Add <tt>property</tt> about the <tt>predicate</tt>. The property is added * Add <tt>property</tt> about the <tt>predicate</tt>. The property is added
* at <tt>level</tt>. * at <tt>level</tt>.
**/ **/
public void AddCover(int level, FuncDecl predicate, Expr property) public void addCover(int level, FuncDecl predicate, Expr property)
throws Z3Exception throws Z3Exception
{ {
Native.fixedpointAddCover(Context().nCtx(), NativeObject(), level, Native.fixedpointAddCover(getContext().nCtx(), getNativeObject(), level,
predicate.NativeObject(), property.NativeObject()); predicate.getNativeObject(), property.getNativeObject());
} }
/** /**
@ -244,7 +243,7 @@ public class Fixedpoint extends Z3Object
{ {
try try
{ {
return Native.fixedpointToString(Context().nCtx(), NativeObject(), return Native.fixedpointToString(getContext().nCtx(), getNativeObject(),
0, null); 0, null);
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
@ -256,12 +255,12 @@ public class Fixedpoint extends Z3Object
* Instrument the Datalog engine on which table representation to use for * Instrument the Datalog engine on which table representation to use for
* recursive predicate. * recursive predicate.
**/ **/
public void SetPredicateRepresentation(FuncDecl f, Symbol[] kinds) throws Z3Exception public void setPredicateRepresentation(FuncDecl f, Symbol[] kinds) throws Z3Exception
{ {
Native.fixedpointSetPredicateRepresentation(Context().nCtx(), Native.fixedpointSetPredicateRepresentation(getContext().nCtx(),
NativeObject(), f.NativeObject(), AST.ArrayLength(kinds), getNativeObject(), f.getNativeObject(), AST.arrayLength(kinds),
Symbol.ArrayToNative(kinds)); Symbol.arrayToNative(kinds));
} }
@ -271,8 +270,8 @@ public class Fixedpoint extends Z3Object
public String toString(BoolExpr[] queries) throws Z3Exception public String toString(BoolExpr[] queries) throws Z3Exception
{ {
return Native.fixedpointToString(Context().nCtx(), NativeObject(), return Native.fixedpointToString(getContext().nCtx(), getNativeObject(),
AST.ArrayLength(queries), AST.ArrayToNative(queries)); AST.arrayLength(queries), AST.arrayToNative(queries));
} }
/** /**
@ -280,15 +279,15 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public BoolExpr[] Rules() throws Z3Exception public BoolExpr[] getRules() throws Z3Exception
{ {
ASTVector v = new ASTVector(Context(), Native.fixedpointGetRules( ASTVector v = new ASTVector(getContext(), Native.fixedpointGetRules(
Context().nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
int n = v.Size(); int n = v.size();
BoolExpr[] res = new BoolExpr[n]; BoolExpr[] res = new BoolExpr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new BoolExpr(Context(), v.get(i).NativeObject()); res[i] = new BoolExpr(getContext(), v.get(i).getNativeObject());
return res; return res;
} }
@ -297,15 +296,15 @@ public class Fixedpoint extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public BoolExpr[] Assertions() throws Z3Exception public BoolExpr[] getAssertions() throws Z3Exception
{ {
ASTVector v = new ASTVector(Context(), Native.fixedpointGetAssertions( ASTVector v = new ASTVector(getContext(), Native.fixedpointGetAssertions(
Context().nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
int n = v.Size(); int n = v.size();
BoolExpr[] res = new BoolExpr[n]; BoolExpr[] res = new BoolExpr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new BoolExpr(Context(), v.get(i).NativeObject()); res[i] = new BoolExpr(getContext(), v.get(i).getNativeObject());
return res; return res;
} }
@ -319,15 +318,15 @@ public class Fixedpoint extends Z3Object
super(ctx, Native.mkFixedpoint(ctx.nCtx())); super(ctx, Native.mkFixedpoint(ctx.nCtx()));
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Fixedpoint_DRQ().IncAndClear(Context(), o); getContext().fixedpoint_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Fixedpoint_DRQ().Add(o); getContext().fixedpoint_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class FixedpointDecRefQueue extends IDecRefQueue class FixedpointDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class FixedpointDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -6,7 +6,9 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_ast_kind;
import com.microsoft.z3.enumerations.Z3_decl_kind;
import com.microsoft.z3.enumerations.Z3_parameter_kind;
/** /**
* Function declarations. * Function declarations.
@ -32,7 +34,7 @@ public class FuncDecl extends AST
/** /**
* Object comparison. * Object comparison.
**/ **/
public boolean Equals(Object o) public boolean equals(Object o)
{ {
FuncDecl casted = (FuncDecl) o; FuncDecl casted = (FuncDecl) o;
if (casted == null) if (casted == null)
@ -43,9 +45,9 @@ public class FuncDecl extends AST
/** /**
* A hash code. * A hash code.
**/ **/
public int GetHashCode() throws Z3Exception public int hashCode()
{ {
return super.GetHashCode(); return super.hashCode();
} }
/** /**
@ -55,7 +57,7 @@ public class FuncDecl extends AST
{ {
try try
{ {
return Native.funcDeclToString(Context().nCtx(), NativeObject()); return Native.funcDeclToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -65,125 +67,125 @@ public class FuncDecl extends AST
/** /**
* Returns a unique identifier for the function declaration. * Returns a unique identifier for the function declaration.
**/ **/
public int Id() throws Z3Exception public int getId() throws Z3Exception
{ {
return Native.getFuncDeclId(Context().nCtx(), NativeObject()); return Native.getFuncDeclId(getContext().nCtx(), getNativeObject());
} }
/** /**
* The arity of the function declaration * The arity of the function declaration
**/ **/
public int Arity() throws Z3Exception public int getArity() throws Z3Exception
{ {
return Native.getArity(Context().nCtx(), NativeObject()); return Native.getArity(getContext().nCtx(), getNativeObject());
} }
/** /**
* The size of the domain of the function declaration <seealso * The size of the domain of the function declaration <seealso
* cref="Arity"/> * cref="Arity"/>
**/ **/
public int DomainSize() throws Z3Exception public int getDomainSize() throws Z3Exception
{ {
return Native.getDomainSize(Context().nCtx(), NativeObject()); return Native.getDomainSize(getContext().nCtx(), getNativeObject());
} }
/** /**
* The domain of the function declaration * The domain of the function declaration
**/ **/
public Sort[] Domain() throws Z3Exception public Sort[] getDomain() throws Z3Exception
{ {
int n = DomainSize(); int n = getDomainSize();
Sort[] res = new Sort[n]; Sort[] res = new Sort[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Sort.Create(Context(), res[i] = Sort.create(getContext(),
Native.getDomain(Context().nCtx(), NativeObject(), i)); Native.getDomain(getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
/** /**
* The range of the function declaration * The range of the function declaration
**/ **/
public Sort Range() throws Z3Exception public Sort getRange() throws Z3Exception
{ {
return Sort.Create(Context(), return Sort.create(getContext(),
Native.getRange(Context().nCtx(), NativeObject())); Native.getRange(getContext().nCtx(), getNativeObject()));
} }
/** /**
* The kind of the function declaration. * The kind of the function declaration.
**/ **/
public Z3_decl_kind DeclKind() throws Z3Exception public Z3_decl_kind getDeclKind() throws Z3Exception
{ {
return Z3_decl_kind.fromInt(Native.getDeclKind(Context().nCtx(), return Z3_decl_kind.fromInt(Native.getDeclKind(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
* The name of the function declaration * The name of the function declaration
**/ **/
public Symbol Name() throws Z3Exception public Symbol getName() throws Z3Exception
{ {
return Symbol.Create(Context(), return Symbol.create(getContext(),
Native.getDeclName(Context().nCtx(), NativeObject())); Native.getDeclName(getContext().nCtx(), getNativeObject()));
} }
/** /**
* The number of parameters of the function declaration * The number of parameters of the function declaration
**/ **/
public int NumParameters() throws Z3Exception public int getNumParameters() throws Z3Exception
{ {
return Native.getDeclNumParameters(Context().nCtx(), NativeObject()); return Native.getDeclNumParameters(getContext().nCtx(), getNativeObject());
} }
/** /**
* The parameters of the function declaration * The parameters of the function declaration
**/ **/
public Parameter[] Parameters() throws Z3Exception public Parameter[] getParameters() throws Z3Exception
{ {
int num = NumParameters(); int num = getNumParameters();
Parameter[] res = new Parameter[num]; Parameter[] res = new Parameter[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
Z3_parameter_kind k = Z3_parameter_kind.fromInt(Native Z3_parameter_kind k = Z3_parameter_kind.fromInt(Native
.getDeclParameterKind(Context().nCtx(), NativeObject(), i)); .getDeclParameterKind(getContext().nCtx(), getNativeObject(), i));
switch (k) switch (k)
{ {
case Z3_PARAMETER_INT: case Z3_PARAMETER_INT:
res[i] = new Parameter(k, Native.getDeclIntParameter(Context() res[i] = new Parameter(k, Native.getDeclIntParameter(getContext()
.nCtx(), NativeObject(), i)); .nCtx(), getNativeObject(), i));
break; break;
case Z3_PARAMETER_DOUBLE: case Z3_PARAMETER_DOUBLE:
res[i] = new Parameter(k, Native.getDeclDoubleParameter( res[i] = new Parameter(k, Native.getDeclDoubleParameter(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
break; break;
case Z3_PARAMETER_SYMBOL: case Z3_PARAMETER_SYMBOL:
res[i] = new Parameter(k, Symbol.Create(Context(), Native res[i] = new Parameter(k, Symbol.create(getContext(), Native
.getDeclSymbolParameter(Context().nCtx(), .getDeclSymbolParameter(getContext().nCtx(),
NativeObject(), i))); getNativeObject(), i)));
break; break;
case Z3_PARAMETER_SORT: case Z3_PARAMETER_SORT:
res[i] = new Parameter(k, Sort.Create(Context(), Native res[i] = new Parameter(k, Sort.create(getContext(), Native
.getDeclSortParameter(Context().nCtx(), NativeObject(), .getDeclSortParameter(getContext().nCtx(), getNativeObject(),
i))); i)));
break; break;
case Z3_PARAMETER_AST: case Z3_PARAMETER_AST:
res[i] = new Parameter(k, new AST(Context(), res[i] = new Parameter(k, new AST(getContext(),
Native.getDeclAstParameter(Context().nCtx(), Native.getDeclAstParameter(getContext().nCtx(),
NativeObject(), i))); getNativeObject(), i)));
break; break;
case Z3_PARAMETER_FUNC_DECL: case Z3_PARAMETER_FUNC_DECL:
res[i] = new Parameter(k, new FuncDecl(Context(), res[i] = new Parameter(k, new FuncDecl(getContext(),
Native.getDeclFuncDeclParameter(Context().nCtx(), Native.getDeclFuncDeclParameter(getContext().nCtx(),
NativeObject(), i))); getNativeObject(), i)));
break; break;
case Z3_PARAMETER_RATIONAL: case Z3_PARAMETER_RATIONAL:
res[i] = new Parameter(k, Native.getDeclRationalParameter( res[i] = new Parameter(k, Native.getDeclRationalParameter(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
break; break;
default: default:
throw new Z3Exception( throw new Z3Exception(
@ -210,9 +212,9 @@ public class FuncDecl extends AST
/** /**
* The int value of the parameter.</summary> * The int value of the parameter.</summary>
**/ **/
public int Int() throws Z3Exception public int getInt() throws Z3Exception
{ {
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_INT) if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_INT)
throw new Z3Exception("parameter is not an int"); throw new Z3Exception("parameter is not an int");
return i; return i;
} }
@ -220,9 +222,9 @@ public class FuncDecl extends AST
/** /**
* The double value of the parameter.</summary> * The double value of the parameter.</summary>
**/ **/
public double Double() throws Z3Exception public double getDouble() throws Z3Exception
{ {
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_DOUBLE) if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_DOUBLE)
throw new Z3Exception("parameter is not a double "); throw new Z3Exception("parameter is not a double ");
return d; return d;
} }
@ -230,9 +232,9 @@ public class FuncDecl extends AST
/** /**
* The Symbol value of the parameter.</summary> * The Symbol value of the parameter.</summary>
**/ **/
public Symbol Symbol() throws Z3Exception public Symbol getSymbol() throws Z3Exception
{ {
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SYMBOL) if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SYMBOL)
throw new Z3Exception("parameter is not a Symbol"); throw new Z3Exception("parameter is not a Symbol");
return sym; return sym;
} }
@ -240,9 +242,9 @@ public class FuncDecl extends AST
/** /**
* The Sort value of the parameter.</summary> * The Sort value of the parameter.</summary>
**/ **/
public Sort Sort() throws Z3Exception public Sort getSort() throws Z3Exception
{ {
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SORT) if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SORT)
throw new Z3Exception("parameter is not a Sort"); throw new Z3Exception("parameter is not a Sort");
return srt; return srt;
} }
@ -250,9 +252,9 @@ public class FuncDecl extends AST
/** /**
* The AST value of the parameter.</summary> * The AST value of the parameter.</summary>
**/ **/
public AST AST() throws Z3Exception public AST getAST() throws Z3Exception
{ {
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_AST) if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_AST)
throw new Z3Exception("parameter is not an AST"); throw new Z3Exception("parameter is not an AST");
return ast; return ast;
} }
@ -260,9 +262,9 @@ public class FuncDecl extends AST
/** /**
* The FunctionDeclaration value of the parameter.</summary> * The FunctionDeclaration value of the parameter.</summary>
**/ **/
public FuncDecl FuncDecl() throws Z3Exception public FuncDecl getFuncDecl() throws Z3Exception
{ {
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL) if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL)
throw new Z3Exception("parameter is not a function declaration"); throw new Z3Exception("parameter is not a function declaration");
return fd; return fd;
} }
@ -270,9 +272,9 @@ public class FuncDecl extends AST
/** /**
* The rational string value of the parameter.</summary> * The rational string value of the parameter.</summary>
**/ **/
public String Rational() throws Z3Exception public String getRational() throws Z3Exception
{ {
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_RATIONAL) if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_RATIONAL)
throw new Z3Exception("parameter is not a rational String"); throw new Z3Exception("parameter is not a rational String");
return r; return r;
} }
@ -280,7 +282,7 @@ public class FuncDecl extends AST
/** /**
* The kind of the parameter. * The kind of the parameter.
**/ **/
public Z3_parameter_kind ParameterKind() throws Z3Exception public Z3_parameter_kind getParameterKind() throws Z3Exception
{ {
return kind; return kind;
} }
@ -337,9 +339,9 @@ public class FuncDecl extends AST
FuncDecl(Context ctx, Symbol name, Sort[] domain, Sort range) FuncDecl(Context ctx, Symbol name, Sort[] domain, Sort range)
throws Z3Exception throws Z3Exception
{ {
super(ctx, Native.mkFuncDecl(ctx.nCtx(), name.NativeObject(), super(ctx, Native.mkFuncDecl(ctx.nCtx(), name.getNativeObject(),
AST.ArrayLength(domain), AST.ArrayToNative(domain), AST.arrayLength(domain), AST.arrayToNative(domain),
range.NativeObject())); range.getNativeObject()));
} }
@ -347,18 +349,18 @@ public class FuncDecl extends AST
throws Z3Exception throws Z3Exception
{ {
super(ctx, Native.mkFreshFuncDecl(ctx.nCtx(), prefix, super(ctx, Native.mkFreshFuncDecl(ctx.nCtx(), prefix,
AST.ArrayLength(domain), AST.ArrayToNative(domain), AST.arrayLength(domain), AST.arrayToNative(domain),
range.NativeObject())); range.getNativeObject()));
} }
void CheckNativeObject(long obj) throws Z3Exception void checkNativeObject(long obj) throws Z3Exception
{ {
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_FUNC_DECL_AST if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_FUNC_DECL_AST
.toInt()) .toInt())
throw new Z3Exception( throw new Z3Exception(
"Underlying object is not a function declaration"); "Underlying object is not a function declaration");
super.CheckNativeObject(obj); super.checkNativeObject(obj);
} }
/** /**
@ -367,31 +369,9 @@ public class FuncDecl extends AST
* *
* @return * @return
**/ **/
/* operator this[] not translated */ public Expr apply(Expr ... args) throws Z3Exception
/**
* Create expression that applies function to arguments. <param
* name="args"></param>
*
* @return
**/
public Expr Apply(Expr[] args) throws Z3Exception
{ {
Context().CheckContextMatch(args); getContext().checkContextMatch(args);
return Expr.Create(Context(), this, args); return Expr.create(getContext(), this, args);
} }
/**
* Create expression that applies function to one argument. <param
* name="arg"></param>
*
* @return
**/
public Expr Apply(Expr arg) throws Z3Exception
{
Context().CheckContextMatch(arg);
Expr[] a = { arg };
return Expr.Create(Context(), this, a);
}
} }

View file

@ -24,18 +24,18 @@ public class FuncInterp extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr Value() throws Z3Exception public Expr getValue() throws Z3Exception
{ {
return Expr.Create(Context(), return Expr.create(getContext(),
Native.funcEntryGetValue(Context().nCtx(), NativeObject())); Native.funcEntryGetValue(getContext().nCtx(), getNativeObject()));
} }
/** /**
* The number of arguments of the entry. * The number of arguments of the entry.
**/ **/
public int NumArgs() throws Z3Exception public int getNumArgs() throws Z3Exception
{ {
return Native.funcEntryGetNumArgs(Context().nCtx(), NativeObject()); return Native.funcEntryGetNumArgs(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -43,13 +43,13 @@ public class FuncInterp extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr[] Args() throws Z3Exception public Expr[] getArgs() throws Z3Exception
{ {
int n = NumArgs(); int n = getNumArgs();
Expr[] res = new Expr[n]; Expr[] res = new Expr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Expr.Create(Context(), Native.funcEntryGetArg( res[i] = Expr.create(getContext(), Native.funcEntryGetArg(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -60,12 +60,12 @@ public class FuncInterp extends Z3Object
{ {
try try
{ {
int n = NumArgs(); int n = getNumArgs();
String res = "["; String res = "[";
Expr[] args = Args(); Expr[] args = getArgs();
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res += args[i] + ", "; res += args[i] + ", ";
return res + Value() + "]"; return res + getValue() + "]";
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return new String("Z3Exception: " + e.getMessage()); return new String("Z3Exception: " + e.getMessage());
@ -77,25 +77,25 @@ public class FuncInterp extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().FuncEntry_DRQ().IncAndClear(Context(), o); getContext().funcEntry_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().FuncEntry_DRQ().Add(o); getContext().funcEntry_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
}; };
/** /**
* The number of entries in the function interpretation. * The number of entries in the function interpretation.
**/ **/
public int NumEntries() throws Z3Exception public int getNumEntries() throws Z3Exception
{ {
return Native.funcInterpGetNumEntries(Context().nCtx(), NativeObject()); return Native.funcInterpGetNumEntries(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -103,13 +103,13 @@ public class FuncInterp extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Entry[] Entries() throws Z3Exception public Entry[] getEntries() throws Z3Exception
{ {
int n = NumEntries(); int n = getNumEntries();
Entry[] res = new Entry[n]; Entry[] res = new Entry[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new Entry(Context(), Native.funcInterpGetEntry(Context() res[i] = new Entry(getContext(), Native.funcInterpGetEntry(getContext()
.nCtx(), NativeObject(), i)); .nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -118,18 +118,18 @@ public class FuncInterp extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr Else() throws Z3Exception public Expr getElse() throws Z3Exception
{ {
return Expr.Create(Context(), return Expr.create(getContext(),
Native.funcInterpGetElse(Context().nCtx(), NativeObject())); Native.funcInterpGetElse(getContext().nCtx(), getNativeObject()));
} }
/** /**
* The arity of the function interpretation * The arity of the function interpretation
**/ **/
public int Arity() throws Z3Exception public int getArity() throws Z3Exception
{ {
return Native.funcInterpGetArity(Context().nCtx(), NativeObject()); return Native.funcInterpGetArity(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -141,12 +141,12 @@ public class FuncInterp extends Z3Object
{ {
String res = ""; String res = "";
res += "["; res += "[";
for (Entry e : Entries()) for (Entry e : getEntries())
{ {
int n = e.NumArgs(); int n = e.getNumArgs();
if (n > 1) if (n > 1)
res += "["; res += "[";
Expr[] args = e.Args(); Expr[] args = e.getArgs();
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
if (i != 0) if (i != 0)
@ -155,9 +155,9 @@ public class FuncInterp extends Z3Object
} }
if (n > 1) if (n > 1)
res += "]"; res += "]";
res += " -> " + e.Value() + ", "; res += " -> " + e.getValue() + ", ";
} }
res += "else -> " + Else(); res += "else -> " + getElse();
res += "]"; res += "]";
return res; return res;
} catch (Z3Exception e) } catch (Z3Exception e)
@ -171,15 +171,15 @@ public class FuncInterp extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().FuncInterp_DRQ().IncAndClear(Context(), o); getContext().funcInterp_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().FuncInterp_DRQ().Add(o); getContext().funcInterp_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class FuncInterpDecRefQueue extends IDecRefQueue class FuncInterpDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class FuncInterpDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class FuncInterpEntryDecRefQueue extends IDecRefQueue class FuncInterpEntryDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class FuncInterpEntryDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -30,7 +30,7 @@ public final class Global
* will set the parameter "decimal" in the module "pp" to true. * will set the parameter "decimal" in the module "pp" to true.
* </remarks> * </remarks>
**/ **/
public static void SetParameter(String id, String value) public static void setParameter(String id, String value)
{ {
Native.globalParamSet(id, value); Native.globalParamSet(id, value);
} }
@ -44,7 +44,7 @@ public final class Global
* The result string stored in param_value is stored in a shared location. * The result string stored in param_value is stored in a shared location.
* </remarks> * </remarks>
**/ **/
public static String GetParameter(String id) public static String getParameter(String id)
{ {
Native.StringPtr res = new Native.StringPtr(); Native.StringPtr res = new Native.StringPtr();
if (!Native.globalParamGet(id, res)) if (!Native.globalParamGet(id, res))
@ -60,7 +60,7 @@ public final class Global
* </remarks> * </remarks>
* @seealso SetParameter * @seealso SetParameter
**/ **/
public static void ResetParameters() public static void resetParameters()
{ {
Native.globalParamResetAll(); Native.globalParamResetAll();
} }

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_goal_prec;
/** /**
* A goal (aka problem). A goal is essentially a set of formulas, that can be * A goal (aka problem). A goal is essentially a set of formulas, that can be
@ -21,43 +21,43 @@ public class Goal extends Z3Object
* applied when the objective is to find a proof for a given goal. * applied when the objective is to find a proof for a given goal.
* </remarks> * </remarks>
**/ **/
public Z3_goal_prec Precision() throws Z3Exception public Z3_goal_prec getPrecision() throws Z3Exception
{ {
return Z3_goal_prec.fromInt(Native.goalPrecision(Context().nCtx(), return Z3_goal_prec.fromInt(Native.goalPrecision(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
* Indicates whether the goal is precise. * Indicates whether the goal is precise.
**/ **/
public boolean IsPrecise() throws Z3Exception public boolean isPrecise() throws Z3Exception
{ {
return Precision() == Z3_goal_prec.Z3_GOAL_PRECISE; return getPrecision() == Z3_goal_prec.Z3_GOAL_PRECISE;
} }
/** /**
* Indicates whether the goal is an under-approximation. * Indicates whether the goal is an under-approximation.
**/ **/
public boolean IsUnderApproximation() throws Z3Exception public boolean isUnderApproximation() throws Z3Exception
{ {
return Precision() == Z3_goal_prec.Z3_GOAL_UNDER; return getPrecision() == Z3_goal_prec.Z3_GOAL_UNDER;
} }
/** /**
* Indicates whether the goal is an over-approximation. * Indicates whether the goal is an over-approximation.
**/ **/
public boolean IsOverApproximation() throws Z3Exception public boolean isOverApproximation() throws Z3Exception
{ {
return Precision() == Z3_goal_prec.Z3_GOAL_OVER; return getPrecision() == Z3_goal_prec.Z3_GOAL_OVER;
} }
/** /**
* Indicates whether the goal is garbage (i.e., the product of over- and * Indicates whether the goal is garbage (i.e., the product of over- and
* under-approximations). * under-approximations).
**/ **/
public boolean IsGarbage() throws Z3Exception public boolean isGarbage() throws Z3Exception
{ {
return Precision() == Z3_goal_prec.Z3_GOAL_UNDER_OVER; return getPrecision() == Z3_goal_prec.Z3_GOAL_UNDER_OVER;
} }
/** /**
@ -65,59 +65,47 @@ public class Goal extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public void Assert(BoolExpr[] constraints) throws Z3Exception public void assert_(BoolExpr ... constraints) throws Z3Exception
{ {
Context().CheckContextMatch(constraints); getContext().checkContextMatch(constraints);
for (BoolExpr c : constraints) for (BoolExpr c : constraints)
{ {
Native.goalAssert(Context().nCtx(), NativeObject(), Native.goalAssert(getContext().nCtx(), getNativeObject(),
c.NativeObject()); c.getNativeObject());
} }
} }
/**
* Adds a <paramref name="constraint"/> to the given goal.
*
* @throws Z3Exception
**/
public void Assert(BoolExpr constraint) throws Z3Exception
{
Context().CheckContextMatch(constraint);
Native.goalAssert(Context().nCtx(), NativeObject(),
constraint.NativeObject());
}
/** /**
* Indicates whether the goal contains `false'. * Indicates whether the goal contains `false'.
**/ **/
public boolean Inconsistent() throws Z3Exception public boolean inconsistent() throws Z3Exception
{ {
return Native.goalInconsistent(Context().nCtx(), NativeObject()); return Native.goalInconsistent(getContext().nCtx(), getNativeObject());
} }
/** /**
* The depth of the goal. <remarks> This tracks how many transformations * The depth of the goal. <remarks> This tracks how many transformations
* were applied to it. </remarks> * were applied to it. </remarks>
**/ **/
public int Depth() throws Z3Exception public int getDepth() throws Z3Exception
{ {
return Native.goalDepth(Context().nCtx(), NativeObject()); return Native.goalDepth(getContext().nCtx(), getNativeObject());
} }
/** /**
* Erases all formulas from the given goal. * Erases all formulas from the given goal.
**/ **/
public void Reset() throws Z3Exception public void reset() throws Z3Exception
{ {
Native.goalReset(Context().nCtx(), NativeObject()); Native.goalReset(getContext().nCtx(), getNativeObject());
} }
/** /**
* The number of formulas in the goal. * The number of formulas in the goal.
**/ **/
public int Size() throws Z3Exception public int size() throws Z3Exception
{ {
return Native.goalSize(Context().nCtx(), NativeObject()); return Native.goalSize(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -125,40 +113,41 @@ public class Goal extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public BoolExpr[] Formulas() throws Z3Exception public BoolExpr[] getFormulas() throws Z3Exception
{ {
int n = Size(); int n = size();
BoolExpr[] res = new BoolExpr[n]; BoolExpr[] res = new BoolExpr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new BoolExpr(Context(), Native.goalFormula(Context() res[i] = new BoolExpr(getContext(), Native.goalFormula(getContext()
.nCtx(), NativeObject(), i)); .nCtx(), getNativeObject(), i));
return res; return res;
} }
/** /**
* The number of formulas, subformulas and terms in the goal. * The number of formulas, subformulas and terms in the goal.
**/ **/
public int NumExprs() throws Z3Exception public int getNumExprs() throws Z3Exception
{ {
return Native.goalNumExprs(Context().nCtx(), NativeObject()); return Native.goalNumExprs(getContext().nCtx(), getNativeObject());
} }
/** /**
* Indicates whether the goal is empty, and it is precise or the product of * Indicates whether the goal is empty, and it is precise or the product of
* an under approximation. * an under approximation.
**/ **/
public boolean IsDecidedSat() throws Z3Exception public boolean isDecidedSat() throws Z3Exception
{ {
return Native.goalIsDecidedSat(Context().nCtx(), NativeObject()); return Native.goalIsDecidedSat(getContext().nCtx(), getNativeObject());
} }
/** /**
* Indicates whether the goal contains `false', and it is precise or the * Indicates whether the goal contains `false', and it is precise or the
* product of an over approximation. * product of an over approximation.
**/ **/
public boolean IsDecidedUnsat() throws Z3Exception public boolean isDecidedUnsat() throws Z3Exception
{ {
return Native.goalIsDecidedUnsat(Context().nCtx(), NativeObject()); return Native
.goalIsDecidedUnsat(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -167,25 +156,40 @@ public class Goal extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Goal Translate(Context ctx) throws Z3Exception public Goal translate(Context ctx) throws Z3Exception
{ {
return new Goal(ctx, Native.goalTranslate(Context().nCtx(), return new Goal(ctx, Native.goalTranslate(getContext().nCtx(),
NativeObject(), ctx.nCtx())); getNativeObject(), ctx.nCtx()));
} }
/** /**
* Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic * Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic
* on the goal.</remarks> * on the goal.</remarks>
**/ **/
public Goal Simplify(Params p) throws Z3Exception public Goal simplify() throws Z3Exception
{ {
Tactic t = Context().MkTactic("simplify"); Tactic t = getContext().mkTactic("simplify");
ApplyResult res = t.Apply(this, p); ApplyResult res = t.apply(this);
if (res.NumSubgoals() == 0) if (res.getNumSubgoals() == 0)
throw new Z3Exception("No subgoals"); throw new Z3Exception("No subgoals");
else else
return res.Subgoals()[0]; return res.getSubgoals()[0];
}
/**
* Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic
* on the goal.</remarks>
**/
public Goal simplify(Params p) throws Z3Exception
{
Tactic t = getContext().mkTactic("simplify");
ApplyResult res = t.apply(this, p);
if (res.getNumSubgoals() == 0)
throw new Z3Exception("No subgoals");
else
return res.getSubgoals()[0];
} }
/** /**
@ -197,7 +201,7 @@ public class Goal extends Z3Object
{ {
try try
{ {
return Native.goalToString(Context().nCtx(), NativeObject()); return Native.goalToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -216,16 +220,16 @@ public class Goal extends Z3Object
(unsatCores) ? true : false, (proofs) ? true : false)); (unsatCores) ? true : false, (proofs) ? true : false));
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Goal_DRQ().IncAndClear(Context(), o); getContext().goal_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Goal_DRQ().Add(o); getContext().goal_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class GoalDecRefQueue extends IDecRefQueue class GoalDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class GoalDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -6,26 +6,26 @@
package com.microsoft.z3; package com.microsoft.z3;
import java.util.*; import java.util.LinkedList;
abstract class IDecRefQueue abstract class IDecRefQueue
{ {
protected Object m_lock = new Object(); protected Object m_lock = new Object();
protected LinkedList<Long> m_queue = new LinkedList<Long>(); protected LinkedList<Long> m_queue = new LinkedList<Long>();
final int m_move_limit = 1024; protected final int m_move_limit = 1024;
public abstract void IncRef(Context ctx, long obj); protected abstract void incRef(Context ctx, long obj);
public abstract void DecRef(Context ctx, long obj); protected abstract void decRef(Context ctx, long obj);
public void IncAndClear(Context ctx, long o) protected void incAndClear(Context ctx, long o)
{ {
IncRef(ctx, o); incRef(ctx, o);
if (m_queue.size() >= m_move_limit) if (m_queue.size() >= m_move_limit)
Clear(ctx); clear(ctx);
} }
public void Add(long o) protected void add(long o)
{ {
if (o == 0) if (o == 0)
return; return;
@ -36,12 +36,12 @@ abstract class IDecRefQueue
} }
} }
public void Clear(Context ctx) protected void clear(Context ctx)
{ {
synchronized (m_lock) synchronized (m_lock)
{ {
for (Long o : m_queue) for (Long o : m_queue)
DecRef(ctx, o); decRef(ctx, o);
m_queue.clear(); m_queue.clear();
} }
} }

View file

@ -21,7 +21,7 @@ package com.microsoft.z3;
public class IDisposable public class IDisposable
{ {
public void Dispose() throws Z3Exception public void dispose() throws Z3Exception
{ {
} }
} }

View file

@ -22,10 +22,10 @@ public class IntNum extends IntExpr
/** /**
* Retrieve the int value. * Retrieve the int value.
**/ **/
public int Int() throws Z3Exception public int getInt() throws Z3Exception
{ {
Native.IntPtr res = new Native.IntPtr(); Native.IntPtr res = new Native.IntPtr();
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true) if (Native.getNumeralInt(getContext().nCtx(), getNativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int"); throw new Z3Exception("Numeral is not an int");
return res.value; return res.value;
} }
@ -33,10 +33,10 @@ public class IntNum extends IntExpr
/** /**
* Retrieve the 64-bit int value. * Retrieve the 64-bit int value.
**/ **/
public long Int64() throws Z3Exception public long getInt64() throws Z3Exception
{ {
Native.LongPtr res = new Native.LongPtr(); Native.LongPtr res = new Native.LongPtr();
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true) if (Native.getNumeralInt64(getContext().nCtx(), getNativeObject(), res) ^ true)
throw new Z3Exception("Numeral is not an int64"); throw new Z3Exception("Numeral is not an int64");
return res.value; return res.value;
} }
@ -44,7 +44,7 @@ public class IntNum extends IntExpr
/** /**
* Retrieve the BigInteger value. * Retrieve the BigInteger value.
**/ **/
public BigInteger BigInteger() throws Z3Exception public BigInteger getBigInteger() throws Z3Exception
{ {
return new BigInteger(this.toString()); return new BigInteger(this.toString());
} }
@ -56,7 +56,7 @@ public class IntNum extends IntExpr
{ {
try try
{ {
return Native.getNumeralString(Context().nCtx(), NativeObject()); return Native.getNumeralString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_symbol_kind;
/** /**
* Numbered symbols * Numbered symbols
@ -17,11 +17,11 @@ public class IntSymbol extends Symbol
* The int value of the symbol. <remarks>Throws an exception if the symbol * The int value of the symbol. <remarks>Throws an exception if the symbol
* is not of int kind. </remarks> * is not of int kind. </remarks>
**/ **/
public int Int() throws Z3Exception public int getInt() throws Z3Exception
{ {
if (!IsIntSymbol()) if (!isIntSymbol())
throw new Z3Exception("Int requested from non-Int symbol"); throw new Z3Exception("Int requested from non-Int symbol");
return Native.getSymbolInt(Context().nCtx(), NativeObject()); return Native.getSymbolInt(getContext().nCtx(), getNativeObject());
} }
IntSymbol(Context ctx, long obj) throws Z3Exception IntSymbol(Context ctx, long obj) throws Z3Exception
@ -34,11 +34,11 @@ public class IntSymbol extends Symbol
super(ctx, Native.mkIntSymbol(ctx.nCtx(), i)); super(ctx, Native.mkIntSymbol(ctx.nCtx(), i));
} }
void CheckNativeObject(long obj) throws Z3Exception void checkNativeObject(long obj) throws Z3Exception
{ {
if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_INT_SYMBOL if (Native.getSymbolKind(getContext().nCtx(), obj) != Z3_symbol_kind.Z3_INT_SYMBOL
.toInt()) .toInt())
throw new Z3Exception("Symbol is not of integer kind"); throw new Z3Exception("Symbol is not of integer kind");
super.CheckNativeObject(obj); super.checkNativeObject(obj);
} }
} }

View file

@ -14,36 +14,32 @@ public class ListSort extends Sort
/** /**
* The declaration of the nil function of this list sort. * The declaration of the nil function of this list sort.
**/ **/
public FuncDecl NilDecl() public FuncDecl getNilDecl()
{ {
return nilDecl; return nilDecl;
} }
/** /**
* The empty list. * The empty list.
**/ **/
public Expr Nil() public Expr getNil()
{ {
return nilConst; return nilConst;
} }
/** /**
* The declaration of the isNil function of this list sort. * The declaration of the isNil function of this list sort.
**/ **/
public FuncDecl IsNilDecl() public FuncDecl getIsNilDecl()
{ {
return isNilDecl; return isNilDecl;
} }
/** /**
* The declaration of the cons function of this list sort. * The declaration of the cons function of this list sort.
**/ **/
public FuncDecl ConsDecl() public FuncDecl getConsDecl()
{ {
return consDecl; return consDecl;
} }
@ -51,27 +47,24 @@ public class ListSort extends Sort
* The declaration of the isCons function of this list sort. * The declaration of the isCons function of this list sort.
* *
**/ **/
public FuncDecl IsConsDecl() public FuncDecl getIsConsDecl()
{ {
return isConsDecl; return isConsDecl;
} }
/** /**
* The declaration of the head function of this list sort. * The declaration of the head function of this list sort.
**/ **/
public FuncDecl HeadDecl() public FuncDecl getHeadDecl()
{ {
return headDecl; return headDecl;
} }
/** /**
* The declaration of the tail function of this list sort. * The declaration of the tail function of this list sort.
**/ **/
public FuncDecl TailDecl() public FuncDecl getTailDecl()
{ {
return tailDecl; return tailDecl;
} }
@ -87,8 +80,8 @@ public class ListSort extends Sort
Native.LongPtr icons = new Native.LongPtr(), iiscons = new Native.LongPtr(); Native.LongPtr icons = new Native.LongPtr(), iiscons = new Native.LongPtr();
Native.LongPtr ihead = new Native.LongPtr(), itail = new Native.LongPtr(); Native.LongPtr ihead = new Native.LongPtr(), itail = new Native.LongPtr();
setNativeObject(Native.mkListSort(ctx.nCtx(), name.NativeObject(), setNativeObject(Native.mkListSort(ctx.nCtx(), name.getNativeObject(),
elemSort.NativeObject(), inil, iisnil, icons, iiscons, ihead, elemSort.getNativeObject(), inil, iisnil, icons, iiscons, ihead,
itail)); itail));
nilDecl = new FuncDecl(ctx, inil.value); nilDecl = new FuncDecl(ctx, inil.value);
isNilDecl = new FuncDecl(ctx, iisnil.value); isNilDecl = new FuncDecl(ctx, iisnil.value);
@ -96,6 +89,6 @@ public class ListSort extends Sort
isConsDecl = new FuncDecl(ctx, iiscons.value); isConsDecl = new FuncDecl(ctx, iiscons.value);
headDecl = new FuncDecl(ctx, ihead.value); headDecl = new FuncDecl(ctx, ihead.value);
tailDecl = new FuncDecl(ctx, itail.value); tailDecl = new FuncDecl(ctx, itail.value);
nilConst = ctx.MkConst(nilDecl); nilConst = ctx.mkConst(nilDecl);
} }
}; };

View file

@ -21,7 +21,7 @@ public final class Log
* *
* @return True if opening the log file succeeds, false otherwise. * @return True if opening the log file succeeds, false otherwise.
**/ **/
public static boolean Open(String filename) public static boolean open(String filename)
{ {
m_is_open = true; m_is_open = true;
return Native.openLog(filename) == 1; return Native.openLog(filename) == 1;
@ -30,7 +30,7 @@ public final class Log
/** /**
* Closes the interaction log. * Closes the interaction log.
**/ **/
public static void Close() public static void close()
{ {
m_is_open = false; m_is_open = false;
Native.closeLog(); Native.closeLog();
@ -41,7 +41,7 @@ public final class Log
* log. * log.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public static void Append(String s) throws Z3Exception public static void append(String s) throws Z3Exception
{ {
if (!m_is_open) if (!m_is_open)
throw new Z3Exception("Log cannot be closed."); throw new Z3Exception("Log cannot be closed.");

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_sort_kind;
/** /**
* A Model contains interpretations (assignments) of constants and functions. * A Model contains interpretations (assignments) of constants and functions.
@ -21,10 +21,10 @@ public class Model extends Z3Object
* null otherwise. * null otherwise.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr ConstInterp(Expr a) throws Z3Exception public Expr getConstInterp(Expr a) throws Z3Exception
{ {
Context().CheckContextMatch(a); getContext().checkContextMatch(a);
return ConstInterp(a.FuncDecl()); return getConstInterp(a.getFuncDecl());
} }
/** /**
@ -35,22 +35,22 @@ public class Model extends Z3Object
* null otherwise. * null otherwise.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr ConstInterp(FuncDecl f) throws Z3Exception public Expr getConstInterp(FuncDecl f) throws Z3Exception
{ {
Context().CheckContextMatch(f); getContext().checkContextMatch(f);
if (f.Arity() != 0 if (f.getArity() != 0
|| Native.getSortKind(Context().nCtx(), || Native.getSortKind(getContext().nCtx(),
Native.getRange(Context().nCtx(), f.NativeObject())) == Z3_sort_kind.Z3_ARRAY_SORT Native.getRange(getContext().nCtx(), f.getNativeObject())) == Z3_sort_kind.Z3_ARRAY_SORT
.toInt()) .toInt())
throw new Z3Exception( throw new Z3Exception(
"Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp."); "Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp.");
long n = Native.modelGetConstInterp(Context().nCtx(), NativeObject(), long n = Native.modelGetConstInterp(getContext().nCtx(), getNativeObject(),
f.NativeObject()); f.getNativeObject());
if (n == 0) if (n == 0)
return null; return null;
else else
return Expr.Create(Context(), n); return Expr.create(getContext(), n);
} }
/** /**
@ -62,17 +62,17 @@ public class Model extends Z3Object
* the model, null otherwise. * the model, null otherwise.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncInterp FuncInterp(FuncDecl f) throws Z3Exception public FuncInterp getFuncInterp(FuncDecl f) throws Z3Exception
{ {
Context().CheckContextMatch(f); getContext().checkContextMatch(f);
Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(Context() Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(getContext()
.nCtx(), Native.getRange(Context().nCtx(), f.NativeObject()))); .nCtx(), Native.getRange(getContext().nCtx(), f.getNativeObject())));
if (f.Arity() == 0) if (f.getArity() == 0)
{ {
long n = Native.modelGetConstInterp(Context().nCtx(), long n = Native.modelGetConstInterp(getContext().nCtx(),
NativeObject(), f.NativeObject()); getNativeObject(), f.getNativeObject());
if (sk == Z3_sort_kind.Z3_ARRAY_SORT) if (sk == Z3_sort_kind.Z3_ARRAY_SORT)
{ {
@ -80,11 +80,11 @@ public class Model extends Z3Object
return null; return null;
else else
{ {
if (Native.isAsArray(Context().nCtx(), n) ^ true) if (Native.isAsArray(getContext().nCtx(), n) ^ true)
throw new Z3Exception( throw new Z3Exception(
"Argument was not an array constant"); "Argument was not an array constant");
long fd = Native.getAsArrayFuncDecl(Context().nCtx(), n); long fd = Native.getAsArrayFuncDecl(getContext().nCtx(), n);
return FuncInterp(new FuncDecl(Context(), fd)); return getFuncInterp(new FuncDecl(getContext(), fd));
} }
} else } else
{ {
@ -93,21 +93,21 @@ public class Model extends Z3Object
} }
} else } else
{ {
long n = Native.modelGetFuncInterp(Context().nCtx(), long n = Native.modelGetFuncInterp(getContext().nCtx(),
NativeObject(), f.NativeObject()); getNativeObject(), f.getNativeObject());
if (n == 0) if (n == 0)
return null; return null;
else else
return new FuncInterp(Context(), n); return new FuncInterp(getContext(), n);
} }
} }
/** /**
* The number of constants that have an interpretation in the model. * The number of constants that have an interpretation in the model.
**/ **/
public int NumConsts() throws Z3Exception public int getNumConsts() throws Z3Exception
{ {
return Native.modelGetNumConsts(Context().nCtx(), NativeObject()); return Native.modelGetNumConsts(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -115,22 +115,22 @@ public class Model extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[] ConstDecls() throws Z3Exception public FuncDecl[] getConstDecls() throws Z3Exception
{ {
int n = NumConsts(); int n = getNumConsts();
FuncDecl[] res = new FuncDecl[n]; FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new FuncDecl(Context(), Native.modelGetConstDecl(Context() res[i] = new FuncDecl(getContext(), Native.modelGetConstDecl(getContext()
.nCtx(), NativeObject(), i)); .nCtx(), getNativeObject(), i));
return res; return res;
} }
/** /**
* The number of function interpretations in the model. * The number of function interpretations in the model.
**/ **/
public int NumFuncs() throws Z3Exception public int getNumFuncs() throws Z3Exception
{ {
return Native.modelGetNumFuncs(Context().nCtx(), NativeObject()); return Native.modelGetNumFuncs(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -138,13 +138,13 @@ public class Model extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[] FuncDecls() throws Z3Exception public FuncDecl[] getFuncDecls() throws Z3Exception
{ {
int n = NumFuncs(); int n = getNumFuncs();
FuncDecl[] res = new FuncDecl[n]; FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new FuncDecl(Context(), Native.modelGetFuncDecl(Context() res[i] = new FuncDecl(getContext(), Native.modelGetFuncDecl(getContext()
.nCtx(), NativeObject(), i)); .nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -153,18 +153,18 @@ public class Model extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[] Decls() throws Z3Exception public FuncDecl[] getDecls() throws Z3Exception
{ {
int nFuncs = NumFuncs(); int nFuncs = getNumFuncs();
int nConsts = NumConsts(); int nConsts = getNumConsts();
int n = nFuncs + nConsts; int n = nFuncs + nConsts;
FuncDecl[] res = new FuncDecl[n]; FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < nConsts; i++) for (int i = 0; i < nConsts; i++)
res[i] = new FuncDecl(Context(), Native.modelGetConstDecl(Context() res[i] = new FuncDecl(getContext(), Native.modelGetConstDecl(getContext()
.nCtx(), NativeObject(), i)); .nCtx(), getNativeObject(), i));
for (int i = 0; i < nFuncs; i++) for (int i = 0; i < nFuncs; i++)
res[nConsts + i] = new FuncDecl(Context(), Native.modelGetFuncDecl( res[nConsts + i] = new FuncDecl(getContext(), Native.modelGetFuncDecl(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -197,14 +197,14 @@ public class Model extends Z3Object
* @return The evaluation of <paramref name="t"/> in the model. * @return The evaluation of <paramref name="t"/> in the model.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr Eval(Expr t, boolean completion) throws Z3Exception public Expr eval(Expr t, boolean completion) throws Z3Exception
{ {
Native.LongPtr v = new Native.LongPtr(); Native.LongPtr v = new Native.LongPtr();
if (Native.modelEval(Context().nCtx(), NativeObject(), if (Native.modelEval(getContext().nCtx(), getNativeObject(),
t.NativeObject(), (completion) ? true : false, v) ^ true) t.getNativeObject(), (completion) ? true : false, v) ^ true)
throw new ModelEvaluationFailedException(); throw new ModelEvaluationFailedException();
else else
return Expr.Create(Context(), v.value); return Expr.create(getContext(), v.value);
} }
/** /**
@ -212,18 +212,18 @@ public class Model extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr Evaluate(Expr t, boolean completion) throws Z3Exception public Expr evaluate(Expr t, boolean completion) throws Z3Exception
{ {
return Eval(t, completion); return eval(t, completion);
} }
/** /**
* The number of uninterpreted sorts that the model has an interpretation * The number of uninterpreted sorts that the model has an interpretation
* for. * for.
**/ **/
public int NumSorts() throws Z3Exception public int getNumSorts() throws Z3Exception
{ {
return Native.modelGetNumSorts(Context().nCtx(), NativeObject()); return Native.modelGetNumSorts(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -235,14 +235,14 @@ public class Model extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Sort[] Sorts() throws Z3Exception public Sort[] getSorts() throws Z3Exception
{ {
int n = NumSorts(); int n = getNumSorts();
Sort[] res = new Sort[n]; Sort[] res = new Sort[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Sort.Create(Context(), res[i] = Sort.create(getContext(),
Native.modelGetSort(Context().nCtx(), NativeObject(), i)); Native.modelGetSort(getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -255,15 +255,15 @@ public class Model extends Z3Object
* of <paramref name="s"/> * of <paramref name="s"/>
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr[] SortUniverse(Sort s) throws Z3Exception public Expr[] getSortUniverse(Sort s) throws Z3Exception
{ {
ASTVector nUniv = new ASTVector(Context(), Native.modelGetSortUniverse( ASTVector nUniv = new ASTVector(getContext(), Native.modelGetSortUniverse(
Context().nCtx(), NativeObject(), s.NativeObject())); getContext().nCtx(), getNativeObject(), s.getNativeObject()));
int n = nUniv.Size(); int n = nUniv.size();
Expr[] res = new Expr[n]; Expr[] res = new Expr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Expr.Create(Context(), nUniv.get(i).NativeObject()); res[i] = Expr.create(getContext(), nUniv.get(i).getNativeObject());
return res; return res;
} }
@ -276,7 +276,7 @@ public class Model extends Z3Object
{ {
try try
{ {
return Native.modelToString(Context().nCtx(), NativeObject()); return Native.modelToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -288,15 +288,15 @@ public class Model extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Model_DRQ().IncAndClear(Context(), o); getContext().model_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Model_DRQ().Add(o); getContext().model_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class ModelDecRefQueue extends IDecRefQueue class ModelDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class ModelDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_param_kind;
/** /**
* A ParamDescrs describes a set of parameters. * A ParamDescrs describes a set of parameters.
@ -16,21 +16,21 @@ public class ParamDescrs extends Z3Object
/** /**
* validate a set of parameters. * validate a set of parameters.
**/ **/
public void Validate(Params p) throws Z3Exception public void validate(Params p) throws Z3Exception
{ {
Native.paramsValidate(Context().nCtx(), p.NativeObject(), Native.paramsValidate(getContext().nCtx(), p.getNativeObject(),
NativeObject()); getNativeObject());
} }
/** /**
* Retrieve kind of parameter. * Retrieve kind of parameter.
**/ **/
public Z3_param_kind GetKind(Symbol name) throws Z3Exception public Z3_param_kind getKind(Symbol name) throws Z3Exception
{ {
return Z3_param_kind.fromInt(Native.paramDescrsGetKind( return Z3_param_kind.fromInt(Native.paramDescrsGetKind(
Context().nCtx(), NativeObject(), name.NativeObject())); getContext().nCtx(), getNativeObject(), name.getNativeObject()));
} }
/** /**
@ -38,14 +38,14 @@ public class ParamDescrs extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Symbol[] Names() throws Z3Exception public Symbol[] getNames() throws Z3Exception
{ {
int sz = Native.paramDescrsSize(Context().nCtx(), NativeObject()); int sz = Native.paramDescrsSize(getContext().nCtx(), getNativeObject());
Symbol[] names = new Symbol[sz]; Symbol[] names = new Symbol[sz];
for (int i = 0; i < sz; ++i) for (int i = 0; i < sz; ++i)
{ {
names[i] = Symbol.Create(Context(), Native.paramDescrsGetName( names[i] = Symbol.create(getContext(), Native.paramDescrsGetName(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
} }
return names; return names;
} }
@ -53,9 +53,9 @@ public class ParamDescrs extends Z3Object
/** /**
* The size of the ParamDescrs. * The size of the ParamDescrs.
**/ **/
public int Size() throws Z3Exception public int size() throws Z3Exception
{ {
return Native.paramDescrsSize(Context().nCtx(), NativeObject()); return Native.paramDescrsSize(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -65,7 +65,7 @@ public class ParamDescrs extends Z3Object
{ {
try try
{ {
return Native.paramDescrsToString(Context().nCtx(), NativeObject()); return Native.paramDescrsToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -77,15 +77,15 @@ public class ParamDescrs extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().ParamDescrs_DRQ().IncAndClear(Context(), o); getContext().paramDescrs_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().ParamDescrs_DRQ().Add(o); getContext().paramDescrs_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class ParamDescrsDecRefQueue extends IDecRefQueue class ParamDescrsDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class ParamDescrsDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -14,65 +14,65 @@ public class Params extends Z3Object
/** /**
* Adds a parameter setting. * Adds a parameter setting.
**/ **/
public void Add(Symbol name, boolean value) throws Z3Exception public void add(Symbol name, boolean value) throws Z3Exception
{ {
Native.paramsSetBool(Context().nCtx(), NativeObject(), Native.paramsSetBool(getContext().nCtx(), getNativeObject(),
name.NativeObject(), (value) ? true : false); name.getNativeObject(), (value) ? true : false);
} }
/** /**
* Adds a parameter setting. * Adds a parameter setting.
**/ **/
public void Add(Symbol name, double value) throws Z3Exception public void add(Symbol name, double value) throws Z3Exception
{ {
Native.paramsSetDouble(Context().nCtx(), NativeObject(), Native.paramsSetDouble(getContext().nCtx(), getNativeObject(),
name.NativeObject(), value); name.getNativeObject(), value);
} }
/** /**
* Adds a parameter setting. * Adds a parameter setting.
**/ **/
public void Add(Symbol name, Symbol value) throws Z3Exception public void add(Symbol name, Symbol value) throws Z3Exception
{ {
Native.paramsSetSymbol(Context().nCtx(), NativeObject(), Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(),
name.NativeObject(), value.NativeObject()); name.getNativeObject(), value.getNativeObject());
} }
/** /**
* Adds a parameter setting. * Adds a parameter setting.
**/ **/
public void Add(String name, boolean value) throws Z3Exception public void add(String name, boolean value) throws Z3Exception
{ {
Native.paramsSetBool(Context().nCtx(), NativeObject(), Native.paramsSetBool(getContext().nCtx(), getNativeObject(),
Context().MkSymbol(name).NativeObject(), value); getContext().mkSymbol(name).getNativeObject(), value);
} }
/** /**
* Adds a parameter setting. * Adds a parameter setting.
**/ **/
public void Add(String name, int value) throws Z3Exception public void add(String name, int value) throws Z3Exception
{ {
Native.paramsSetUint(Context().nCtx(), NativeObject(), Context() Native.paramsSetUint(getContext().nCtx(), getNativeObject(), getContext()
.MkSymbol(name).NativeObject(), value); .mkSymbol(name).getNativeObject(), value);
} }
/** /**
* Adds a parameter setting. * Adds a parameter setting.
**/ **/
public void Add(String name, double value) throws Z3Exception public void add(String name, double value) throws Z3Exception
{ {
Native.paramsSetDouble(Context().nCtx(), NativeObject(), Context() Native.paramsSetDouble(getContext().nCtx(), getNativeObject(), getContext()
.MkSymbol(name).NativeObject(), value); .mkSymbol(name).getNativeObject(), value);
} }
/** /**
* Adds a parameter setting. * Adds a parameter setting.
**/ **/
public void Add(String name, Symbol value) throws Z3Exception public void add(String name, Symbol value) throws Z3Exception
{ {
Native.paramsSetSymbol(Context().nCtx(), NativeObject(), Context() Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(), getContext()
.MkSymbol(name).NativeObject(), value.NativeObject()); .mkSymbol(name).getNativeObject(), value.getNativeObject());
} }
/** /**
@ -82,7 +82,7 @@ public class Params extends Z3Object
{ {
try try
{ {
return Native.paramsToString(Context().nCtx(), NativeObject()); return Native.paramsToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -94,15 +94,15 @@ public class Params extends Z3Object
super(ctx, Native.mkParams(ctx.nCtx())); super(ctx, Native.mkParams(ctx.nCtx()));
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Params_DRQ().IncAndClear(Context(), o); getContext().params_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Params_DRQ().Add(o); getContext().params_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class ParamsDecRefQueue extends IDecRefQueue class ParamsDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class ParamsDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -15,9 +15,9 @@ public class Pattern extends AST
/** /**
* The number of terms in the pattern. * The number of terms in the pattern.
**/ **/
public int NumTerms() throws Z3Exception public int getNumTerms() throws Z3Exception
{ {
return Native.getPatternNumTerms(Context().nCtx(), NativeObject()); return Native.getPatternNumTerms(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -25,14 +25,14 @@ public class Pattern extends AST
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr[] Terms() throws Z3Exception public Expr[] getTerms() throws Z3Exception
{ {
int n = NumTerms(); int n = getNumTerms();
Expr[] res = new Expr[n]; Expr[] res = new Expr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Expr.Create(Context(), res[i] = Expr.create(getContext(),
Native.getPattern(Context().nCtx(), NativeObject(), i)); Native.getPattern(getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -43,7 +43,7 @@ public class Pattern extends AST
{ {
try try
{ {
return Native.patternToString(Context().nCtx(), NativeObject()); return Native.patternToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();

View file

@ -23,20 +23,11 @@ public class Probe extends Z3Object
* 0.0 for false, and a value different from 0.0 for true. * 0.0 for false, and a value different from 0.0 for true.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public double Apply(Goal g) throws Z3Exception public double apply(Goal g) throws Z3Exception
{ {
Context().CheckContextMatch(g); getContext().checkContextMatch(g);
return Native.probeApply(Context().nCtx(), NativeObject(), return Native.probeApply(getContext().nCtx(), getNativeObject(),
g.NativeObject()); g.getNativeObject());
}
/**
* Apply the probe to a goal.
* @throws Z3Exception
**/
public double get(Goal g) throws Z3Exception
{
return Apply(g);
} }
Probe(Context ctx, long obj) throws Z3Exception Probe(Context ctx, long obj) throws Z3Exception
@ -49,15 +40,15 @@ public class Probe extends Z3Object
super(ctx, Native.mkProbe(ctx.nCtx(), name)); super(ctx, Native.mkProbe(ctx.nCtx(), name));
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Probe_DRQ().IncAndClear(Context(), o); getContext().probe_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Probe_DRQ().Add(o); getContext().probe_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class ProbeDecRefQueue extends IDecRefQueue class ProbeDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class ProbeDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_ast_kind;
/** /**
* Quantifier expressions. * Quantifier expressions.
@ -16,34 +16,34 @@ public class Quantifier extends BoolExpr
/** /**
* Indicates whether the quantifier is universal. * Indicates whether the quantifier is universal.
**/ **/
public boolean IsUniversal() throws Z3Exception public boolean isUniversal() throws Z3Exception
{ {
return Native.isQuantifierForall(Context().nCtx(), NativeObject()); return Native.isQuantifierForall(getContext().nCtx(), getNativeObject());
} }
/** /**
* Indicates whether the quantifier is existential. * Indicates whether the quantifier is existential.
**/ **/
public boolean IsExistential() throws Z3Exception public boolean isExistential() throws Z3Exception
{ {
return !IsUniversal(); return !isUniversal();
} }
/** /**
* The weight of the quantifier. * The weight of the quantifier.
**/ **/
public int Weight() throws Z3Exception public int getWeight() throws Z3Exception
{ {
return Native.getQuantifierWeight(Context().nCtx(), NativeObject()); return Native.getQuantifierWeight(getContext().nCtx(), getNativeObject());
} }
/** /**
* The number of patterns. * The number of patterns.
**/ **/
public int NumPatterns() throws Z3Exception public int getNumPatterns() throws Z3Exception
{ {
return Native return Native
.getQuantifierNumPatterns(Context().nCtx(), NativeObject()); .getQuantifierNumPatterns(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -51,23 +51,23 @@ public class Quantifier extends BoolExpr
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Pattern[] Patterns() throws Z3Exception public Pattern[] getPatterns() throws Z3Exception
{ {
int n = NumPatterns(); int n = getNumPatterns();
Pattern[] res = new Pattern[n]; Pattern[] res = new Pattern[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new Pattern(Context(), Native.getQuantifierPatternAst( res[i] = new Pattern(getContext(), Native.getQuantifierPatternAst(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
/** /**
* The number of no-patterns. * The number of no-patterns.
**/ **/
public int NumNoPatterns() throws Z3Exception public int getNumNoPatterns() throws Z3Exception
{ {
return Native.getQuantifierNumNoPatterns(Context().nCtx(), return Native.getQuantifierNumNoPatterns(getContext().nCtx(),
NativeObject()); getNativeObject());
} }
/** /**
@ -75,22 +75,22 @@ public class Quantifier extends BoolExpr
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Pattern[] NoPatterns() throws Z3Exception public Pattern[] getNoPatterns() throws Z3Exception
{ {
int n = NumNoPatterns(); int n = getNumNoPatterns();
Pattern[] res = new Pattern[n]; Pattern[] res = new Pattern[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new Pattern(Context(), Native.getQuantifierNoPatternAst( res[i] = new Pattern(getContext(), Native.getQuantifierNoPatternAst(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
/** /**
* The number of bound variables. * The number of bound variables.
**/ **/
public int NumBound() throws Z3Exception public int getNumBound() throws Z3Exception
{ {
return Native.getQuantifierNumBound(Context().nCtx(), NativeObject()); return Native.getQuantifierNumBound(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -98,13 +98,13 @@ public class Quantifier extends BoolExpr
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Symbol[] BoundVariableNames() throws Z3Exception public Symbol[] getBoundVariableNames() throws Z3Exception
{ {
int n = NumBound(); int n = getNumBound();
Symbol[] res = new Symbol[n]; Symbol[] res = new Symbol[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Symbol.Create(Context(), Native.getQuantifierBoundName( res[i] = Symbol.create(getContext(), Native.getQuantifierBoundName(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -113,13 +113,13 @@ public class Quantifier extends BoolExpr
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Sort[] BoundVariableSorts() throws Z3Exception public Sort[] getBoundVariableSorts() throws Z3Exception
{ {
int n = NumBound(); int n = getNumBound();
Sort[] res = new Sort[n]; Sort[] res = new Sort[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Sort.Create(Context(), Native.getQuantifierBoundSort( res[i] = Sort.create(getContext(), Native.getQuantifierBoundSort(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -128,10 +128,10 @@ public class Quantifier extends BoolExpr
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public BoolExpr Body() throws Z3Exception public BoolExpr getBody() throws Z3Exception
{ {
return new BoolExpr(Context(), Native.getQuantifierBody(Context() return new BoolExpr(getContext(), Native.getQuantifierBody(getContext()
.nCtx(), NativeObject())); .nCtx(), getNativeObject()));
} }
Quantifier(Context ctx, boolean isForall, Sort[] sorts, Symbol[] names, Quantifier(Context ctx, boolean isForall, Sort[] sorts, Symbol[] names,
@ -140,11 +140,11 @@ public class Quantifier extends BoolExpr
{ {
super(ctx); super(ctx);
Context().CheckContextMatch(patterns); getContext().checkContextMatch(patterns);
Context().CheckContextMatch(noPatterns); getContext().checkContextMatch(noPatterns);
Context().CheckContextMatch(sorts); getContext().checkContextMatch(sorts);
Context().CheckContextMatch(names); getContext().checkContextMatch(names);
Context().CheckContextMatch(body); getContext().checkContextMatch(body);
if (sorts.length != names.length) if (sorts.length != names.length)
throw new Z3Exception( throw new Z3Exception(
@ -153,20 +153,20 @@ public class Quantifier extends BoolExpr
if (noPatterns == null && quantifierID == null && skolemID == null) if (noPatterns == null && quantifierID == null && skolemID == null)
{ {
setNativeObject(Native.mkQuantifier(ctx.nCtx(), (isForall) ? true setNativeObject(Native.mkQuantifier(ctx.nCtx(), (isForall) ? true
: false, weight, AST.ArrayLength(patterns), AST : false, weight, AST.arrayLength(patterns), AST
.ArrayToNative(patterns), AST.ArrayLength(sorts), AST .arrayToNative(patterns), AST.arrayLength(sorts), AST
.ArrayToNative(sorts), Symbol.ArrayToNative(names), body .arrayToNative(sorts), Symbol.arrayToNative(names), body
.NativeObject())); .getNativeObject()));
} else } else
{ {
setNativeObject(Native.mkQuantifierEx(ctx.nCtx(), setNativeObject(Native.mkQuantifierEx(ctx.nCtx(),
(isForall) ? true : false, weight, AST.GetNativeObject(quantifierID), (isForall) ? true : false, weight, AST.getNativeObject(quantifierID),
AST.GetNativeObject(skolemID), AST.getNativeObject(skolemID),
AST.ArrayLength(patterns), AST.ArrayToNative(patterns), AST.arrayLength(patterns), AST.arrayToNative(patterns),
AST.ArrayLength(noPatterns), AST.ArrayToNative(noPatterns), AST.arrayLength(noPatterns), AST.arrayToNative(noPatterns),
AST.ArrayLength(sorts), AST.ArrayToNative(sorts), AST.arrayLength(sorts), AST.arrayToNative(sorts),
Symbol.ArrayToNative(names), Symbol.arrayToNative(names),
body.NativeObject())); body.getNativeObject()));
} }
} }
@ -176,26 +176,26 @@ public class Quantifier extends BoolExpr
{ {
super(ctx); super(ctx);
Context().CheckContextMatch(noPatterns); getContext().checkContextMatch(noPatterns);
Context().CheckContextMatch(patterns); getContext().checkContextMatch(patterns);
// Context().CheckContextMatch(bound); // Context().CheckContextMatch(bound);
Context().CheckContextMatch(body); getContext().checkContextMatch(body);
if (noPatterns == null && quantifierID == null && skolemID == null) if (noPatterns == null && quantifierID == null && skolemID == null)
{ {
setNativeObject(Native.mkQuantifierConst(ctx.nCtx(), setNativeObject(Native.mkQuantifierConst(ctx.nCtx(),
(isForall) ? true : false, weight, AST.ArrayLength(bound), (isForall) ? true : false, weight, AST.arrayLength(bound),
AST.ArrayToNative(bound), AST.ArrayLength(patterns), AST.arrayToNative(bound), AST.arrayLength(patterns),
AST.ArrayToNative(patterns), body.NativeObject())); AST.arrayToNative(patterns), body.getNativeObject()));
} else } else
{ {
setNativeObject(Native.mkQuantifierConstEx(ctx.nCtx(), setNativeObject(Native.mkQuantifierConstEx(ctx.nCtx(),
(isForall) ? true : false, weight, (isForall) ? true : false, weight,
AST.GetNativeObject(quantifierID), AST.getNativeObject(quantifierID),
AST.GetNativeObject(skolemID), AST.ArrayLength(bound), AST.getNativeObject(skolemID), AST.arrayLength(bound),
AST.ArrayToNative(bound), AST.ArrayLength(patterns), AST.arrayToNative(bound), AST.arrayLength(patterns),
AST.ArrayToNative(patterns), AST.ArrayLength(noPatterns), AST.arrayToNative(patterns), AST.arrayLength(noPatterns),
AST.ArrayToNative(noPatterns), body.NativeObject())); AST.arrayToNative(noPatterns), body.getNativeObject()));
} }
} }
@ -204,11 +204,11 @@ public class Quantifier extends BoolExpr
super(ctx, obj); super(ctx, obj);
} }
void CheckNativeObject(long obj) throws Z3Exception void checkNativeObject(long obj) throws Z3Exception
{ {
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST
.toInt()) .toInt())
throw new Z3Exception("Underlying object is not a quantifier"); throw new Z3Exception("Underlying object is not a quantifier");
super.CheckNativeObject(obj); super.checkNativeObject(obj);
} }
} }

View file

@ -16,36 +16,36 @@ public class RatNum extends RealExpr
/** /**
* The numerator of a rational numeral. * The numerator of a rational numeral.
**/ **/
public IntNum Numerator() throws Z3Exception public IntNum getNumerator() throws Z3Exception
{ {
return new IntNum(Context(), Native.getNumerator(Context().nCtx(), return new IntNum(getContext(), Native.getNumerator(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
* The denominator of a rational numeral. * The denominator of a rational numeral.
**/ **/
public IntNum Denominator() throws Z3Exception public IntNum getDenominator() throws Z3Exception
{ {
return new IntNum(Context(), Native.getDenominator(Context().nCtx(), return new IntNum(getContext(), Native.getDenominator(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
* Converts the numerator of the rational to a BigInteger * Converts the numerator of the rational to a BigInteger
**/ **/
public BigInteger BigIntNumerator() throws Z3Exception public BigInteger getBigIntNumerator() throws Z3Exception
{ {
IntNum n = Numerator(); IntNum n = getNumerator();
return new BigInteger(n.toString()); return new BigInteger(n.toString());
} }
/** /**
* Converts the denominator of the rational to a BigInteger * Converts the denominator of the rational to a BigInteger
**/ **/
public BigInteger BigIntDenominator() throws Z3Exception public BigInteger getBigIntDenominator() throws Z3Exception
{ {
IntNum n = Denominator(); IntNum n = getDenominator();
return new BigInteger(n.toString()); return new BigInteger(n.toString());
} }
@ -53,9 +53,9 @@ public class RatNum extends RealExpr
* Returns a string representation in decimal notation. <remarks>The result * Returns a string representation in decimal notation. <remarks>The result
* has at most <paramref name="precision"/> decimal places.</remarks> * has at most <paramref name="precision"/> decimal places.</remarks>
**/ **/
public String ToDecimalString(int precision) throws Z3Exception public String toDecimalString(int precision) throws Z3Exception
{ {
return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(), return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
precision); precision);
} }
@ -66,7 +66,7 @@ public class RatNum extends RealExpr
{ {
try try
{ {
return Native.getNumeralString(Context().nCtx(), NativeObject()); return Native.getNumeralString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();

View file

@ -14,26 +14,26 @@ public class RelationSort extends Sort
/** /**
* The arity of the relation sort. * The arity of the relation sort.
**/ **/
public int Arity() throws Z3Exception public int getArity() throws Z3Exception
{ {
return Native.getRelationArity(Context().nCtx(), NativeObject()); return Native.getRelationArity(getContext().nCtx(), getNativeObject());
} }
/** /**
* The sorts of the columns of the relation sort. * The sorts of the columns of the relation sort.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Sort[] ColumnSorts() throws Z3Exception public Sort[] getColumnSorts() throws Z3Exception
{ {
if (m_columnSorts != null) if (m_columnSorts != null)
return m_columnSorts; return m_columnSorts;
int n = Arity(); int n = getArity();
Sort[] res = new Sort[n]; Sort[] res = new Sort[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Sort.Create(Context(), Native.getRelationColumn(Context() res[i] = Sort.create(getContext(), Native.getRelationColumn(getContext()
.nCtx(), NativeObject(), i)); .nCtx(), getNativeObject(), i));
return res; return res;
} }

View file

@ -18,6 +18,6 @@ public class SetSort extends Sort
SetSort(Context ctx, Sort ty) throws Z3Exception SetSort(Context ctx, Sort ty) throws Z3Exception
{ {
super(ctx, Native.mkSetSort(ctx.nCtx(), ty.NativeObject())); super(ctx, Native.mkSetSort(ctx.nCtx(), ty.getNativeObject()));
} }
} }

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_lbool;
/** /**
* Solvers. * Solvers.
@ -16,9 +16,9 @@ public class Solver extends Z3Object
/** /**
* A string that describes all available solver parameters. * A string that describes all available solver parameters.
**/ **/
public String Help() throws Z3Exception public String getHelp() throws Z3Exception
{ {
return Native.solverGetHelp(Context().nCtx(), NativeObject()); return Native.solverGetHelp(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -28,9 +28,9 @@ public class Solver extends Z3Object
**/ **/
public void setParameters(Params value) throws Z3Exception public void setParameters(Params value) throws Z3Exception
{ {
Context().CheckContextMatch(value); getContext().checkContextMatch(value);
Native.solverSetParams(Context().nCtx(), NativeObject(), Native.solverSetParams(getContext().nCtx(), getNativeObject(),
value.NativeObject()); value.getNativeObject());
} }
/** /**
@ -38,35 +38,36 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public ParamDescrs ParameterDescriptions() throws Z3Exception public ParamDescrs getParameterDescriptions() throws Z3Exception
{ {
return new ParamDescrs(Context(), Native.solverGetParamDescrs(Context() return new ParamDescrs(getContext(), Native.solverGetParamDescrs(
.nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
} }
/** /**
* The current number of backtracking points (scopes). <seealso cref="Pop"/> * The current number of backtracking points (scopes). <seealso cref="Pop"/>
* <seealso cref="Push"/> * <seealso cref="Push"/>
**/ **/
public int NumScopes() throws Z3Exception public int getNumScopes() throws Z3Exception
{ {
return Native.solverGetNumScopes(Context().nCtx(), NativeObject()); return Native
.solverGetNumScopes(getContext().nCtx(), getNativeObject());
} }
/** /**
* Creates a backtracking point. <seealso cref="Pop"/> * Creates a backtracking point. <seealso cref="Pop"/>
**/ **/
public void Push() throws Z3Exception public void push() throws Z3Exception
{ {
Native.solverPush(Context().nCtx(), NativeObject()); Native.solverPush(getContext().nCtx(), getNativeObject());
} }
/** /**
* Backtracks one backtracking point. <remarks>. * Backtracks one backtracking point. <remarks>.
**/ **/
public void Pop() throws Z3Exception public void pop() throws Z3Exception
{ {
Pop(1); pop(1);
} }
/** /**
@ -74,18 +75,18 @@ public class Solver extends Z3Object
* an exception is thrown if <paramref name="n"/> is not smaller than * an exception is thrown if <paramref name="n"/> is not smaller than
* <code>NumScopes</code></remarks> <seealso cref="Push"/> * <code>NumScopes</code></remarks> <seealso cref="Push"/>
**/ **/
public void Pop(int n) throws Z3Exception public void pop(int n) throws Z3Exception
{ {
Native.solverPop(Context().nCtx(), NativeObject(), n); Native.solverPop(getContext().nCtx(), getNativeObject(), n);
} }
/** /**
* Resets the Solver. <remarks>This removes all assertions from the * Resets the Solver. <remarks>This removes all assertions from the
* solver.</remarks> * solver.</remarks>
**/ **/
public void Reset() throws Z3Exception public void reset() throws Z3Exception
{ {
Native.solverReset(Context().nCtx(), NativeObject()); Native.solverReset(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -93,26 +94,62 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public void Assert(BoolExpr[] constraints) throws Z3Exception public void assert_(BoolExpr... constraints) throws Z3Exception
{ {
Context().CheckContextMatch(constraints); getContext().checkContextMatch(constraints);
for (BoolExpr a : constraints) for (BoolExpr a : constraints)
{ {
Native.solverAssert(Context().nCtx(), NativeObject(), Native.solverAssert(getContext().nCtx(), getNativeObject(),
a.NativeObject()); a.getNativeObject());
} }
} }
/** // / <summary>
* Assert one constraint into the solver. // / Assert multiple constraints into the solver, and track them (in the
* // unsat) core
* @throws Z3Exception // / using the Boolean constants in ps.
**/ // / </summary>
public void Assert(BoolExpr constraint) throws Z3Exception // / <remarks>
// / This API is an alternative to <see cref="Check"/> with assumptions for
// extracting unsat cores.
// / Both APIs can be used in the same solver. The unsat core will contain a
// combination
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
// and the Boolean literals
// / provided using <see cref="Check"/> with assumptions.
// / </remarks>
public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) throws Z3Exception
{ {
Context().CheckContextMatch(constraint); getContext().checkContextMatch(constraints);
Native.solverAssert(Context().nCtx(), NativeObject(), getContext().checkContextMatch(ps);
constraint.NativeObject()); if (constraints.length != ps.length)
throw new Z3Exception("Argument size mismatch");
for (int i = 0; i < constraints.length; i++)
Native.solverAssertAndTrack(getContext().nCtx(), getNativeObject(),
constraints[i].getNativeObject(), ps[i].getNativeObject());
}
// / <summary>
// / Assert a constraint into the solver, and track it (in the unsat) core
// / using the Boolean constant p.
// / </summary>
// / <remarks>
// / This API is an alternative to <see cref="Check"/> with assumptions for
// extracting unsat cores.
// / Both APIs can be used in the same solver. The unsat core will contain a
// combination
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
// and the Boolean literals
// / provided using <see cref="Check"/> with assumptions.
// / </remarks>
public void assertAndTrack(BoolExpr constraint, BoolExpr p) throws Z3Exception
{
getContext().checkContextMatch(constraint);
getContext().checkContextMatch(p);
Native.solverAssertAndTrack(getContext().nCtx(), getNativeObject(),
constraint.getNativeObject(), p.getNativeObject());
} }
/** /**
@ -120,11 +157,11 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public int NumAssertions() throws Z3Exception public int getNumAssertions() throws Z3Exception
{ {
ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions( ASTVector ass = new ASTVector(getContext(), Native.solverGetAssertions(
Context().nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
return ass.Size(); return ass.size();
} }
/** /**
@ -132,14 +169,14 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public BoolExpr[] Assertions() throws Z3Exception public BoolExpr[] getAssertions() throws Z3Exception
{ {
ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions( ASTVector ass = new ASTVector(getContext(), Native.solverGetAssertions(
Context().nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
int n = ass.Size(); int n = ass.size();
BoolExpr[] res = new BoolExpr[n]; BoolExpr[] res = new BoolExpr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new BoolExpr(Context(), ass.get(i).NativeObject()); res[i] = new BoolExpr(getContext(), ass.get(i).getNativeObject());
return res; return res;
} }
@ -148,16 +185,16 @@ public class Solver extends Z3Object
* <remarks> <seealso cref="Model"/> <seealso cref="UnsatCore"/> <seealso * <remarks> <seealso cref="Model"/> <seealso cref="UnsatCore"/> <seealso
* cref="Proof"/> </remarks> * cref="Proof"/> </remarks>
**/ **/
public Status Check(Expr[] assumptions) throws Z3Exception public Status check(Expr... assumptions) throws Z3Exception
{ {
Z3_lbool r; Z3_lbool r;
if (assumptions == null) if (assumptions == null)
r = Z3_lbool.fromInt(Native.solverCheck(Context().nCtx(), r = Z3_lbool.fromInt(Native.solverCheck(getContext().nCtx(),
NativeObject())); getNativeObject()));
else else
r = Z3_lbool.fromInt(Native.solverCheckAssumptions( r = Z3_lbool.fromInt(Native.solverCheckAssumptions(getContext()
Context().nCtx(), NativeObject(), (int) assumptions.length, .nCtx(), getNativeObject(), (int) assumptions.length, AST
AST.ArrayToNative(assumptions))); .arrayToNative(assumptions)));
switch (r) switch (r)
{ {
case Z3_L_TRUE: case Z3_L_TRUE:
@ -174,9 +211,9 @@ public class Solver extends Z3Object
* <remarks> <seealso cref="Model"/> <seealso cref="UnsatCore"/> <seealso * <remarks> <seealso cref="Model"/> <seealso cref="UnsatCore"/> <seealso
* cref="Proof"/> </remarks> * cref="Proof"/> </remarks>
**/ **/
public Status Check() throws Z3Exception public Status check() throws Z3Exception
{ {
return Check(null); return check((Expr[]) null);
} }
/** /**
@ -187,13 +224,13 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Model Model() throws Z3Exception public Model getModel() throws Z3Exception
{ {
long x = Native.solverGetModel(Context().nCtx(), NativeObject()); long x = Native.solverGetModel(getContext().nCtx(), getNativeObject());
if (x == 0) if (x == 0)
return null; return null;
else else
return new Model(Context(), x); return new Model(getContext(), x);
} }
/** /**
@ -204,13 +241,13 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr Proof() throws Z3Exception public Expr getProof() throws Z3Exception
{ {
long x = Native.solverGetProof(Context().nCtx(), NativeObject()); long x = Native.solverGetProof(getContext().nCtx(), getNativeObject());
if (x == 0) if (x == 0)
return null; return null;
else else
return Expr.Create(Context(), x); return Expr.create(getContext(), x);
} }
/** /**
@ -221,15 +258,15 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Expr[] UnsatCore() throws Z3Exception public Expr[] getUnsatCore() throws Z3Exception
{ {
ASTVector core = new ASTVector(Context(), Native.solverGetUnsatCore( ASTVector core = new ASTVector(getContext(), Native.solverGetUnsatCore(
Context().nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
int n = core.Size(); int n = core.size();
Expr[] res = new Expr[n]; Expr[] res = new Expr[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Expr.Create(Context(), core.get(i).NativeObject()); res[i] = Expr.create(getContext(), core.get(i).getNativeObject());
return res; return res;
} }
@ -237,9 +274,10 @@ public class Solver extends Z3Object
* A brief justification of why the last call to <code>Check</code> returned * A brief justification of why the last call to <code>Check</code> returned
* <code>UNKNOWN</code>. * <code>UNKNOWN</code>.
**/ **/
public String ReasonUnknown() throws Z3Exception public String getReasonUnknown() throws Z3Exception
{ {
return Native.solverGetReasonUnknown(Context().nCtx(), NativeObject()); return Native.solverGetReasonUnknown(getContext().nCtx(),
getNativeObject());
} }
/** /**
@ -247,10 +285,10 @@ public class Solver extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Statistics Statistics() throws Z3Exception public Statistics getStatistics() throws Z3Exception
{ {
return new Statistics(Context(), Native.solverGetStatistics(Context() return new Statistics(getContext(), Native.solverGetStatistics(
.nCtx(), NativeObject())); getContext().nCtx(), getNativeObject()));
} }
/** /**
@ -260,7 +298,8 @@ public class Solver extends Z3Object
{ {
try try
{ {
return Native.solverToString(Context().nCtx(), NativeObject()); return Native
.solverToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -272,15 +311,15 @@ public class Solver extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Solver_DRQ().IncAndClear(Context(), o); getContext().solver_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Solver_DRQ().Add(o); getContext().solver_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class SolverDecRefQueue extends IDecRefQueue class SolverDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class SolverDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -6,7 +6,8 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_ast_kind;
import com.microsoft.z3.enumerations.Z3_sort_kind;
/** /**
* The Sort class implements type information for ASTs. * The Sort class implements type information for ASTs.
@ -47,7 +48,7 @@ public class Sort extends AST
return false; return false;
} }
return this.NativeObject() == casted.NativeObject(); return this.getNativeObject() == casted.getNativeObject();
} }
/** /**
@ -55,35 +56,35 @@ public class Sort extends AST
* *
* @return A hash code * @return A hash code
**/ **/
public int GetHashCode() throws Z3Exception public int hashCode()
{ {
return super.GetHashCode(); return super.hashCode();
} }
/** /**
* Returns a unique identifier for the sort. * Returns a unique identifier for the sort.
**/ **/
public int Id() throws Z3Exception public int getId() throws Z3Exception
{ {
return Native.getSortId(Context().nCtx(), NativeObject()); return Native.getSortId(getContext().nCtx(), getNativeObject());
} }
/** /**
* The kind of the sort. * The kind of the sort.
**/ **/
public Z3_sort_kind SortKind() throws Z3Exception public Z3_sort_kind getSortKind() throws Z3Exception
{ {
return Z3_sort_kind.fromInt(Native.getSortKind(Context().nCtx(), return Z3_sort_kind.fromInt(Native.getSortKind(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
* The name of the sort * The name of the sort
**/ **/
public Symbol Name() throws Z3Exception public Symbol getName() throws Z3Exception
{ {
return Symbol.Create(Context(), return Symbol.create(getContext(),
Native.getSortName(Context().nCtx(), NativeObject())); Native.getSortName(getContext().nCtx(), getNativeObject()));
} }
/** /**
@ -93,7 +94,7 @@ public class Sort extends AST
{ {
try try
{ {
return Native.sortToString(Context().nCtx(), NativeObject()); return Native.sortToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -117,15 +118,15 @@ public class Sort extends AST
} }
} }
void CheckNativeObject(long obj) throws Z3Exception void checkNativeObject(long obj) throws Z3Exception
{ {
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_SORT_AST if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_SORT_AST
.toInt()) .toInt())
throw new Z3Exception("Underlying object is not a sort"); throw new Z3Exception("Underlying object is not a sort");
super.CheckNativeObject(obj); super.checkNativeObject(obj);
} }
static Sort Create(Context ctx, long obj) throws Z3Exception static Sort create(Context ctx, long obj) throws Z3Exception
{ {
switch (Z3_sort_kind.fromInt(Native.getSortKind(ctx.nCtx(), obj))) switch (Z3_sort_kind.fromInt(Native.getSortKind(ctx.nCtx(), obj)))
{ {

View file

@ -25,7 +25,7 @@ public class Statistics extends Z3Object
/** /**
* The uint-value of the entry. * The uint-value of the entry.
**/ **/
public int UIntValue() public int getUIntValue()
{ {
return m_int; return m_int;
} }
@ -33,7 +33,7 @@ public class Statistics extends Z3Object
/** /**
* The double-value of the entry. * The double-value of the entry.
**/ **/
public double DoubleValue() public double getDoubleValue()
{ {
return m_double; return m_double;
} }
@ -41,7 +41,7 @@ public class Statistics extends Z3Object
/** /**
* True if the entry is uint-valued. * True if the entry is uint-valued.
**/ **/
public boolean IsUInt() public boolean isUInt()
{ {
return m_is_int; return m_is_int;
} }
@ -49,7 +49,7 @@ public class Statistics extends Z3Object
/** /**
* True if the entry is double-valued. * True if the entry is double-valued.
**/ **/
public boolean IsDouble() public boolean isDouble()
{ {
return m_is_double; return m_is_double;
} }
@ -59,11 +59,11 @@ public class Statistics extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public String Value() throws Z3Exception public String getValueString() throws Z3Exception
{ {
if (IsUInt()) if (isUInt())
return Integer.toString(m_int); return Integer.toString(m_int);
else if (IsDouble()) else if (isDouble())
return Double.toString(m_double); return Double.toString(m_double);
else else
throw new Z3Exception("Unknown statistical entry type"); throw new Z3Exception("Unknown statistical entry type");
@ -76,7 +76,7 @@ public class Statistics extends Z3Object
{ {
try try
{ {
return Key + ": " + Value(); return Key + ": " + getValueString();
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return new String("Z3Exception: " + e.getMessage()); return new String("Z3Exception: " + e.getMessage());
@ -110,7 +110,7 @@ public class Statistics extends Z3Object
{ {
try try
{ {
return Native.statsToString(Context().nCtx(), NativeObject()); return Native.statsToString(getContext().nCtx(), getNativeObject());
} catch (Z3Exception e) } catch (Z3Exception e)
{ {
return "Z3Exception: " + e.getMessage(); return "Z3Exception: " + e.getMessage();
@ -120,9 +120,9 @@ public class Statistics extends Z3Object
/** /**
* The number of statistical data. * The number of statistical data.
**/ **/
public int Size() throws Z3Exception public int size() throws Z3Exception
{ {
return Native.statsSize(Context().nCtx(), NativeObject()); return Native.statsSize(getContext().nCtx(), getNativeObject());
} }
/** /**
@ -130,21 +130,21 @@ public class Statistics extends Z3Object
* *
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Entry[] Entries() throws Z3Exception public Entry[] getEntries() throws Z3Exception
{ {
int n = Size(); int n = size();
Entry[] res = new Entry[n]; Entry[] res = new Entry[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
Entry e; Entry e;
String k = Native.statsGetKey(Context().nCtx(), NativeObject(), i); String k = Native.statsGetKey(getContext().nCtx(), getNativeObject(), i);
if (Native.statsIsUint(Context().nCtx(), NativeObject(), i)) if (Native.statsIsUint(getContext().nCtx(), getNativeObject(), i))
e = new Entry(k, Native.statsGetUintValue(Context().nCtx(), e = new Entry(k, Native.statsGetUintValue(getContext().nCtx(),
NativeObject(), i)); getNativeObject(), i));
else if (Native.statsIsDouble(Context().nCtx(), NativeObject(), i)) else if (Native.statsIsDouble(getContext().nCtx(), getNativeObject(), i))
e = new Entry(k, Native.statsGetDoubleValue(Context().nCtx(), e = new Entry(k, Native.statsGetDoubleValue(getContext().nCtx(),
NativeObject(), i)); getNativeObject(), i));
else else
throw new Z3Exception("Unknown data entry value"); throw new Z3Exception("Unknown data entry value");
res[i] = e; res[i] = e;
@ -155,12 +155,12 @@ public class Statistics extends Z3Object
/** /**
* The statistical counters. * The statistical counters.
**/ **/
public String[] Keys() throws Z3Exception public String[] getKeys() throws Z3Exception
{ {
int n = Size(); int n = size();
String[] res = new String[n]; String[] res = new String[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = Native.statsGetKey(Context().nCtx(), NativeObject(), i); res[i] = Native.statsGetKey(getContext().nCtx(), getNativeObject(), i);
return res; return res;
} }
@ -172,8 +172,8 @@ public class Statistics extends Z3Object
**/ **/
public Entry get(String key) throws Z3Exception public Entry get(String key) throws Z3Exception
{ {
int n = Size(); int n = size();
Entry[] es = Entries(); Entry[] es = getEntries();
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
if (es[i].Key == key) if (es[i].Key == key)
return es[i]; return es[i];
@ -185,15 +185,15 @@ public class Statistics extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Statistics_DRQ().IncAndClear(Context(), o); getContext().statistics_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Statistics_DRQ().Add(o); getContext().statistics_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class StatisticsDecRefQueue extends IDecRefQueue class StatisticsDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class StatisticsDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_symbol_kind;
/** /**
* Named symbols * Named symbols
@ -17,9 +17,9 @@ public class StringSymbol extends Symbol
* The string value of the symbol. <remarks>Throws an exception if the * The string value of the symbol. <remarks>Throws an exception if the
* symbol is not of string kind.</remarks> * symbol is not of string kind.</remarks>
**/ **/
public String String() throws Z3Exception public String getString() throws Z3Exception
{ {
return Native.getSymbolString(Context().nCtx(), NativeObject()); return Native.getSymbolString(getContext().nCtx(), getNativeObject());
} }
StringSymbol(Context ctx, long obj) throws Z3Exception StringSymbol(Context ctx, long obj) throws Z3Exception
@ -32,12 +32,12 @@ public class StringSymbol extends Symbol
super(ctx, Native.mkStringSymbol(ctx.nCtx(), s)); super(ctx, Native.mkStringSymbol(ctx.nCtx(), s));
} }
void CheckNativeObject(long obj) throws Z3Exception void checkNativeObject(long obj) throws Z3Exception
{ {
if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_STRING_SYMBOL if (Native.getSymbolKind(getContext().nCtx(), obj) != Z3_symbol_kind.Z3_STRING_SYMBOL
.toInt()) .toInt())
throw new Z3Exception("Symbol is not of String kind"); throw new Z3Exception("Symbol is not of String kind");
super.CheckNativeObject(obj); super.checkNativeObject(obj);
} }
} }

View file

@ -6,7 +6,7 @@
package com.microsoft.z3; package com.microsoft.z3;
import com.microsoft.z3.enumerations.*; import com.microsoft.z3.enumerations.Z3_symbol_kind;
/** /**
* Symbols are used to name several term and type constructors. * Symbols are used to name several term and type constructors.
@ -16,26 +16,26 @@ public class Symbol extends Z3Object
/** /**
* The kind of the symbol (int or string) * The kind of the symbol (int or string)
**/ **/
protected Z3_symbol_kind Kind() throws Z3Exception protected Z3_symbol_kind getKind() throws Z3Exception
{ {
return Z3_symbol_kind.fromInt(Native.getSymbolKind(Context().nCtx(), return Z3_symbol_kind.fromInt(Native.getSymbolKind(getContext().nCtx(),
NativeObject())); getNativeObject()));
} }
/** /**
* Indicates whether the symbol is of Int kind * Indicates whether the symbol is of Int kind
**/ **/
public boolean IsIntSymbol() throws Z3Exception public boolean isIntSymbol() throws Z3Exception
{ {
return Kind() == Z3_symbol_kind.Z3_INT_SYMBOL; return getKind() == Z3_symbol_kind.Z3_INT_SYMBOL;
} }
/** /**
* Indicates whether the symbol is of string kind. * Indicates whether the symbol is of string kind.
**/ **/
public boolean IsStringSymbol() throws Z3Exception public boolean isStringSymbol() throws Z3Exception
{ {
return Kind() == Z3_symbol_kind.Z3_STRING_SYMBOL; return getKind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
} }
/** /**
@ -45,10 +45,10 @@ public class Symbol extends Z3Object
{ {
try try
{ {
if (IsIntSymbol()) if (isIntSymbol())
return Integer.toString(((IntSymbol) this).Int()); return Integer.toString(((IntSymbol) this).getInt());
else if (IsStringSymbol()) else if (isStringSymbol())
return ((StringSymbol) this).String(); return ((StringSymbol) this).getString();
else else
return new String( return new String(
"Z3Exception: Unknown symbol kind encountered."); "Z3Exception: Unknown symbol kind encountered.");
@ -66,7 +66,7 @@ public class Symbol extends Z3Object
super(ctx, obj); super(ctx, obj);
} }
static Symbol Create(Context ctx, long obj) throws Z3Exception static Symbol create(Context ctx, long obj) throws Z3Exception
{ {
switch (Z3_symbol_kind.fromInt(Native.getSymbolKind(ctx.nCtx(), obj))) switch (Z3_symbol_kind.fromInt(Native.getSymbolKind(ctx.nCtx(), obj)))
{ {

View file

@ -18,69 +18,57 @@ public class Tactic extends Z3Object
/** /**
* A string containing a description of parameters accepted by the tactic. * A string containing a description of parameters accepted by the tactic.
**/ **/
public String Help() throws Z3Exception public String getHelp() throws Z3Exception
{ {
return Native.tacticGetHelp(Context().nCtx(), NativeObject()); return Native.tacticGetHelp(getContext().nCtx(), getNativeObject());
} }
/** /**
* Retrieves parameter descriptions for Tactics. * Retrieves parameter descriptions for Tactics.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public ParamDescrs ParameterDescriptions() throws Z3Exception public ParamDescrs getParameterDescriptions() throws Z3Exception
{ {
return new ParamDescrs(Context(), Native.tacticGetParamDescrs(Context() return new ParamDescrs(getContext(), Native.tacticGetParamDescrs(getContext()
.nCtx(), NativeObject())); .nCtx(), getNativeObject()));
} }
/** /**
* Execute the tactic over the goal. * Execute the tactic over the goal.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public ApplyResult Apply(Goal g) throws Z3Exception public ApplyResult apply(Goal g) throws Z3Exception
{ {
return Apply(g, null); return apply(g, null);
} }
/** /**
* Execute the tactic over the goal. * Execute the tactic over the goal.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public ApplyResult Apply(Goal g, Params p) throws Z3Exception public ApplyResult apply(Goal g, Params p) throws Z3Exception
{ {
getContext().checkContextMatch(g);
Context().CheckContextMatch(g);
if (p == null) if (p == null)
return new ApplyResult(Context(), Native.tacticApply(Context() return new ApplyResult(getContext(), Native.tacticApply(getContext()
.nCtx(), NativeObject(), g.NativeObject())); .nCtx(), getNativeObject(), g.getNativeObject()));
else else
{ {
Context().CheckContextMatch(p); getContext().checkContextMatch(p);
return new ApplyResult(Context(), return new ApplyResult(getContext(),
Native.tacticApplyEx(Context().nCtx(), NativeObject(), Native.tacticApplyEx(getContext().nCtx(), getNativeObject(),
g.NativeObject(), p.NativeObject())); g.getNativeObject(), p.getNativeObject()));
} }
} }
/**
* Apply the tactic to a goal.
* @throws Z3Exception
**/
public ApplyResult get(Goal g) throws Z3Exception
{
return Apply(g, null);
}
/** /**
* Creates a solver that is implemented using the given tactic. <seealso * Creates a solver that is implemented using the given tactic. <seealso
* cref="Context.MkSolver(Tactic)"/> * cref="Context.MkSolver(Tactic)"/>
* @throws Z3Exception * @throws Z3Exception
**/ **/
public Solver Solver() throws Z3Exception public Solver getSolver() throws Z3Exception
{ {
return getContext().mkSolver(this);
return Context().MkSolver(this);
} }
Tactic(Context ctx, long obj) throws Z3Exception Tactic(Context ctx, long obj) throws Z3Exception
@ -93,15 +81,15 @@ public class Tactic extends Z3Object
super(ctx, Native.mkTactic(ctx.nCtx(), name)); super(ctx, Native.mkTactic(ctx.nCtx(), name));
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
Context().Tactic_DRQ().IncAndClear(Context(), o); getContext().tactic_DRQ().incAndClear(getContext(), o);
super.IncRef(o); super.incRef(o);
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
Context().Tactic_DRQ().Add(o); getContext().tactic_DRQ().add(o);
super.DecRef(o); super.decRef(o);
} }
} }

View file

@ -7,7 +7,7 @@ package com.microsoft.z3;
class TacticDecRefQueue extends IDecRefQueue class TacticDecRefQueue extends IDecRefQueue
{ {
public void IncRef(Context ctx, long obj) protected void incRef(Context ctx, long obj)
{ {
try try
{ {
@ -18,7 +18,7 @@ class TacticDecRefQueue extends IDecRefQueue
} }
} }
public void DecRef(Context ctx, long obj) protected void decRef(Context ctx, long obj)
{ {
try try
{ {

View file

@ -15,33 +15,33 @@ public class TupleSort extends Sort
* The constructor function of the tuple. * The constructor function of the tuple.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl MkDecl() throws Z3Exception public FuncDecl mkDecl() throws Z3Exception
{ {
return new FuncDecl(Context(), Native.getTupleSortMkDecl(Context() return new FuncDecl(getContext(), Native.getTupleSortMkDecl(getContext()
.nCtx(), NativeObject())); .nCtx(), getNativeObject()));
} }
/** /**
* The number of fields in the tuple. * The number of fields in the tuple.
**/ **/
public int NumFields() throws Z3Exception public int getNumFields() throws Z3Exception
{ {
return Native.getTupleSortNumFields(Context().nCtx(), NativeObject()); return Native.getTupleSortNumFields(getContext().nCtx(), getNativeObject());
} }
/** /**
* The field declarations. * The field declarations.
* @throws Z3Exception * @throws Z3Exception
**/ **/
public FuncDecl[] FieldDecls() throws Z3Exception public FuncDecl[] getFieldDecls() throws Z3Exception
{ {
int n = NumFields(); int n = getNumFields();
FuncDecl[] res = new FuncDecl[n]; FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
res[i] = new FuncDecl(Context(), Native.getTupleSortFieldDecl( res[i] = new FuncDecl(getContext(), Native.getTupleSortFieldDecl(
Context().nCtx(), NativeObject(), i)); getContext().nCtx(), getNativeObject(), i));
return res; return res;
} }
@ -51,8 +51,8 @@ public class TupleSort extends Sort
super(ctx); super(ctx);
Native.LongPtr t = new Native.LongPtr(); Native.LongPtr t = new Native.LongPtr();
setNativeObject(Native.mkTupleSort(ctx.nCtx(), name.NativeObject(), setNativeObject(Native.mkTupleSort(ctx.nCtx(), name.getNativeObject(),
numFields, Symbol.ArrayToNative(fieldNames), numFields, Symbol.arrayToNative(fieldNames),
AST.ArrayToNative(fieldSorts), t, new long[numFields])); AST.arrayToNative(fieldSorts), t, new long[numFields]));
} }
}; };

View file

@ -18,6 +18,6 @@ public class UninterpretedSort extends Sort
UninterpretedSort(Context ctx, Symbol s) throws Z3Exception UninterpretedSort(Context ctx, Symbol s) throws Z3Exception
{ {
super(ctx, Native.mkUninterpretedSort(ctx.nCtx(), s.NativeObject())); super(ctx, Native.mkUninterpretedSort(ctx.nCtx(), s.getNativeObject()));
} }
} }

View file

@ -14,7 +14,7 @@ public class Version
/** /**
* The major version * The major version
**/ **/
public static int Major() public static int getMajor()
{ {
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
Native.getVersion(major, minor, build, revision); Native.getVersion(major, minor, build, revision);
@ -24,7 +24,7 @@ public class Version
/** /**
* The minor version * The minor version
**/ **/
public static int Minor() public static int getMinor()
{ {
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
Native.getVersion(major, minor, build, revision); Native.getVersion(major, minor, build, revision);
@ -34,7 +34,7 @@ public class Version
/** /**
* The build version * The build version
**/ **/
public static int Build() public static int getBuild()
{ {
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
Native.getVersion(major, minor, build, revision); Native.getVersion(major, minor, build, revision);
@ -44,7 +44,7 @@ public class Version
/** /**
* The revision * The revision
**/ **/
public static int Revision() public static int getRevision()
{ {
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
Native.getVersion(major, minor, build, revision); Native.getVersion(major, minor, build, revision);

View file

@ -6,7 +6,6 @@
package com.microsoft.z3; package com.microsoft.z3;
import java.lang.Exception;
/** /**
* The exception base class for error reporting from Z3 * The exception base class for error reporting from Z3

View file

@ -17,17 +17,17 @@ public class Z3Object extends IDisposable
**/ **/
protected void finalize() throws Z3Exception protected void finalize() throws Z3Exception
{ {
Dispose(); dispose();
} }
/** /**
* Disposes of the underlying native Z3 object. * Disposes of the underlying native Z3 object.
**/ **/
public void Dispose() throws Z3Exception public void dispose() throws Z3Exception
{ {
if (m_n_obj != 0) if (m_n_obj != 0)
{ {
DecRef(m_n_obj); decRef(m_n_obj);
m_n_obj = 0; m_n_obj = 0;
} }
@ -51,23 +51,23 @@ public class Z3Object extends IDisposable
{ {
ctx.m_refCount++; ctx.m_refCount++;
m_ctx = ctx; m_ctx = ctx;
IncRef(obj); incRef(obj);
m_n_obj = obj; m_n_obj = obj;
} }
void IncRef(long o) throws Z3Exception void incRef(long o) throws Z3Exception
{ {
} }
void DecRef(long o) throws Z3Exception void decRef(long o) throws Z3Exception
{ {
} }
void CheckNativeObject(long obj) throws Z3Exception void checkNativeObject(long obj) throws Z3Exception
{ {
} }
long NativeObject() long getNativeObject()
{ {
return m_n_obj; return m_n_obj;
} }
@ -76,39 +76,39 @@ public class Z3Object extends IDisposable
{ {
if (value != 0) if (value != 0)
{ {
CheckNativeObject(value); checkNativeObject(value);
IncRef(value); incRef(value);
} }
if (m_n_obj != 0) if (m_n_obj != 0)
{ {
DecRef(m_n_obj); decRef(m_n_obj);
} }
m_n_obj = value; m_n_obj = value;
} }
static long GetNativeObject(Z3Object s) static long getNativeObject(Z3Object s)
{ {
if (s == null) if (s == null)
return 0; return 0;
return s.NativeObject(); return s.getNativeObject();
} }
Context Context() Context getContext()
{ {
return m_ctx; return m_ctx;
} }
static long[] ArrayToNative(Z3Object[] a) static long[] arrayToNative(Z3Object[] a)
{ {
if (a == null) if (a == null)
return null; return null;
long[] an = new long[a.length]; long[] an = new long[a.length];
for (int i = 0; i < a.length; i++) for (int i = 0; i < a.length; i++)
an[i] = (a[i] == null) ? 0 : a[i].NativeObject(); an[i] = (a[i] == null) ? 0 : a[i].getNativeObject();
return an; return an;
} }
static int ArrayLength(Z3Object[] a) static int arrayLength(Z3Object[] a)
{ {
return (a == null) ? 0 : a.length; return (a == null) ? 0 : a.length;
} }