Utility, combine this expression with another, using conjunction.
The expression will only match if both conditions are met.

@param expr the other expression
@return self for chaining
481766
public Expr and(Expr expr) {
        if (type == Type.TRUE) {
            set(expr);
        } else if (expr.type != Type.TRUE) {
            if (type.isLogical() && !expr.type.isLogical()) {
                if (type == AND)
                    right.and(expr);
                else if (type != NOT)
                    setLogical(Type.AND, expr, new Expr(this));
                else
                    setLogical(Type.AND, expr, new Expr(this));
            } else {
                setLogical(Type.AND, new Expr(this), expr);
            }
        }
        return this;
    }
288061
public static And and(Expression<Boolean> left, Expression<Boolean> right) {
        return new And(left, right);
    }
623397
function (expr, cb, joinCond) {
            expr = (isUndefined(expr) || isNull(expr) || (Array.isArray(expr) && !expr.length)) ? null : expr;
            if (expr && cb) {
                return new BooleanExpression(joinCond || "AND", this._filterExpr(expr, null, joinCond), this._filterExpr(cb, null, joinCond));
            } else if (cb) {
                expr = cb;
            }
            if (isInstanceOf(expr, Expression)) {
                if (isInstanceOf(expr, NumericExpression, StringExpression)) {
                    throw new QueryError("Invalid SQL Expression type : " + expr);
                }
                return expr;
            } else if (Array.isArray(expr)) {
                if (expr.length) {
                    var first = expr[0];
                    if (isString(first)) {
                        return new PlaceHolderLiteralString(first, expr.slice(1), true);
                    } else if (Expression.isConditionSpecifier(expr)) {
                        return BooleanExpression.fromValuePairs(expr, joinCond);
                    } else {
                        return BooleanExpression.fromArgs([joinCond || "AND"].concat(expr.map(function (e) {
                            return this._filterExpr(e, null, "AND");
                        }, this)));
                    }
                }
            } else if (isFunction(expr)) {
                return this._filterExpr(expr.call(sql, sql), null, joinCond);
            } else if (isBoolean(expr)) {
                return new BooleanExpression("NOOP", expr);
            } else if (isString(expr)) {
                return this.stringToIdentifier(expr);
            } else if (isInstanceOf(expr, LiteralString)) {
                return new LiteralString("(" + expr + ")");
            } else if (isHash(expr)) {
                return BooleanExpression.fromValuePairs(expr, joinCond);
            } else {
                throw new QueryError("Invalid filter argument");
            }
        }
930463
private void box(Expression expr) {
    boxWithClass(expr, typeUtil.boxedClass((PrimitiveType) expr.getTypeMirror()));
  }
1081635
public static List<String> parse(String expr) {
        
        List<String> expressions = new ArrayList<>();
        
        int parenthesis = 0; // '(' and ')'
        int brackets = 0; // '{' and '}'
        int brackets2 = 0; // '[' and ']'

        String[] lines = expr.split("\n");
        StringBuilder sb = new StringBuilder();
        for(String line : lines) {
            line = line.trim();
            if(line.startsWith("#")) {
                // Ignore commented lines
            } else {
                char currentChar=0;
                for (int i = 0; i < line.length(); i++) {
                    currentChar = line.charAt(i);
                    if (currentChar == '#') {// Ignore rest of line
                        line = line.substring(0,i);
                        break; 
                    } else if (currentChar == '(') {
                        parenthesis++;
                    } else if (currentChar == ')') {
                        parenthesis--;
                    } else if (currentChar == '{') {
                        brackets++;
                    } else if (currentChar == '}') {
                        brackets--;
                    } else if (currentChar == '[') {
                        brackets2++;
                    } else if (currentChar == ']') {
                        brackets2--;
                    } else if (parenthesis == 0 && brackets == 0 && brackets2 == 0) {
                        if(currentChar == ';') {
                            String firstLine = line.substring(0, i+1);
                            sb.append(firstLine);                            
                            expressions.add(sb.toString());
                            sb = new StringBuilder();
                                                        
                            String remainder = line.substring(i+1);
                            line = remainder.trim()+"\n";
                            i=0;
                        }
                    }
                }
                if(line.trim().length()>0) {
                    sb.append(line);
                    if(parenthesis == 0 && brackets == 0 && brackets2 == 0) {
                        expressions.add(sb.toString());
                        sb = new StringBuilder();
                    } else {
                        if (currentChar!=',' && currentChar!='+' && currentChar!='-' && currentChar!='*' &&currentChar!='/' &&currentChar!='=')
                        sb.append(";\n");
                    }
                }
            }
        }
        
        return expressions;
    }
563222
public Predicate<T> and( final Predicate<T> other ) {
        if (other == null || other == this) return this;
        return new Predicate<T>() {
            @Override
            public boolean test( T input ) {
                return Predicate.this.test(input) && other.test(input);
            }
        };
    }
833165
private Expression tryToWrapInSoyExpression(Expression expr) {
    switch (expr.resultType().getSort()) {
      case Type.BOOLEAN:
        return SoyExpression.forBool(expr);
      case Type.INT:
        return SoyExpression.forInt(BytecodeUtils.numericConversion(expr, Type.LONG_TYPE));
      case Type.LONG:
        return SoyExpression.forInt(expr);
      case Type.DOUBLE:
        return SoyExpression.forFloat(expr);
      case Type.OBJECT:
        if (expr.resultType().equals(BytecodeUtils.STRING_TYPE)) {
          return SoyExpression.forString(expr);
        }
        break;
      default:
        break;
    }
    // TODO(sameb): Maybe wrap List/SoyValue types too, as 'unknown' parameter types?
    return expr;
  }
