3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-12 02:04:43 +00:00

Java API: Added exception wrappers and build dependencies.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2012-11-30 15:39:25 +00:00
parent 654c02701c
commit 0c1f2a8281
47 changed files with 4908 additions and 4554 deletions

View file

@ -12,64 +12,71 @@ package com.microsoft.z3;
**/
public class ApplyResult extends Z3Object
{
/**
* The number of Subgoals.
**/
public int NumSubgoals()
{
return Native.applyResultGetNumSubgoals(Context().nCtx(),
NativeObject());
}
/**
* The number of Subgoals.
**/
public int NumSubgoals() throws Z3Exception
{
return Native.applyResultGetNumSubgoals(Context().nCtx(),
NativeObject());
}
/**
* Retrieves the subgoals from the ApplyResult.
* @throws Z3Exception
**/
public Goal[] Subgoals() throws Z3Exception
{
int n = NumSubgoals();
Goal[] res = new Goal[n];
for (int i = 0; i < n; i++)
res[i] = new Goal(Context(), Native.applyResultGetSubgoal(Context()
.nCtx(), NativeObject(), i));
return res;
}
/**
* Retrieves the subgoals from the ApplyResult.
*
* @throws Z3Exception
**/
public Goal[] Subgoals() throws Z3Exception
{
int n = NumSubgoals();
Goal[] res = new Goal[n];
for (int i = 0; i < n; i++)
res[i] = new Goal(Context(), Native.applyResultGetSubgoal(Context()
.nCtx(), NativeObject(), i));
return res;
}
/**
* Convert a model for the subgoal <paramref name="i"/> into a model for the
* original goal <code>g</code>, that the ApplyResult was obtained from.
*
* @return A model for <code>g</code>
* @throws Z3Exception
**/
public Model ConvertModel(int i, Model m) throws Z3Exception
{
return new Model(Context(), Native.applyResultConvertModel(Context()
.nCtx(), NativeObject(), i, m.NativeObject()));
}
/**
* Convert a model for the subgoal <paramref name="i"/> into a model for the
* original goal <code>g</code>, that the ApplyResult was obtained from.
*
* @return A model for <code>g</code>
* @throws Z3Exception
**/
public Model ConvertModel(int i, Model m) throws Z3Exception
{
return new Model(Context(), Native.applyResultConvertModel(Context()
.nCtx(), NativeObject(), i, m.NativeObject()));
}
/**
* A string representation of the ApplyResult.
**/
public String toString()
{
return Native.applyResultToString(Context().nCtx(), NativeObject());
}
/**
* A string representation of the ApplyResult.
**/
public String toString()
{
try
{
return Native.applyResultToString(Context().nCtx(), NativeObject());
} catch (Z3Exception e)
{
return "Z3Exception: " + e.getMessage();
}
}
ApplyResult(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
ApplyResult(Context ctx, long obj) throws Z3Exception
{
super(ctx, obj);
}
void IncRef(long o) throws Z3Exception
{
Context().ApplyResult_DRQ().IncAndClear(Context(), o);
super.IncRef(o);
}
void IncRef(long o) throws Z3Exception
{
Context().ApplyResult_DRQ().IncAndClear(Context(), o);
super.IncRef(o);
}
void DecRef(long o) throws Z3Exception
{
Context().ApplyResult_DRQ().Add(o);
super.DecRef(o);
}
void DecRef(long o) throws Z3Exception
{
Context().ApplyResult_DRQ().Add(o);
super.DecRef(o);
}
}