3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-27 16:38:45 +00:00
z3/src/api/java/TupleSort.java
George Karpenkov 495ef0f055 Java bindings with no finalizers
Replacing finalizers with PhantomReferences, required quite a lot of
changes to the codebase.
2016-06-12 20:27:01 +02:00

67 lines
1.5 KiB
Java

/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
TupleSort.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
/**
* Tuple sorts.
**/
public class TupleSort extends Sort
{
/**
* The constructor function of the tuple.
* @throws Z3Exception
**/
public FuncDecl mkDecl()
{
return new FuncDecl(getContext(), Native.getTupleSortMkDecl(getContext()
.nCtx(), getNativeObject()));
}
/**
* The number of fields in the tuple.
**/
public int getNumFields()
{
return Native.getTupleSortNumFields(getContext().nCtx(), getNativeObject());
}
/**
* The field declarations.
* @throws Z3Exception
**/
public FuncDecl[] getFieldDecls()
{
int n = getNumFields();
FuncDecl[] res = new FuncDecl[n];
for (int i = 0; i < n; i++)
res[i] = new FuncDecl(getContext(), Native.getTupleSortFieldDecl(
getContext().nCtx(), getNativeObject(), i));
return res;
}
TupleSort(Context ctx, Symbol name, int numFields, Symbol[] fieldNames,
Sort[] fieldSorts)
{
super(ctx, Native.mkTupleSort(ctx.nCtx(), name.getNativeObject(),
numFields, Symbol.arrayToNative(fieldNames),
AST.arrayToNative(fieldSorts), new Native.LongPtr(),
new long[numFields]));
}
};