95065
public static boolean containsAggregateExpression(AbstractExpression expr) {
        AbstractExpression.SubexprFinderPredicate pred =
                new AbstractExpression.SubexprFinderPredicate() {
            @Override
            public boolean matches(AbstractExpression expr) {
                return expr.getExpressionType().isAggregateExpression();
            }
        };
        return expr.hasAnySubexpressionWithPredicate(pred);
    }
1155190
@Nullable
    public static Predicate allOf(Collection<Predicate> exprs) {
        Predicate rv = null;
        for (Predicate b : exprs) {
            if (b != null) {
                rv = rv == null ? b : ExpressionUtils.and(rv,b);
            }
        }
        return rv;
    }
365253
public BooleanExpression and(@Nullable Predicate right) {
        right = (Predicate) ExpressionUtils.extract(right);
        if (right != null) {
            return Expressions.booleanOperation(Ops.AND, mixin, right);
        } else {
            return this;
        }
    }
912215
public void andWith(OrCondition other) {

        //Because Titan does not natively support Or conditions in Graph Queries,
        //we need to expand out the condition so it is in the form of a single OrCondition
        //that contains only AndConditions.  We do this by following the rules of boolean
        //algebra.  As an example, suppose the current condition is ((a=1 and b=2) or (c=3 and d=4)).
        //Suppose "other" is ((e=5 and f=6) or (g=7 or h=8)).  The overall condition, after applying the
        //"and" is:
        //
        //((a=1 and b=2) or (c=3 and d=4)) and ((e=5 and f=6) or (g=7 and h=8))
        //
        //This needs to be expanded out to remove the nested or clauses.  The result of this expansion is:
        //
        //(a=1 and b=2 and e=5 and f=6) or
        //(a=1 and b=2 and g=7 and h=8) or
        //(c=3 and d=4 and e=5 and f=6) or
        //(c=3 and d=4 and g=7 and h=8)

        //The logic below does this expansion, in a generalized way.  It loops through the existing AndConditions
        //and, in a nested loop, through the AndConditions in "other".  For each of those combinations,
        //it creates a new AndCondition that combines the two AndConditions together.  These combined
        //AndConditions become the new set of AndConditions in this OrCondition.

        List<AndCondition> expandedExpressionChildren = new ArrayList<>();
        for (AndCondition otherExprTerm : other.getAndTerms()) {
            for (AndCondition currentExpr : children) {
                AndCondition currentAndConditionCopy = currentExpr.copy();
                currentAndConditionCopy.andWith(otherExprTerm.getTerms());
                expandedExpressionChildren.add(currentAndConditionCopy);
            }
        }
        children = expandedExpressionChildren;
    }
892782
public static <T> PositionFactory<T> optional(String expr) {
        final boolean optional = true;
        return new PositionFactory<>(Validate.notEmpty(expr, "expr"), optional);
    }
118614
function on($expr)
    {
        $lastJoin = $this->getLastJoinSource();

        // Join all given expressions with AND
        if ($lastJoin->right instanceof On) {
            // Merge the new ON Expressions with the 
            // old if there exists an ON Expression
            $lastJoin->right->expression = $expr;
        } else {
            // Otherwise create a new ON Expression
            $lastJoin->right = new On($expr);
        }
        return $this;
    }
1205244
def Disjunction(expr1: Expression, expr2: Expression) -> Expression:
    """"""
    expr = Expression(ast.BoolOp(ast.Or(), [expr1.body, expr2.body]))
    return ast.fix_missing_locations(expr)
765125
public BooleanExpression or(@Nullable Predicate right) {
        right = (Predicate) ExpressionUtils.extract(right);
        if (right != null) {
            return Expressions.booleanOperation(Ops.OR, mixin, right);
        } else {
            return this;
        }
    }
1090484
@SuppressWarnings("unchecked")
    public static Expression<String> likeToRegex(Expression<String> expr, boolean matchStartAndEnd) {
        // TODO : this should take the escape character into account
        if (expr instanceof Constant<?>) {
            final String like = expr.toString();
            final StringBuilder rv = new StringBuilder(like.length() + 4);
            if (matchStartAndEnd && !like.startsWith("%")) {
                rv.append('^');
            }
            for (int i = 0; i < like.length(); i++) {
                char ch = like.charAt(i);
                if (ch == '.' || ch == '*' || ch == '?') {
                    rv.append('\\');
                } else if (ch == '%') {
                    rv.append(".*");
                    continue;
                } else if (ch == '_') {
                    rv.append('.');
                    continue;
                }
                rv.append(ch);
            }
            if (matchStartAndEnd && !like.endsWith("%")) {
                rv.append('$');
            }
            if (!like.equals(rv.toString())) {
                return ConstantImpl.create(rv.toString());
            }
        } else if (expr instanceof Operation<?>) {
            Operation<?> o = (Operation<?>) expr;
            if (o.getOperator() == Ops.CONCAT) {
                Expression<String> lhs = likeToRegex((Expression<String>) o.getArg(0), false);
                Expression<String> rhs = likeToRegex((Expression<String>) o.getArg(1), false);
                if (lhs != o.getArg(0) || rhs != o.getArg(1)) {
                    return operation(String.class, Ops.CONCAT, lhs, rhs);
                }
            }
        }
        return expr;
    }
1172518
private Expression concat( Expression left, char operator, Expression right ) {
        if( left == null ) {
            return right;
        }
        Operation op;
        if( left.getClass() == Operation.class && ((Operation)left).getOperator() == operator ) {
            op = (Operation)left;
        } else if( right != null && right.getClass() == Operation.class && ((Operation)right).getOperator() == operator ) {
            op = (Operation)right;
            op.addLeftOperand( left );
            return op;
        } else {
            op = new Operation( reader, left, operator );
        }
        if( right != null ) {
            op.addOperand( right );
        }
        return op;
    }