public abstract class BinaryValueExpression extends Object implements ValueExpression
ValueExpressions with two operands.
A BinaryValueExpression implements a ValueExpression that has two operands:
left and right (both ValueExpressions).
Both operands are themselves first evaluated. If at least one of the
operands evaluates to Optional.empty(), the result of the
ValueExpression itself will be empty as well.
For lists, values with the same index are evaluated in this manner. If lists are of unequal length, the result is a list with evaluated values the same size as the shortest list, appended with empty values to match the size of the longest list.
To implement a BinaryValueExpression, only the
eval(Value, Value, ParseState, Encoding) must be implemented,
handling the case of evaluating two values. This base class takes care of
evaluating the operands and handling list semantics.
UnaryValueExpression| Modifier and Type | Field and Description |
|---|---|
ValueExpression |
left |
ValueExpression |
right |
| Constructor and Description |
|---|
BinaryValueExpression(ValueExpression left,
ValueExpression right) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
ImmutableList<Optional<Value>> |
eval(ParseState parseState,
Encoding encoding) |
abstract Optional<Value> |
eval(Value left,
Value right,
ParseState parseState,
Encoding encoding) |
int |
hashCode() |
String |
toString() |
public final ValueExpression left
public final ValueExpression right
public BinaryValueExpression(ValueExpression left, ValueExpression right)
public ImmutableList<Optional<Value>> eval(ParseState parseState, Encoding encoding)
eval in interface ValueExpressionpublic abstract Optional<Value> eval(Value left, Value right, ParseState parseState, Encoding encoding)
Copyright © 2017. All rights reserved.