// 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())); }
// 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); } }