Package com.strobel.expressions
Class BinaryExpression
- java.lang.Object
-
- com.strobel.expressions.Expression
-
- com.strobel.expressions.BinaryExpression
-
- Direct Known Subclasses:
AssignBinaryExpression
,CoalesceConversionBinaryExpression
,CompareMethodBasedLogicalBinaryExpression
,EqualsMethodBasedLogicalBinaryExpression
,LogicalBinaryExpression
,SimpleBinaryExpression
public class BinaryExpression extends Expression
-
-
Field Summary
Fields Modifier and Type Field Description private Expression
_left
private Expression
_right
-
Constructor Summary
Constructors Constructor Description BinaryExpression(Expression left, Expression right)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Expression
accept(ExpressionVisitor visitor)
Dispatches to the specific visit method for this node type.boolean
canReduce()
Indicates that the node can be reduced to a simpler node.(package private) static Expression
create(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method, LambdaExpression<?> conversion)
private static ExpressionType
getBinaryOpFromAssignmentOp(ExpressionType operator)
LambdaExpression<?>
getConversion()
Expression
getLeft()
MethodInfo
getMethod()
Expression
getRight()
private static boolean
isOpAssignment(ExpressionType operation)
(package private) boolean
isReferenceComparison()
Expression
reduce()
Reduces this node to a simpler expression.private Expression
reduceMember()
private Expression
reduceVariable()
BinaryExpression
update(Expression left, LambdaExpression<?> conversion, Expression right)
-
Methods inherited from class com.strobel.expressions.Expression
add, add, addAssign, addAssign, addAssign, and, and, andAlso, andAlso, andAlso, andAssign, andAssign, andAssign, arrayIndex, arrayLength, arrayToList, arrayToList, arrayToReadOnlyList, assign, base, block, block, block, block, block, block, block, block, block, block, block, block, block, block, box, call, call, call, call, call, call, call, call, call, call, classConstant, coalesce, coalesce, concat, concat, concat, condition, condition, constant, constant, convert, convert, decrement, decrement, defaultValue, divide, divide, divideAssign, divideAssign, divideAssign, empty, ensureUnmodifiable, equal, equal, exclusiveOr, exclusiveOr, exclusiveOrAssign, exclusiveOrAssign, exclusiveOrAssign, field, field, field, field, forEach, forEach, forEach, getDebugView, getInvokeMethod, getInvokeMethod, getMethodValidated, getNodeType, getType, greaterThan, greaterThan, greaterThanOrEqual, greaterThanOrEqual, ifThen, ifThenElse, increment, increment, instanceOf, invoke, invoke, isFalse, isFalse, isNotNull, isNull, isTrue, isTrue, label, label, label, label, label, label, lambda, lambda, lambda, lambda, lambda, lambda, lambda, lambda, lambda, lambda, lambda, lambda, lambda, leftShift, leftShift, leftShiftAssign, leftShiftAssign, leftShiftAssign, lessThan, lessThan, lessThanOrEqual, lessThanOrEqual, loop, loop, loop, makeBinary, makeBinary, makeBinary, makeBinary, makeBinary, makeBreak, makeBreak, makeBreak, makeBreak, makeCatch, makeCatch, makeCatch, makeCatch, makeCatch, makeCatch, makeContinue, makeContinue, makeFor, makeFor, makeFor, makeGoto, makeGoto, makeGoto, makeGoto, makeGoto, makeMemberAccess, makeNew, makeNew, makeNew, makeNew, makeReturn, makeReturn, makeReturn, makeReturn, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeSwitch, makeThrow, makeThrow, makeTry, makeTry, makeTry, makeUnary, makeUnary, methodArgumentsMatch, modulo, modulo, moduloAssign, moduloAssign, moduloAssign, multiply, multiply, multiplyAssign, multiplyAssign, multiplyAssign, negate, negate, newArrayBounds, newArrayInit, newArrayInit, not, not, notEqual, notEqual, onesComplement, onesComplement, or, or, orAssign, orAssign, orAssign, orElse, orElse, orElse, parameter, parameter, parameterIsAssignable, parameters, performBinaryNumericPromotion, postDecrementAssign, postDecrementAssign, postIncrementAssign, postIncrementAssign, preDecrementAssign, preDecrementAssign, preIncrementAssign, preIncrementAssign, reduceAndCheck, reduceExtensions, referenceEqual, referenceNotEqual, returnObject, rightShift, rightShift, rightShiftAssign, rightShiftAssign, rightShiftAssign, runtimeVariables, runtimeVariables, self, subtract, subtract, subtractAssign, subtractAssign, subtractAssign, switchCase, switchCase, toString, tryCatch, tryCatchFinally, tryFinally, typeEqual, unaryPlus, unaryPlus, unbox, unbox, unsignedRightShift, unsignedRightShift, unsignedRightShiftAssign, unsignedRightShiftAssign, unsignedRightShiftAssign, validateVariables, variable, variable, variables, visitChildren
-
-
-
-
Field Detail
-
_left
private final Expression _left
-
_right
private final Expression _right
-
-
Constructor Detail
-
BinaryExpression
BinaryExpression(Expression left, Expression right)
-
-
Method Detail
-
getRight
public final Expression getRight()
-
getLeft
public final Expression getLeft()
-
getMethod
public MethodInfo getMethod()
-
getConversion
public LambdaExpression<?> getConversion()
-
canReduce
public boolean canReduce()
Description copied from class:Expression
Indicates that the node can be reduced to a simpler node. If this returnstrue
,reduce()
can be called to produce the reduced form.- Overrides:
canReduce
in classExpression
- Returns:
true
if the node can be reduced; otherwise,false
.
-
accept
protected Expression accept(ExpressionVisitor visitor)
Description copied from class:Expression
Dispatches to the specific visit method for this node type. For example,BinaryExpression
will call intoExpressionVisitor.visitBinary()
.- Overrides:
accept
in classExpression
- Parameters:
visitor
- the visitor to visit this node.- Returns:
- the result of visiting this node.
-
reduce
public Expression reduce()
Description copied from class:Expression
Reduces this node to a simpler expression. IfcanReduce()
returnstrue
, this should return a valid expression. This method is allowed to return another node which itself must be reduced.- Overrides:
reduce
in classExpression
- Returns:
- the reduced expression.
-
create
static Expression create(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method, LambdaExpression<?> conversion)
-
update
public BinaryExpression update(Expression left, LambdaExpression<?> conversion, Expression right)
-
isReferenceComparison
boolean isReferenceComparison()
-
reduceVariable
private Expression reduceVariable()
-
reduceMember
private Expression reduceMember()
-
isOpAssignment
private static boolean isOpAssignment(ExpressionType operation)
-
getBinaryOpFromAssignmentOp
private static ExpressionType getBinaryOpFromAssignmentOp(ExpressionType operator)
-
-