mirror of
https://github.com/Z3Prover/z3
synced 2025-04-26 02:25:32 +00:00
Improved memory use of the Java API. Thanks to Joerg Pfaehler for reporting this issue!
+ formatting Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
3b78509d0a
commit
d7a62baef4
60 changed files with 3149 additions and 2992 deletions
|
@ -22,55 +22,55 @@ package com.microsoft.z3;
|
|||
**/
|
||||
public class EnumSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The function declarations of the constants in the enumeration.
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public FuncDecl[] getConstDecls() throws Z3Exception
|
||||
{
|
||||
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
|
||||
/**
|
||||
* The function declarations of the constants in the enumeration.
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public FuncDecl[] getConstDecls() throws Z3Exception
|
||||
{
|
||||
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
|
||||
FuncDecl[] t = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
t[i] = new FuncDecl(getContext(), Native.getDatatypeSortConstructor(getContext().nCtx(), getNativeObject(), i));
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The constants in the enumeration.
|
||||
* @throws Z3Exception on error
|
||||
* @return an Expr
|
||||
**/
|
||||
public Expr[] getConsts() throws Z3Exception
|
||||
{
|
||||
FuncDecl[] cds = getConstDecls();
|
||||
/**
|
||||
* The constants in the enumeration.
|
||||
* @throws Z3Exception on error
|
||||
* @return an Expr
|
||||
**/
|
||||
public Expr[] getConsts() throws Z3Exception
|
||||
{
|
||||
FuncDecl[] cds = getConstDecls();
|
||||
Expr[] t = new Expr[cds.length];
|
||||
for (int i = 0; i < t.length; i++)
|
||||
t[i] = getContext().mkApp(cds[i]);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The test predicates for the constants in the enumeration.
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public FuncDecl[] getTesterDecls() throws Z3Exception
|
||||
{
|
||||
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
|
||||
/**
|
||||
* The test predicates for the constants in the enumeration.
|
||||
* @throws Z3Exception on error
|
||||
**/
|
||||
public FuncDecl[] getTesterDecls() throws Z3Exception
|
||||
{
|
||||
int n = Native.getDatatypeSortNumConstructors(getContext().nCtx(), getNativeObject());
|
||||
FuncDecl[] t = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
t[i] = new FuncDecl(getContext(), Native.getDatatypeSortRecognizer(getContext().nCtx(), getNativeObject(), i));
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
EnumSort(Context ctx, Symbol name, Symbol[] enumNames) throws Z3Exception
|
||||
{
|
||||
super(ctx, 0);
|
||||
EnumSort(Context ctx, Symbol name, Symbol[] enumNames) throws Z3Exception
|
||||
{
|
||||
super(ctx, 0);
|
||||
|
||||
int n = enumNames.length;
|
||||
long[] n_constdecls = new long[n];
|
||||
long[] n_testers = new long[n];
|
||||
setNativeObject(Native.mkEnumerationSort(ctx.nCtx(),
|
||||
name.getNativeObject(), (int) n, Symbol.arrayToNative(enumNames),
|
||||
n_constdecls, n_testers));
|
||||
}
|
||||
int n = enumNames.length;
|
||||
long[] n_constdecls = new long[n];
|
||||
long[] n_testers = new long[n];
|
||||
setNativeObject(Native.mkEnumerationSort(ctx.nCtx(),
|
||||
name.getNativeObject(), (int) n, Symbol.arrayToNative(enumNames),
|
||||
n_constdecls, n_testers));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue