public interface ISwitchNode extends IConditionalNode
switch statement.
The shape of this node is:
ISwitchNode
IExpressionNode <-- getConditionalExpressionNode()
IBlockNode <-- getStatementContentsNode()
IConditionalNode <-- getCaseNodes()[0]
IConditionalNode <-- getCaseNodes()[1]
...
ITerminalNode <-- getDefaultNode()
For example,
switch (i)
{
case 1:
return a;
case 3:
return b;
default:
return c;
is represented as
ISwitchNode
IIdentifierNode "i"
IBlockNode
IConditionalNode
INumericLiteralNode 1
IBlockNode
IReturnNode
IIdentifierNode "a"
IConditionalNode
INumericLiteralNode 2
IBlockNode
IReturnNode
IIdentifierNode "b"
ITerminalNode
IBlockNode
IReturnNode
IIdentifierNode "c"
An implicit IBlockNode is created for each case
and default clause that doesn't have curly braces.UNKNOWN| Modifier and Type | Method and Description |
|---|---|
IConditionalNode[] |
getCaseNodes()
Returns an in-order array of case statements that are branches of this
switch statement
|
ITerminalNode |
getDefaultNode()
Returns the default clause of this switch statement
|
getConditionalExpressionNodegetStatementContentsNodecontains, getAncestorOfType, getChild, getChildCount, getContainingNode, getContainingScope, getFileSpecification, getNodeID, getPackageName, getParent, getSpanningStart, getSucceedingNode, isTerminalgetAbsoluteEnd, getAbsoluteStart, getColumn, getEnd, getEndColumn, getEndLine, getLine, getSourcePath, getStartIConditionalNode[] getCaseNodes()
IConditionalNode elementsITerminalNode getDefaultNode()
ITerminalNode or nullCopyright © 2016 The Apache Software Foundation. All rights reserved.