Exemple #1
0
        // This is not a general purpose helper, so do not use it to make
        // "correct" logical operator node based on the operator, it used
        // here in the context of children already are bound only the
        // new node needs to marked bound. This is to be used only
        // within the context of Normalize method of BinExpr.
        internal Expr makeAnyLogicalExpr(Expr l, Expr r, string op)
        {
            if (op == " and ")
            {
                LogicAndExpr newe = new LogicAndExpr(l, r)
                {
                    bounded_ = true
                };
                newe.FixNewExprTableRefs(l);
                if (r.tableRefs_.Count > 0 && !newe.TableRefsContainedBy(r.tableRefs_))
                {
                    newe.FixNewExprTableRefs(r);
                }
                return(newe);
            }
            else
            {
                LogicOrExpr newe = new LogicOrExpr(l, r);
                newe.FixNewExprTableRefs(l);
                if (r.tableRefs_.Count > 0 && !newe.TableRefsContainedBy(r.tableRefs_))
                {
                    newe.FixNewExprTableRefs(r);
                }
                newe.bounded_ = true;

                return(newe);
            }
        }
Exemple #2
0
 // a > 3 or c > 1, b > 5 =>  (a > 3 or c > 1) and (b > 5)
 public static Expr AddAndFilter(this Expr basefilter, Expr newcond)
 {
     Debug.Assert(newcond.IsBoolean());
     if (basefilter is null)
     {
         return(newcond.Clone());
     }
     return(LogicAndExpr.MakeExpr(basefilter, newcond.Clone()));
 }
Exemple #3
0
        public static LogicAndExpr MakeExpr(Expr l, Expr r)
        {
            Debug.Assert(l.bounded_ && r.bounded_);
            var and = new LogicAndExpr(l, r);

            and.ResetAggregateTableRefs();
            and.markBounded();
            return(and);
        }
Exemple #4
0
 // a List<Expr> conditions merge into a LogicAndExpr
 public static Expr AndListToExpr(this List <Expr> andlist)
 {
     Debug.Assert(andlist.Count >= 1);
     if (andlist.Count == 1)
     {
         return(andlist[0]);
     }
     else
     {
         var andexpr = LogicAndExpr.MakeExpr(andlist[0], andlist[1]);
         for (int i = 2; i < andlist.Count; i++)
         {
             andexpr.children_[0] = LogicAndExpr.MakeExpr(andexpr.l_(), andlist[i]);
         }
         return(andexpr);
     }
 }