- All Superinterfaces:
ASTNode,BlockItemNode,StatementNode
Represents a C
switch statement.-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.ASTNode
ASTNode.NodeKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.statement.BlockItemNode
BlockItemNode.BlockItemKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.statement.StatementNode
StatementNode.StatementKind -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCase(LabeledStatementNode statement) Adds a case clause to the list associated to this switch node.voidclear()Remove cases and default case.copy()Returns a deep copy of this AST node.getBody()Returns the switch statement body: the switch statement has the form "switch(expression) body".getCases()Returns the sequence of allcase-labeled statements within this switch statement's body.Returns the branch condition controlling this switch statement.Returns the "default"-labeled statement within this switch statement, or null if there isn't one.voidsetDefaultCase(LabeledStatementNode statement) Sets the default clause for this switch statement.Methods inherited from interface dev.civl.abc.ast.node.IF.ASTNode
addAllTransformAnnotations, addTransformAnnotation, child, childIndex, children, diff, equiv, getAttribute, getOwner, getScope, getSource, id, keepOnly, nextDFS, nodeKind, numChildren, parent, prettyPrint, prettyRepresentation, prettyRepresentation, print, remove, removeChild, removeTransformAnnotation, setAttribute, setChild, setId, setOwner, setScope, toString, transformAnnotationsMethods inherited from interface dev.civl.abc.ast.node.IF.statement.BlockItemNode
blockItemKindMethods inherited from interface dev.civl.abc.ast.node.IF.statement.StatementNode
statementKind
-
Method Details
-
getCondition
ExpressionNode getCondition()Returns the branch condition controlling this switch statement.- Returns:
- the condition
-
getBody
StatementNode getBody()Returns the switch statement body: the switch statement has the form "switch(expression) body".- Returns:
- switch statement body
-
getCases
Iterator<LabeledStatementNode> getCases()Returns the sequence of all
case-labeled statements within this switch statement's body. This does not include thedefaultcase.Note: these are not children since they are reachable through the switch statement's body.
- Returns:
- sequence node listing all case-labeled statements in this switch statement
-
addCase
Adds a case clause to the list associated to this switch node.- Parameters:
statement- acase-labeled statement occurring in the body
-
getDefaultCase
LabeledStatementNode getDefaultCase()Returns the "default"-labeled statement within this switch statement, or null if there isn't one.- Returns:
- the default statement or null
-
setDefaultCase
Sets the default clause for this switch statement.- Parameters:
statement- thedefault-labeled statement in the switch node body
-
copy
SwitchNode copy()Description copied from interface:ASTNodeReturns a deep copy of this AST node. The node and all of its descendants will be cloned. The cloning does not copy analysis or attribute information.- Specified by:
copyin interfaceASTNode- Specified by:
copyin interfaceBlockItemNode- Specified by:
copyin interfaceStatementNode- Returns:
- deep copy of this node
-
clear
void clear()Remove cases and default case.
-