mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +00:00
other components
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
e9eab22e5c
commit
68269c43a6
250 changed files with 70871 additions and 0 deletions
75
Microsoft.Z3/Pattern.cs
Normal file
75
Microsoft.Z3/Pattern.cs
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
Pattern.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Patterns
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2012-03-16
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// Patterns comprise a list of terms. The list should be
|
||||
/// non-empty. If the list comprises of more than one term, it is
|
||||
/// also called a multi-pattern.
|
||||
/// </summary>
|
||||
[ContractVerification(true)]
|
||||
public class Pattern : AST
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of terms in the pattern.
|
||||
/// </summary>
|
||||
public uint NumTerms
|
||||
{
|
||||
get { return Native.Z3_get_pattern_num_terms(Context.nCtx, NativeObject); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The terms in the pattern.
|
||||
/// </summary>
|
||||
public Expr[] Terms
|
||||
{
|
||||
get
|
||||
{
|
||||
Contract.Ensures(Contract.Result<Expr[]>() != null);
|
||||
|
||||
uint n = NumTerms;
|
||||
Expr[] res = new Expr[n];
|
||||
for (uint i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context, Native.Z3_get_pattern(Context.nCtx, NativeObject, i));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A string representation of the pattern.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return Native.Z3_pattern_to_string(Context.nCtx, NativeObject);
|
||||
}
|
||||
|
||||
#region Internal
|
||||
internal Pattern(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue