Package org.codehaus.janino

# Class Java.BinaryOperation

java.lang.Object
org.codehaus.janino.Java.Located
org.codehaus.janino.Java.Atom
org.codehaus.janino.Java.Rvalue
org.codehaus.janino.Java.BooleanRvalue
org.codehaus.janino.Java.BinaryOperation

All Implemented Interfaces:
  `Java.ArrayInitializerOrRvalue`, `Java.ElementValue`, `Java.Locatable`

Enclosing class:
  `Java`

public static final class Java.BinaryOperation extends Java.BooleanRvalue
Representation of all non-operand-modifying binary operations.

Operations with boolean result:

||
  JLS7 15.24 "conditional or operation"
&&
  JLS7 15.23 "conditional and operation"
==
  JLS7 15.21 "equality operation"
!=
  JLS7 15.22 "non-equality operation"
< > <= >=
  JLS7 15.20.1 "numerical comparison operations"

Operations with non-boolean result:

|
  JLS7 15.22.1 "integer bitwise OR operation" and JLS7 15.22.2 "boolean logical OR operation"
^
  JLS7 15.22.1 "integer bitwise XOR operation" and JLS7 15.22.2 "boolean logical XOR operation"
&
  JLS7 15.22.1 "integer bitwise AND operation" and JLS7 15.22.2 "boolean logical AND operation"
* / %
  JLS7 15.17 "multiplicative operations"
+ -
  JLS7 15.18 "additive operations"
<< >> >>>
  JLS7 15.19 "shift operations"

## Field Summary

Fields
Modifier and Type
Field
Description
`final Java.Rvalue`
`lhs`
The left hand side operand.
`final String`
`operator`
The operator, as an `interned` string.
`final Java.Rvalue`
`rhs`
The right hand side operand.

### Fields inherited from class org.codehaus.janino.Java.Located

`NOWHERE`

## Constructor Summary

Constructors
Constructor
Description
`BinaryOperation(Location location, Java.Rvalue lhs, String operator, Java.Rvalue rhs)`

## Method Summary

Modifier and Type
Method
Description
`<R, EX extends Throwable>
R`
`accept(Visitor.RvalueVisitor<R,EX> visitor)`
Invokes the "`visit...()`" method of `Visitor.RvalueVisitor` for the concrete `Java.Rvalue` type.
`String`
`toString()`
`Iterator<Java.Rvalue>`
`unrollLeftAssociation()`
Transforms this binary operation into an `Iterator` over a left-to-right sequence of `Java.Rvalue`s.

### Methods inherited from class org.codehaus.janino.Java.Rvalue

`accept, accept, accept, getEnclosingScope, getEnclosingScopeOrNull, setEnclosingScope, toRvalue`

### Methods inherited from class org.codehaus.janino.Java.Atom

`toLvalue, toLvalueOrCompileException, toRvalueOrCompileException, toType, toTypeOrCompileException`

### Methods inherited from class org.codehaus.janino.Java.Located

`getLocation, throwCompileException`

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

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

### Methods inherited from interface org.codehaus.janino.Java.Locatable

`getLocation, throwCompileException`

## Field Details

### lhs

public final Java.Rvalue lhs
The left hand side operand.

### operator

public final String operator
The operator, as an `interned` string.

See Also:
  - `Java.BinaryOperation`

### rhs

public final Java.Rvalue rhs
The right hand side operand.

## Constructor Details

### BinaryOperation

public BinaryOperation(Location location, Java.Rvalue lhs, String operator, Java.Rvalue rhs)

## Method Details

### toString

public String toString()

Specified by:
  `toString` in class `Java.Atom`

### unrollLeftAssociation

public Iterator<Java.Rvalue> unrollLeftAssociation()
Transforms this binary operation into an `Iterator` over a left-to-right sequence of `Java.Rvalue`s.

That iterator produces two elements (the left-hand-side and the right-hand-side of this operation), or, iff the left-hand-side of this operation is itself a binary operation with the same operator, then the iterator produces the sequence of the unrolled operands.

### accept

@Nullable public <R, EX extends Throwable> R accept(Visitor.RvalueVisitor<R,EX> visitor) throws EX
Description copied from class: `Java.Rvalue`
Invokes the "`visit...()`" method of `Visitor.RvalueVisitor` for the concrete `Java.Rvalue` type.

Specified by:
  `accept` in class `Java.Rvalue`
Throws:
  `EX`