3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00

Added accessors to enumeration sorts. Thanks to codeplex user steimann for suggesting this.

(http://z3.codeplex.com/workitem/195)

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2015-03-24 21:42:05 +00:00
parent b76d588c28
commit 1c77ad00c3
5 changed files with 87 additions and 4 deletions

View file

@ -44,6 +44,16 @@ namespace Microsoft.Z3
}
}
/// <summary>
/// Retrieves the inx'th constant declaration in the enumeration.
/// </summary>
/// <param name="inx"></param>
/// <returns></returns>
public FuncDecl ConstDecl(uint inx)
{
return new FuncDecl(Context, Native.Z3_get_datatype_sort_constructor(Context.nCtx, NativeObject, inx));
}
/// <summary>
/// The constants in the enumeration.
/// </summary>
@ -61,7 +71,17 @@ namespace Microsoft.Z3
}
/// <summary>
/// The test predicates for the constants in the enumeration.
/// Retrieves the inx'th constant in the enumeration.
/// </summary>
/// <param name="inx"></param>
/// <returns></returns>
public Expr Const(uint inx)
{
return Context.MkApp(ConstDecl(inx));
}
/// <summary>
/// The test predicates (recognizers) for the constants in the enumeration.
/// </summary>
public FuncDecl[] TesterDecls
{
@ -76,6 +96,16 @@ namespace Microsoft.Z3
}
}
/// <summary>
/// Retrieves the inx'th tester/recognizer declaration in the enumeration.
/// </summary>
/// <param name="inx"></param>
/// <returns></returns>
public FuncDecl TesterDecl(uint inx)
{
return new FuncDecl(Context, Native.Z3_get_datatype_sort_recognizer(Context.nCtx, NativeObject, inx));
}
#region Internal
internal EnumSort(Context ctx, Symbol name, Symbol[] enumNames)
: base(ctx, IntPtr.Zero)