Class CaseNode
java.lang.Object
org.checkerframework.dataflow.cfg.node.Node
org.checkerframework.dataflow.cfg.node.CaseNode
- All Implemented Interfaces:
org.plumelib.util.UniqueId
A node for a case in a switch statement. Although a case has no abstract value, it can imply
facts about the abstract values of its operands.
case constant:
-
Field Summary
Modifier and TypeFieldDescriptionThe case expressions to match the switch expression against: the operands of (possibly multiple) case labels.protected final AssignmentNode
The Node for the assignment of the switch selector expression to a synthetic local variable.protected final CaseTree
The tree for this node. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<R,
P> R accept
(NodeVisitor<R, P> visitor, P p) Accept method of the visitor pattern.boolean
Gets the nodes corresponding to the case expressions.The Node for the assignment of the switch selector expression to a synthetic local variable.getTree()
Returns theTree
in the abstract syntax tree, ornull
if no corresponding tree exists.int
hashCode()
toString()
Methods inherited from class org.checkerframework.dataflow.cfg.node.Node
getBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setLValue, toStringDebug
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.plumelib.util.UniqueId
getClassAndUid
-
Field Details
-
tree
The tree for this node. -
selectorExprAssignment
The Node for the assignment of the switch selector expression to a synthetic local variable. -
caseExprs
The case expressions to match the switch expression against: the operands of (possibly multiple) case labels.
-
-
Constructor Details
-
CaseNode
public CaseNode(CaseTree tree, AssignmentNode selectorExprAssignment, List<Node> caseExprs, Types types) Create a new CaseNode.- Parameters:
tree
- the tree for this nodeselectorExprAssignment
- the Node for the assignment of the switch selector expression to a synthetic local variablecaseExprs
- the case expression(s) to match the switch expression againsttypes
- a factory of utility methods for operating on types
-
-
Method Details
-
getSwitchOperand
The Node for the assignment of the switch selector expression to a synthetic local variable. This is used to refine the type of the switch selector expression in a case block.- Returns:
- the assignment of the switch selector expression to a synthetic local variable
-
getCaseOperands
Gets the nodes corresponding to the case expressions. There can be multiple expressions since Java 12.- Returns:
- the nodes corresponding to the (potentially multiple) case expressions
-
getTree
Description copied from class:Node
Returns theTree
in the abstract syntax tree, ornull
if no corresponding tree exists. For instance, this is the case for anImplicitThisNode
. -
accept
Description copied from class:Node
Accept method of the visitor pattern. -
toString
-
equals
-
hashCode
public int hashCode() -
getOperands
Description copied from class:Node
- Specified by:
getOperands
in classNode
- Returns:
- a collection containing all of the operand
Node
s of thisNode
-