Call-back for logical expression.

@param ExpressionType $expressionType The type of logical expression
@param string         $left           The left expression
@param string         $right          The left expression

@return string
350527
public function onLogicalExpression($expressionType, $left, $right)
    {
        $type = $this->unpackExpressionType($expressionType);
        switch ($type) {
            case ExpressionType::AND_LOGICAL:
                return $this->prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
            case ExpressionType::OR_LOGICAL:
                return $this->prepareBinaryExpression(self::LOGICAL_OR, $left, $right);
            default:
                throw new \InvalidArgumentException('onLogicalExpression');
        }
    }
1287216
protected function queryBetween($left, $right, $leftIncluded = false, $rightIncluded = false)
    {
        $positionColumn = $this->getOrderColumnName();

        $leftOperator = $leftIncluded ? '>=' : '>';
        $rightOperator = $rightIncluded ? '<=' : '<';

        $query = $this->newPivotQuery();

        return $query->where($positionColumn, $leftOperator, $left)->where($positionColumn, $rightOperator, $right);
    }
1231854
public function where($left, $right, $comparator = Cmp::EQ, $conjunction = Cmp::CONJUNCTION_AND)
    {
        $left = ($left instanceof Expression) ? $left : new Expr\Column($left);
        $right = ($right instanceof Expression) ? $right : new Expr\Parameter($right);
        
        return $this->condition($left, $right, $comparator, $conjunction);
    }
235518
public static function strContains(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::STR_CONTAINS, $right);
    }
341872
protected Expression reOrder(Expression left, Expression right, BinaryOperation.Op op) {
        if (right instanceof BinaryOperation) {
            BinaryOperation rightOp = (BinaryOperation) right;
            if (!rightOp.isSealed() && rightOp.getOp().getPriority() == op.getPriority()) {
                replaceLeft(rightOp, left, op);
                return right;
            }
        }
        return new BinaryOperation(op, left, right);
    }
99372
public static Expression compare(
      final int comparisonOpcode, final Expression left, final Expression right) {
    checkArgument(
        left.resultType().equals(right.resultType()),
        "left and right must have matching types, found %s and %s",
        left.resultType(),
        right.resultType());
    checkIntComparisonOpcode(left.resultType(), comparisonOpcode);
    Features features =
        Expression.areAllCheap(left, right) ? Features.of(Feature.CHEAP) : Features.of();
    return new Expression(Type.BOOLEAN_TYPE, features) {
      @Override
      protected void doGen(CodeBuilder mv) {
        left.gen(mv);
        right.gen(mv);
        Label ifTrue = mv.newLabel();
        Label end = mv.newLabel();
        mv.ifCmp(left.resultType(), comparisonOpcode, ifTrue);
        mv.pushBoolean(false);
        mv.goTo(end);
        mv.mark(ifTrue);
        mv.pushBoolean(true);
        mv.mark(end);
      }
    };
  }
345626
private function buildLeftExpression($left)
    {
        if(self::CONTEXT_HAVING === $this->getContext())
        {
            return $this->parser->parseLeftHavingSoql($left);
        }
        return $this->parser->parseLeftWhereSoql($left);
    }
1107882
public static <D> Predicate ne(Expression<D> left, Expression<? super D> right) {
        return predicate(Ops.NE, left, right);
    }
415568
public function onArithmeticExpression($expressionType, $left, $right)
    {
        $type = $this->unpackExpressionType($expressionType);
        switch ($type) {
            case ExpressionType::MULTIPLY:
                return $this->prepareBinaryExpression(self::MULTIPLY, $left, $right);
            case ExpressionType::DIVIDE:
                return $this->prepareBinaryExpression(self::DIVIDE, $left, $right);
            case ExpressionType::MODULO:
                return $this->prepareBinaryExpression(self::MODULO, $left, $right);
            case ExpressionType::ADD:
                return $this->prepareBinaryExpression(self::ADD, $left, $right);
            case ExpressionType::SUBTRACT:
                return $this->prepareBinaryExpression(self::SUBTRACT, $left, $right);
            default:
                throw new \InvalidArgumentException('onArithmeticExpression');
        }
    }
162758
public function binary($operator = null, AbstractBuilder $leftExpression = null, AbstractBuilder $rightExpression = null)
    {
        return new BinaryOperator($operator, $leftExpression, $rightExpression);
    }
299914
public function having($left, $right, $comparator = Cmp::EQ, $conjunction = Cmp::CONJUNCTION_AND)
    {
        $left = ($left instanceof Expression) ? $left : new Expr\Column($left);
        $right = ($right instanceof Expression) ? $right : new Expr\Parameter($right);
        
        return $this->addHavingCondition($left, $right, $comparator, $conjunction);
    }
1173824
public static ExprBoolean toExprBoolean(Expression left, Expression right, int operation) {
	if (left instanceof Literal && right instanceof Literal) {
	    Boolean l = ((Literal) left).getBoolean(null);
	    Boolean r = ((Literal) right).getBoolean(null);

	    if (l != null && r != null) {
		switch (operation) {
		case Factory.OP_BOOL_AND:
		    return left.getFactory().createLitBoolean(l.booleanValue() && r.booleanValue(), left.getStart(), right.getEnd());
		case Factory.OP_BOOL_OR:
		    return left.getFactory().createLitBoolean(l.booleanValue() || r.booleanValue(), left.getStart(), right.getEnd());
		case Factory.OP_BOOL_XOR:
		    return left.getFactory().createLitBoolean(l.booleanValue() ^ r.booleanValue(), left.getStart(), right.getEnd());
		}
	    }
	}
	return new OpBool(left, right, operation);
    }
389176
final public static function binaryOperation(Expression $leftOperand, $operator, Expression $rightOperand)
    {
        return new BinaryOperationExpression(
                $leftOperand,
                $operator,
                $rightOperand);
    }
590712
public static function expr() : ExpressionBuilder
    {
        if (self::$expressionBuilder === null) {
            self::$expressionBuilder = new ExpressionBuilder();
        }

        return self::$expressionBuilder;
    }
471210
private function prepareBinaryExpression($operator, $left, $right)
    {
        return self::OPEN_BRACKET . $left . ' ' . $operator . ' ' . $right . self::CLOSE_BRACKET;
    }
1323143
public SelectParameters withExpressionType(ExpressionType expressionType) {
        setExpressionType(expressionType == null ? null : expressionType.toString());
        return this;
    }
872215
private function doubleExponentiation($leftOperand, $rightOperand)
    {
        // (x^a)^b -> x^(ab) for a, b numbers
        if ($leftOperand instanceof ExpressionNode && $leftOperand->getOperator() == '^') {

            $factory = new MultiplicationNodeFactory();
            $power = $factory->makeNode($leftOperand->getRight(), $rightOperand);

            $base = $leftOperand->getLeft();
            return self::makeNode($base,  $power);
        }

        // No simplification found
        return null;
    }