Z3
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Pattern.cs
Go to the documentation of this file.
1 /*++
2 Copyright (c) 2012 Microsoft Corporation
3 
4 Module Name:
5 
6  Pattern.cs
7 
8 Abstract:
9 
10  Z3 Managed API: Patterns
11 
12 Author:
13 
14  Christoph Wintersteiger (cwinter) 2012-03-16
15 
16 Notes:
17 
18 --*/
19 
20 using System;
21 using System.Runtime.InteropServices;
22 using System.Diagnostics.Contracts;
23 
24 namespace Microsoft.Z3
25 {
31  [ContractVerification(true)]
32  public class Pattern : AST
33  {
37  public uint NumTerms
38  {
39  get { return Native.Z3_get_pattern_num_terms(Context.nCtx, NativeObject); }
40  }
41 
45  public Expr[] Terms
46  {
47  get
48  {
49  Contract.Ensures(Contract.Result<Expr[]>() != null);
50 
51  uint n = NumTerms;
52  Expr[] res = new Expr[n];
53  for (uint i = 0; i < n; i++)
54  res[i] = Expr.Create(Context, Native.Z3_get_pattern(Context.nCtx, NativeObject, i));
55  return res;
56  }
57  }
58 
62  public override string ToString()
63  {
64  return Native.Z3_pattern_to_string(Context.nCtx, NativeObject);
65  }
66 
67  #region Internal
68  internal Pattern(Context ctx, IntPtr obj)
69  : base(ctx, obj)
70  {
71  Contract.Requires(ctx != null);
72  }
73  #endregion
74  }
75 }
Expressions are terms.
Definition: Expr.cs:29
override string ToString()
A string representation of the pattern.
Definition: Pattern.cs:62
Patterns comprise a list of terms. The list should be non-empty. If the list comprises of more than o...
Definition: Pattern.cs:32
static Z3_ast Z3_get_pattern(Z3_context a0, Z3_pattern a1, uint a2)
Definition: Native.cs:3446
The main interaction with Z3 happens via the Context.
Definition: Context.cs:31
The abstract syntax tree (AST) class.
Definition: AST.cs:31
static string Z3_pattern_to_string(Z3_context a0, Z3_pattern a1)
Definition: Native.cs:3840
static uint Z3_get_pattern_num_terms(Z3_context a0, Z3_pattern a1)
Definition: Native.cs:3438