Package com.strobel.expressions
Class ForExpression
- java.lang.Object
-
- com.strobel.expressions.Expression
-
- com.strobel.expressions.ForExpression
-
public final class ForExpression extends Expression
-
-
Field Summary
Fields Modifier and Type Field Description private Expression_bodyprivate LabelTarget_breakTargetprivate LabelTarget_continueTargetprivate Expression_initializerprivate Expression_stepprivate Expression_testprivate ParameterExpression_variable
-
Constructor Summary
Constructors Constructor Description ForExpression(ParameterExpression variable, Expression initializer, Expression test, Expression step, Expression body, LabelTarget breakTarget, LabelTarget continueTarget)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Expressionaccept(ExpressionVisitor visitor)Dispatches to the specific visit method for this node type.booleancanReduce()Indicates that the node can be reduced to a simpler node.ExpressiongetBody()LabelTargetgetBreakTarget()LabelTargetgetContinueTarget()ExpressiongetInitializer()ExpressionTypegetNodeType()Returns the node type of thisExpression.ExpressiongetStep()ExpressiongetTest()Type<?>getType()Gets the static type of the expression that thisExpressionrepresents.ParameterExpressiongetVariable()Expressionreduce()Reduces this node to a simpler expression.ForExpressionupdate(ParameterExpression variable, Expression initializer, Expression test, Expression step, Expression body, LabelTarget breakTarget, LabelTarget continueTarget)protected ExpressionvisitChildren(ExpressionVisitor visitor)Reduces the node and then calls the visitor on the reduced expression.-
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, 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
-
-
-
-
Field Detail
-
_variable
private final ParameterExpression _variable
-
_initializer
private final Expression _initializer
-
_test
private final Expression _test
-
_step
private final Expression _step
-
_body
private final Expression _body
-
_breakTarget
private final LabelTarget _breakTarget
-
_continueTarget
private final LabelTarget _continueTarget
-
-
Constructor Detail
-
ForExpression
ForExpression(ParameterExpression variable, Expression initializer, Expression test, Expression step, Expression body, LabelTarget breakTarget, LabelTarget continueTarget)
-
-
Method Detail
-
getVariable
public ParameterExpression getVariable()
-
getInitializer
public Expression getInitializer()
-
getTest
public Expression getTest()
-
getStep
public Expression getStep()
-
getBody
public Expression getBody()
-
getBreakTarget
public LabelTarget getBreakTarget()
-
getContinueTarget
public LabelTarget getContinueTarget()
-
getNodeType
public ExpressionType getNodeType()
Description copied from class:ExpressionReturns the node type of thisExpression.- Overrides:
getNodeTypein classExpression- Returns:
- the
ExpressionTypethat represents this expression.
-
getType
public Type<?> getType()
Description copied from class:ExpressionGets the static type of the expression that thisExpressionrepresents.- Overrides:
getTypein classExpression- Returns:
- the
Typethat represents the static type of the expression.
-
canReduce
public boolean canReduce()
Description copied from class:ExpressionIndicates that the node can be reduced to a simpler node. If this returnstrue,reduce()can be called to produce the reduced form.- Overrides:
canReducein classExpression- Returns:
trueif the node can be reduced; otherwise,false.
-
update
public ForExpression update(ParameterExpression variable, Expression initializer, Expression test, Expression step, Expression body, LabelTarget breakTarget, LabelTarget continueTarget)
-
accept
protected Expression accept(ExpressionVisitor visitor)
Description copied from class:ExpressionDispatches to the specific visit method for this node type. For example,BinaryExpressionwill call intoExpressionVisitor.visitBinary().- Overrides:
acceptin classExpression- Parameters:
visitor- the visitor to visit this node.- Returns:
- the result of visiting this node.
-
visitChildren
protected Expression visitChildren(ExpressionVisitor visitor)
Description copied from class:ExpressionReduces the node and then calls the visitor on the reduced expression. Throws an exception if the node isn't reducible.- Overrides:
visitChildrenin classExpression- Parameters:
visitor- an expression visitor- Returns:
- the expression being visited, or an expression which should replace it in the tree.
-
reduce
public Expression reduce()
Description copied from class:ExpressionReduces 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:
reducein classExpression- Returns:
- the reduced expression.
-
-