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>
bindingVariables
A list of all binding variables in this instanceof.protected Node
operand
The value being tested.protected @Nullable Node
patternNode
The node of the pattern if one exists.protected javax.lang.model.type.TypeMirror
refType
The reference type being tested against.protected com.sun.source.tree.InstanceOfTree
tree
The tree associated with this node.protected javax.lang.model.util.Types
types
For 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.boolean
equals(@Nullable java.lang.Object obj)
@Nullable LocalVariableNode
getBindingVariable()
Deprecated.UsegetPatternNode()
orgetBindingVariables()
instead.java.util.List<LocalVariableNode>
getBindingVariables()
Return all the binding variables in this instanceof.Node
getOperand()
java.util.Collection<Node>
getOperands()
@Nullable Node
getPatternNode()
Returns the pattern for this instanceof, or null if one does not exist.javax.lang.model.type.TypeMirror
getRefType()
The reference type being tested against.com.sun.source.tree.InstanceOfTree
getTree()
Returns theTree
in the abstract syntax tree, ornull
if no corresponding tree exists.int
hashCode()
java.lang.String
toString()
-
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:Node
Returns theTree
in the abstract syntax tree, ornull
if 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:Node
Accept method of the visitor pattern.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getOperands
@SideEffectFree public java.util.Collection<Node> getOperands()
Description copied from class:Node
- Specified by:
getOperands
in classNode
- Returns:
- a collection containing all of the operand
Node
s of thisNode
-
-