public interface IIfNode extends IConditionalNode
if statement.
The shape of this node is
IIfNode IConditionalNode <-- ??? IConditionalNode <-- getElseIfNodes()[0] IConditionalNode <-- getElseIfNodes()[1] ... ITerminalNode <-- getElseNode()Example 1:
if (a > b)
return 1;
is represented as
IIfNode
IConditionalNode
IBinaryOperatorNode ">"
IIdentifierNode "a"
IIdentifierNode "b"
IBlockNode
IReturnNode
INumericLiteralNode 1
Example 2:
if (a > b)
return 1;
else
return 2;
is represented as
IIfNode
IConditionalNode
IBinaryOperatorNode ">"
IIdentifierNode "a"
IIdentifierNode "b"
IBlockNode
IReturnNode
INumericLiteralNode 1
ITerminalNode "else"
IBlockNode
IReturnNode
INumericLiteralNode 2
Example 3:
if (a > b)
return 1;
else if (a < b)
return -1;
else
return 0;
is represented as
IIfNode
IConditionalNode
IBinaryOperatorNode ">"
IIdentifierNode "a"
IIdentifierNode "b"
IBlockNode
IReturnNode
INumericLiteralNode 1
IConditionalNode
IBinaryOperatorNode "<"
IIdentifierNode "a"
IIdentifierNode "b"
IBlockNode
IReturnNode
INumericLiteralNode -1
ITerminalNode "else"
IBlockNode
IReturnNode
INumericLiteralNode 0
UNKNOWN| Modifier and Type | Method and Description |
|---|---|
IConditionalNode[] |
getElseIfNodes()
Returns an in-order array of else if statements that are branches of this
if statement
|
ITerminalNode |
getElseNode()
Returns the else clause of this if statement
|
getConditionalExpressionNodegetStatementContentsNodecontains, getAncestorOfType, getChild, getChildCount, getContainingNode, getContainingScope, getFileSpecification, getNodeID, getPackageName, getParent, getSpanningStart, getSucceedingNode, isTerminalgetAbsoluteEnd, getAbsoluteStart, getColumn, getEnd, getEndColumn, getEndLine, getLine, getSourcePath, getStartIConditionalNode[] getElseIfNodes()
IConditionalNode elementsITerminalNode getElseNode()
ITerminalNode or nullCopyright © 2016 The Apache Software Foundation. All rights reserved.