public class SwitchStmt extends Statement implements SwitchNode
switch(x) { case 5: case 6: a=100; break; case 9: a=33; break; default: throw new IllegalStateException(); };
switch(a) { ... } the selector is "a",
and the contents of the { ... } are the entries.
SwitchExpr)
SwitchExpr)
switch(x) { case BANANA,PEAR: b=10; break; default: b=5; };
switch(x) { case 5,6 -> println("uhuh"); default -> println("nope"); };
SwitchEntry,
SwitchExpr,
SwitchNode,
BreakStmt,
YieldStmtNode.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversalABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, LINE_SEPARATOR_KEY, NODE_BY_BEGIN_POSITION, PHANTOM_KEY, prettyPrinterNoCommentsConfiguration, PRINTER_KEY, SYMBOL_RESOLVER_KEY| Constructor and Description |
|---|
SwitchStmt() |
SwitchStmt(Expression selector,
NodeList<SwitchEntry> entries) |
SwitchStmt(TokenRange tokenRange,
Expression selector,
NodeList<SwitchEntry> entries)
This constructor is used by the parser and is considered private.
|
| Modifier and Type | Method and Description |
|---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
SwitchStmt |
asSwitchStmt() |
SwitchStmt |
clone() |
NodeList<SwitchEntry> |
getEntries() |
SwitchEntry |
getEntry(int i) |
SwitchStmtMetaModel |
getMetaModel() |
Expression |
getSelector() |
void |
ifSwitchStmt(Consumer<SwitchStmt> action) |
boolean |
isSwitchStmt() |
boolean |
remove(Node node) |
boolean |
replace(Node node,
Node replacementNode) |
SwitchStmt |
setEntries(NodeList<SwitchEntry> entries) |
SwitchStmt |
setSelector(Expression selector) |
Optional<SwitchStmt> |
toSwitchStmt() |
asAssertStmt, asBlockStmt, asBreakStmt, asContinueStmt, asDoStmt, asEmptyStmt, asExplicitConstructorInvocationStmt, asExpressionStmt, asForEachStmt, asForStmt, asIfStmt, asLabeledStmt, asLocalClassDeclarationStmt, asLocalRecordDeclarationStmt, asReturnStmt, asSynchronizedStmt, asThrowStmt, asTryStmt, asUnparsableStmt, asWhileStmt, asYieldStmt, ifAssertStmt, ifBlockStmt, ifBreakStmt, ifContinueStmt, ifDoStmt, ifEmptyStmt, ifExplicitConstructorInvocationStmt, ifExpressionStmt, ifForEachStmt, ifForStmt, ifIfStmt, ifLabeledStmt, ifLocalClassDeclarationStmt, ifLocalRecordDeclarationStmt, ifReturnStmt, ifSynchronizedStmt, ifThrowStmt, ifTryStmt, ifUnparsableStmt, ifWhileStmt, ifYieldStmt, isAssertStmt, isBlockStmt, isBreakStmt, isContinueStmt, isDoStmt, isEmptyStmt, isExplicitConstructorInvocationStmt, isExpressionStmt, isForEachStmt, isForStmt, isIfStmt, isLabeledStmt, isLocalClassDeclarationStmt, isLocalRecordDeclarationStmt, isReturnStmt, isSynchronizedStmt, isThrowStmt, isTryStmt, isUnparsableStmt, isWhileStmt, isYieldStmt, toAssertStmt, toBlockStmt, toBreakStmt, toContinueStmt, toDoStmt, toEmptyStmt, toExplicitConstructorInvocationStmt, toExpressionStmt, toForEachStmt, toForStmt, toIfStmt, toLabeledStmt, toLocalClassDeclarationStmt, toLocalRecordDeclarationStmt, toReturnStmt, toSynchronizedStmt, toThrowStmt, toTryStmt, toUnparsableStmt, toWhileStmt, toYieldStmtaddOrphanComment, containsData, createDefaultPrinter, createDefaultPrinter, customInitialization, equals, findAll, findAll, findAll, findByRange, findCompilationUnit, findData, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getDataKeys, getDefaultPrinterConfiguration, getLineEndingStyle, getLineEndingStyleOrDefault, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getPrinter, getPrinter, getRange, getSymbolResolver, getTokenRange, hashCode, hasScope, isAncestorOf, isPhantom, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walkfinalize, getClass, notify, notifyAll, wait, wait, waitgetComment, isEmptyfindAncestor, findAncestor, findAncestor, hasParentNode, isDescendantOfcontainsWithin, containsWithinRange, getBegin, getEnd, hasRangepublic SwitchStmt()
public SwitchStmt(Expression selector, NodeList<SwitchEntry> entries)
public SwitchStmt(TokenRange tokenRange, Expression selector, NodeList<SwitchEntry> entries)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitableaccept in interface VisitableR - the type of the return value of the visitorA - the type the user argument passed to the visitorv - the visitor implementationarg - the argument passed to the visitor (of type A)public <A> void accept(VoidVisitor<A> v, A arg)
Visitablepublic NodeList<SwitchEntry> getEntries()
getEntries in interface SwitchNodepublic SwitchEntry getEntry(int i)
getEntry in interface SwitchNodepublic Expression getSelector()
getSelector in interface SwitchNodepublic SwitchStmt setEntries(NodeList<SwitchEntry> entries)
setEntries in interface SwitchNodepublic SwitchStmt setSelector(Expression selector)
setSelector in interface SwitchNodepublic boolean remove(Node node)
remove in interface SwitchNoderemove in class Nodepublic SwitchStmt clone()
clone in interface SwitchNodeclone in class Statementpublic SwitchStmtMetaModel getMetaModel()
getMetaModel in class Statementpublic boolean replace(Node node, Node replacementNode)
replace in interface SwitchNodereplace in class Nodepublic boolean isSwitchStmt()
isSwitchStmt in class Statementpublic SwitchStmt asSwitchStmt()
asSwitchStmt in class Statementpublic void ifSwitchStmt(Consumer<SwitchStmt> action)
ifSwitchStmt in class Statementpublic Optional<SwitchStmt> toSwitchStmt()
toSwitchStmt in class StatementCopyright © 2007–2024. All rights reserved.