Class InstanceOfNode
- java.lang.Object
-
- org.checkerframework.dataflow.cfg.node.Node
-
- org.checkerframework.dataflow.cfg.node.InstanceOfNode
-
- All Implemented Interfaces:
org.plumelib.util.UniqueId
public class InstanceOfNode extends Node
A node for the instanceof operator:x instanceof Point
-
-
Field Summary
Fields Modifier and Type Field Description protected @MonotonicNonNull java.util.List<LocalVariableNode>bindingVariablesA list of all binding variables in this instanceof.protected NodeoperandThe value being tested.protected @Nullable NodepatternNodeThe node of the pattern if one exists.protected javax.lang.model.type.TypeMirrorrefTypeThe reference type being tested against.protected com.sun.source.tree.InstanceOfTreetreeThe tree associated with this node.protected javax.lang.model.util.TypestypesFor Types.isSameType.
-
Constructor Summary
Constructors Constructor Description InstanceOfNode(com.sun.source.tree.InstanceOfTree tree, Node operand, @Nullable Node patternNode, javax.lang.model.type.TypeMirror refType, javax.lang.model.util.Types types)Create an InstanceOfNode.InstanceOfNode(com.sun.source.tree.InstanceOfTree tree, Node operand, javax.lang.model.type.TypeMirror refType, javax.lang.model.util.Types types)Create an InstanceOfNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <R,P>
Raccept(NodeVisitor<R,P> visitor, P p)Accept method of the visitor pattern.booleanequals(@Nullable java.lang.Object obj)@Nullable LocalVariableNodegetBindingVariable()Deprecated.UsegetPatternNode()orgetBindingVariables()instead.java.util.List<LocalVariableNode>getBindingVariables()Return all the binding variables in this instanceof.NodegetOperand()java.util.Collection<Node>getOperands()@Nullable NodegetPatternNode()Returns the pattern for this instanceof, or null if one does not exist.javax.lang.model.type.TypeMirrorgetRefType()The reference type being tested against.com.sun.source.tree.InstanceOfTreegetTree()Returns theTreein the abstract syntax tree, ornullif no corresponding tree exists.inthashCode()java.lang.StringtoString()-
Methods inherited from class org.checkerframework.dataflow.cfg.node.Node
getBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setLValue, toStringDebug
-
-
-
-
Field Detail
-
operand
protected final Node operand
The value being tested.
-
refType
protected final javax.lang.model.type.TypeMirror refType
The reference type being tested against.
-
tree
protected final com.sun.source.tree.InstanceOfTree tree
The tree associated with this node.
-
types
protected final javax.lang.model.util.Types types
For Types.isSameType.
-
bindingVariables
protected @MonotonicNonNull java.util.List<LocalVariableNode> bindingVariables
A list of all binding variables in this instanceof. This is lazily initialized, usegetBindingVariables().
-
-
Constructor Detail
-
InstanceOfNode
public InstanceOfNode(com.sun.source.tree.InstanceOfTree tree, Node operand, javax.lang.model.type.TypeMirror refType, javax.lang.model.util.Types types)Create an InstanceOfNode.- Parameters:
tree- instanceof treeoperand- the expression in the instanceof treerefType- the type in the instanceoftypes- types util
-
InstanceOfNode
public InstanceOfNode(com.sun.source.tree.InstanceOfTree tree, Node operand, @Nullable Node patternNode, javax.lang.model.type.TypeMirror refType, javax.lang.model.util.Types types)Create an InstanceOfNode.- Parameters:
tree- instanceof treeoperand- the expression in the instanceof treepatternNode- the pattern node or null if there is nonerefType- the type in the instanceoftypes- types util
-
-
Method Detail
-
getOperand
public Node getOperand()
-
getBindingVariable
@Deprecated public @Nullable LocalVariableNode getBindingVariable()
Deprecated.UsegetPatternNode()orgetBindingVariables()instead.Returns the binding variable for this instanceof, or null if one does not exist.- Returns:
- the binding variable for this instanceof, or null if one does not exist
-
getBindingVariables
public java.util.List<LocalVariableNode> getBindingVariables()
Return all the binding variables in this instanceof.- Returns:
- all the binding variables in this instanceof
-
getPatternNode
public @Nullable Node getPatternNode()
Returns the pattern for this instanceof, or null if one does not exist.- Returns:
- the pattern for this instanceof, or null if one does not exist
-
getRefType
public javax.lang.model.type.TypeMirror getRefType()
The reference type being tested against.- Returns:
- the reference type
-
getTree
public com.sun.source.tree.InstanceOfTree getTree()
Description copied from class:NodeReturns theTreein the abstract syntax tree, ornullif no corresponding tree exists. For instance, this is the case for anImplicitThisNode.
-
accept
public <R,P> R accept(NodeVisitor<R,P> visitor, P p)
Description copied from class:NodeAccept method of the visitor pattern.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getOperands
@SideEffectFree public java.util.Collection<Node> getOperands()
Description copied from class:Node- Specified by:
getOperandsin classNode- Returns:
- a collection containing all of the operand
Nodes of thisNode
-
-