mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 11:55:51 +00:00
Managed API: Refactoring and formatting.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
edc9dccbcf
commit
7defd469bb
52 changed files with 2006 additions and 1657 deletions
|
@ -90,92 +90,4 @@ namespace Microsoft.Z3
|
|||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numbered symbols
|
||||
/// </summary>
|
||||
[ContractVerification(true)]
|
||||
public class IntSymbol : Symbol
|
||||
{
|
||||
/// <summary>
|
||||
/// The int value of the symbol.
|
||||
/// </summary>
|
||||
/// <remarks>Throws an exception if the symbol is not of int kind. </remarks>
|
||||
public int Int
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsIntSymbol())
|
||||
throw new Z3Exception("Int requested from non-Int symbol");
|
||||
return Native.Z3_get_symbol_int(Context.nCtx, NativeObject);
|
||||
}
|
||||
}
|
||||
|
||||
#region Internal
|
||||
internal IntSymbol(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
internal IntSymbol(Context ctx, int i)
|
||||
: base(ctx, Native.Z3_mk_int_symbol(ctx.nCtx, i))
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
internal override void CheckNativeObject(IntPtr obj)
|
||||
{
|
||||
if ((Z3_symbol_kind)Native.Z3_get_symbol_kind(Context.nCtx, obj) != Z3_symbol_kind.Z3_INT_SYMBOL)
|
||||
throw new Z3Exception("Symbol is not of integer kind");
|
||||
base.CheckNativeObject(obj);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Named symbols
|
||||
/// </summary>
|
||||
[ContractVerification(true)]
|
||||
public class StringSymbol : Symbol
|
||||
{
|
||||
/// <summary>
|
||||
/// The string value of the symbol.
|
||||
/// </summary>
|
||||
/// <remarks>Throws an exception if the symbol is not of string kind.</remarks>
|
||||
public string String
|
||||
{
|
||||
get
|
||||
{
|
||||
Contract.Ensures(Contract.Result<string>() != null);
|
||||
|
||||
if (!IsStringSymbol())
|
||||
throw new Z3Exception("String requested from non-String symbol");
|
||||
return Native.Z3_get_symbol_string(Context.nCtx, NativeObject);
|
||||
}
|
||||
}
|
||||
|
||||
#region Internal
|
||||
internal StringSymbol(Context ctx, IntPtr obj) : base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
|
||||
internal StringSymbol(Context ctx, string s) : base(ctx, Native.Z3_mk_string_symbol(ctx.nCtx, s))
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
internal override void CheckNativeObject(IntPtr obj)
|
||||
{
|
||||
if ((Z3_symbol_kind)Native.Z3_get_symbol_kind(Context.nCtx, obj) != Z3_symbol_kind.Z3_STRING_SYMBOL)
|
||||
throw new Z3Exception("Symbol is not of string kind");
|
||||
|
||||
base.CheckNativeObject(obj);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue