21 using System.Runtime.InteropServices;
22 using System.Diagnostics.Contracts;
24 namespace Microsoft.Z3
29 [ContractVerification(
true)]
43 public bool IsIntSymbol()
51 public bool IsStringSymbol()
59 public override string ToString()
63 else if (IsStringSymbol())
66 throw new Z3Exception(
"Unknown symbol kind encountered");
75 Contract.Requires(ctx != null);
80 Contract.Requires(ctx != null);
81 Contract.Ensures(Contract.Result<
Symbol>() != null);
88 throw new Z3Exception(
"Unknown symbol kind encountered");
97 [ContractVerification(
true)]
109 throw new Z3Exception(
"Int requested from non-Int symbol");
118 Contract.Requires(ctx != null);
120 internal IntSymbol(Context ctx,
int i)
123 Contract.Requires(ctx != null);
127 internal override void CheckNativeObject(IntPtr obj)
130 throw new Z3Exception(
"Symbol is not of integer kind");
131 base.CheckNativeObject(obj);
140 [ContractVerification(
true)]
151 Contract.Ensures(Contract.Result<
string>() != null);
153 if (!IsStringSymbol())
154 throw new Z3Exception(
"String requested from non-String symbol");
162 Contract.Requires(ctx != null);
165 internal StringSymbol(Context ctx,
string s) : base(ctx, Native.
Z3_mk_string_symbol(ctx.nCtx, s))
167 Contract.Requires(ctx != null);
171 internal override void CheckNativeObject(IntPtr obj)
174 throw new Z3Exception(
"Symbol is not of string kind");
176 base.CheckNativeObject(obj);