Microsoft.Z3.AST.Create C# (CSharp) Method

Create() static private method

static private Create ( Context ctx, IntPtr obj ) : AST
ctx Context
obj IntPtr
return AST
        internal static AST Create(Context ctx, IntPtr obj)
        {
            Contract.Requires(ctx != null);
            Contract.Ensures(Contract.Result<AST>() != null);

            switch ((Z3_ast_kind)Native.Z3_get_ast_kind(ctx.nCtx, obj))
            {
                case Z3_ast_kind.Z3_FUNC_DECL_AST: return new FuncDecl(ctx, obj);
                case Z3_ast_kind.Z3_QUANTIFIER_AST: return new Quantifier(ctx, obj);
                case Z3_ast_kind.Z3_SORT_AST: return Sort.Create(ctx, obj);
                case Z3_ast_kind.Z3_APP_AST:
                case Z3_ast_kind.Z3_NUMERAL_AST:
                case Z3_ast_kind.Z3_VAR_AST: return Expr.Create(ctx, obj);
                default:
                    throw new Z3Exception("Unknown AST kind");
            }
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Translates an AST vector into an AST[]
        /// </summary>
        public AST[] ToArray()
        {
            uint n = Size;

            AST[] res = new AST[n];
            for (uint i = 0; i < n; i++)
            {
                res[i] = AST.Create(this.Context, this[i].NativeObject);
            }
            return(res);
        }