Package org.apache.sling.scripting.sightly.compiler.expression.nodes

## Class BinaryOperation

- java.lang.Object
- - org.apache.sling.scripting.sightly.compiler.expression.nodes.BinaryOperation

All Implemented Interfaces:
  `ExpressionNode`

    public final class BinaryOperation
    extends Object
    implements ExpressionNode

A {code BinaryOperation} defines an expression where a binary operator is applied (e.g. "a AND b").

### Constructor Summary

Constructors
`BinaryOperation​(BinaryOperator operator, ExpressionNode leftOperand, ExpressionNode rightOperand)` Creates a `BinaryOperation`.
`BinaryOperation​(BinaryOperator operator, ExpressionNode leftOperand, ExpressionNode rightOperand, Expression parentExpression)` Creates a `BinaryOperation`.

### Method Summary

All Methods Instance Methods Concrete Methods
`<T> T` `accept​(NodeVisitor<T> visitor)` Accept a visitor to process this node.
`ExpressionNode` `getLeftOperand()` Returns the left operand.
`BinaryOperator` `getOperator()` Returns the operator of the operation.
`Expression` `getParentExpression()` Returns the parent expression, if any.
`ExpressionNode` `getRightOperand()` Returns the right operand.
`String` `toString()`
`BinaryOperation` `withParentExpression​(Expression parentExpression)` Returns a copy of this `BinaryOperation` that contains information about the node's parent expression.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### BinaryOperation

    public BinaryOperation​(BinaryOperator operator,
                           ExpressionNode leftOperand,
                           ExpressionNode rightOperand)

Creates a `BinaryOperation`.

Parameters:
  `operator` - the operator
  `leftOperand` - the left operand
  `rightOperand` - the right operand

#### BinaryOperation

    public BinaryOperation​(BinaryOperator operator,
                           ExpressionNode leftOperand,
                           ExpressionNode rightOperand,
                           Expression parentExpression)

Creates a `BinaryOperation`.

Parameters:
  `operator` - the operator
  `leftOperand` - the left operand
  `rightOperand` - the right operand
  `parentExpression` - the parent expression of this operation

### Method Detail

#### getOperator

    public BinaryOperator getOperator()

Returns the operator of the operation.

Returns:
  the operator

#### getLeftOperand

    public ExpressionNode getLeftOperand()

Returns the left operand.

Returns:
  the left operand

#### getRightOperand

    public ExpressionNode getRightOperand()

Returns the right operand.

Returns:
  the right operand.

#### getParentExpression

    public Expression getParentExpression()

Returns the parent expression, if any.

Returns:
  the parent expression or `null`

#### withParentExpression

    public BinaryOperation withParentExpression​(Expression parentExpression)

Returns a copy of this `BinaryOperation` that contains information about the node's parent expression.

Parameters:
  `parentExpression` - the parent expression
Returns:
  a copy of the original `BinaryOperation`

#### accept

    public <T> T accept​(NodeVisitor<T> visitor)

Description copied from interface: `ExpressionNode`
Accept a visitor to process this node.

Specified by:
  `accept` in interface `ExpressionNode`
Type Parameters:
  `T` - the type of the visitor
Parameters:
  `visitor` - The visitor
Returns:
  the node after it has been evaluated by the visitor

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`