mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
merged
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
commit
32791204e7
28 changed files with 1114 additions and 742 deletions
|
@ -37,10 +37,15 @@ public class AST extends Z3Object
|
|||
**/
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
AST casted = (AST) o;
|
||||
if (casted == null)
|
||||
return false;
|
||||
return this == casted;
|
||||
AST casted = null;
|
||||
|
||||
try {
|
||||
casted = AST.class.cast(o);
|
||||
} catch (ClassCastException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.NativeObject() == casted.NativeObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,18 +58,20 @@ public class AST extends Z3Object
|
|||
{
|
||||
if (other == null)
|
||||
return 1;
|
||||
AST oAST = (AST) other;
|
||||
if (oAST == null)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
if (Id() < oAST.Id())
|
||||
return -1;
|
||||
else if (Id() > oAST.Id())
|
||||
return +1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
AST oAST = null;
|
||||
try {
|
||||
AST.class.cast(other);
|
||||
} catch (ClassCastException e) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Id() < oAST.Id())
|
||||
return -1;
|
||||
else if (Id() > oAST.Id())
|
||||
return +1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,12 +38,11 @@ public class Context extends IDisposable
|
|||
InitContext();
|
||||
}
|
||||
|
||||
private Context(long ctx, long refCount, Native.errorHandler errh)
|
||||
private Context(long ctx, long refCount)
|
||||
{
|
||||
super();
|
||||
this.m_ctx = ctx;
|
||||
this.m_refCount = refCount;
|
||||
this.m_n_err_handler = errh;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -525,7 +524,7 @@ public class Context extends IDisposable
|
|||
public Expr MkConst(FuncDecl f) throws Z3Exception
|
||||
{
|
||||
|
||||
return MkApp(f, (Expr) null);
|
||||
return MkApp(f, (Expr[]) null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2908,21 +2907,6 @@ public class Context extends IDisposable
|
|||
Native.toggleWarningMessages((enabled) ? true : false);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// A delegate which is executed when an error is raised.
|
||||
// /// </summary>
|
||||
// /// <remarks>
|
||||
// /// Note that it is possible for memory leaks to occur if error handlers
|
||||
// /// throw exceptions.
|
||||
// /// </remarks>
|
||||
// public delegate void ErrorHandler(Context ctx, Z3_error_code errorCode,
|
||||
// String errorString);
|
||||
|
||||
// /// <summary>
|
||||
// /// The OnError event.
|
||||
// /// </summary>
|
||||
// public event ErrorHandler OnError = null;
|
||||
|
||||
/**
|
||||
* Update a mutable configuration parameter. <remarks> The list of all
|
||||
* configuration parameters can be obtained using the Z3 executable:
|
||||
|
@ -2950,26 +2934,16 @@ public class Context extends IDisposable
|
|||
}
|
||||
|
||||
long m_ctx = 0;
|
||||
Native.errorHandler m_n_err_handler = null;
|
||||
|
||||
long nCtx()
|
||||
{
|
||||
return m_ctx;
|
||||
}
|
||||
|
||||
// void NativeErrorHandler(long ctx, Z3_error_code errorCode)
|
||||
// {
|
||||
// // Do-nothing error handler. The wrappers in Z3.Native will throw
|
||||
// exceptions upon errors.
|
||||
// }
|
||||
|
||||
void InitContext() throws Z3Exception
|
||||
{
|
||||
setPrintMode(Z3_ast_print_mode.Z3_PRINT_SMTLIB2_COMPLIANT);
|
||||
// m_n_err_handler = new Native.errorHandler(NativeErrorHandler); //
|
||||
// keep reference so it doesn't get collected.
|
||||
// if (m_n_err_handler != null) Native.setErrorHandler(m_ctx,
|
||||
// m_n_err_handler);
|
||||
Native.setInternalErrorHandler(nCtx());
|
||||
}
|
||||
|
||||
void CheckContextMatch(Z3Object other) throws Z3Exception
|
||||
|
@ -3087,7 +3061,6 @@ public class Context extends IDisposable
|
|||
|
||||
if (m_refCount == 0)
|
||||
{
|
||||
m_n_err_handler = null;
|
||||
try
|
||||
{
|
||||
Native.delContext(m_ctx);
|
||||
|
@ -3099,7 +3072,7 @@ public class Context extends IDisposable
|
|||
} else
|
||||
/* re-queue the finalizer */
|
||||
/* BUG: DRQ's need to be taken over too! */
|
||||
new Context(m_ctx, m_refCount, m_n_err_handler);
|
||||
new Context(m_ctx, m_refCount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,6 @@ public class EnumSort extends Sort
|
|||
**/
|
||||
public FuncDecl[] ConstDecls()
|
||||
{
|
||||
|
||||
return _constdecls;
|
||||
}
|
||||
|
||||
|
@ -25,7 +24,6 @@ public class EnumSort extends Sort
|
|||
**/
|
||||
public Expr[] Consts()
|
||||
{
|
||||
|
||||
return _consts;
|
||||
}
|
||||
|
||||
|
@ -34,7 +32,6 @@ public class EnumSort extends Sort
|
|||
**/
|
||||
public FuncDecl[] TesterDecls()
|
||||
{
|
||||
|
||||
return _testerdecls;
|
||||
}
|
||||
|
||||
|
@ -53,12 +50,12 @@ public class EnumSort extends Sort
|
|||
n_constdecls, n_testers));
|
||||
_constdecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
_constdecls[i] = new FuncDecl(ctx, n_constdecls[i]);
|
||||
_constdecls[i] = new FuncDecl(ctx, n_constdecls[i]);
|
||||
_testerdecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
_testerdecls[i] = new FuncDecl(ctx, n_testers[i]);
|
||||
_testerdecls[i] = new FuncDecl(ctx, n_testers[i]);
|
||||
_consts = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
_consts[i] = ctx.MkApp(_constdecls[i], (Expr)null);
|
||||
_consts[i] = ctx.MkApp(_constdecls[i], (Expr[])null);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -159,13 +159,14 @@ public class Quantifier extends BoolExpr
|
|||
.NativeObject()));
|
||||
} else
|
||||
{
|
||||
setNativeObject(Native.mkQuantifierEx(ctx.nCtx(), (isForall) ? true
|
||||
: false, weight, AST.GetNativeObject(quantifierID), AST
|
||||
.GetNativeObject(skolemID), AST.ArrayLength(patterns), AST
|
||||
.ArrayToNative(patterns), AST.ArrayLength(noPatterns), AST
|
||||
.ArrayToNative(noPatterns), AST.ArrayLength(sorts), AST
|
||||
.ArrayToNative(sorts), Symbol.ArrayToNative(names), body
|
||||
.NativeObject()));
|
||||
setNativeObject(Native.mkQuantifierEx(ctx.nCtx(),
|
||||
(isForall) ? true : false, weight, AST.GetNativeObject(quantifierID),
|
||||
AST.GetNativeObject(skolemID),
|
||||
AST.ArrayLength(patterns), AST.ArrayToNative(patterns),
|
||||
AST.ArrayLength(noPatterns), AST.ArrayToNative(noPatterns),
|
||||
AST.ArrayLength(sorts), AST.ArrayToNative(sorts),
|
||||
Symbol.ArrayToNative(names),
|
||||
body.NativeObject()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,10 +39,15 @@ public class Sort extends AST
|
|||
**/
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
Sort casted = (Sort) o;
|
||||
if (casted == null)
|
||||
return false;
|
||||
return this == casted;
|
||||
Sort casted = null;
|
||||
|
||||
try {
|
||||
casted = Sort.class.cast(o);
|
||||
} catch (ClassCastException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.NativeObject() == casted.NativeObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -104,7 +104,7 @@ public class Z3Object extends IDisposable
|
|||
return null;
|
||||
long[] an = new long[a.length];
|
||||
for (int i = 0; i < a.length; i++)
|
||||
an[i] = a[i].NativeObject();
|
||||
an[i] = (a[i] == null) ? 0 : a[i].NativeObject();
|
||||
return an;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue