Class ArrayAccessNode
java.lang.Object
org.checkerframework.dataflow.cfg.node.Node
org.checkerframework.dataflow.cfg.node.ArrayAccessNode
- All Implemented Interfaces:
org.plumelib.util.UniqueId
A node for an array access:
arrayref [ index ]We allow array accesses without corresponding AST
Tree
s.-
Field Summary
Modifier and TypeFieldDescriptionprotected final Node
The array expression being accessed.protected @Nullable ExpressionTree
If this ArrayAccessNode is a node for an array desugared from an enhanced for loop, then thearrayExpression
field is the expression in the for loop, e.g.,arr
infor(Object o: arr
.protected final Node
The index expresssion used to access the array.protected final ArrayAccessTree
The corresponding ArrayAccessTree. -
Constructor Summary
ConstructorDescriptionArrayAccessNode
(ArrayAccessTree t, Node array, Node index) Create an ArrayAccessNode. -
Method Summary
Modifier and TypeMethodDescription<R,
P> R accept
(NodeVisitor<R, P> visitor, P p) Accept method of the visitor pattern.boolean
getArray()
Get the node that represents the array expression being accessed.If this ArrayAccessNode is a node for an array desugared from an enhanced for loop, then return the expression in the for loop, e.g.,arr
infor(Object o: arr
.getIndex()
getTree()
Returns theTree
in the abstract syntax tree, ornull
if no corresponding tree exists.int
hashCode()
void
setArrayExpression
(@Nullable ExpressionTree arrayExpression) Set the array expression from a for loop.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 corresponding ArrayAccessTree. -
array
The array expression being accessed. -
index
The index expresssion used to access the array. -
arrayExpression
If this ArrayAccessNode is a node for an array desugared from an enhanced for loop, then thearrayExpression
field is the expression in the for loop, e.g.,arr
infor(Object o: arr
.Is set by
setArrayExpression(com.sun.source.tree.ExpressionTree)
.
-
-
Constructor Details
-
ArrayAccessNode
Create an ArrayAccessNode.- Parameters:
t
- tree for the array accessarray
- the node for the array expression being accessedindex
- the node for the index used to access the array
-
-
Method Details
-
getArrayExpression
If this ArrayAccessNode is a node for an array desugared from an enhanced for loop, then return the expression in the for loop, e.g.,arr
infor(Object o: arr
. Otherwise, return null.- Returns:
- the array expression, or null if this is not an array desugared from an enhanced for loop
-
setArrayExpression
Set the array expression from a for loop.- Parameters:
arrayExpression
- array expression- See Also:
-
getArray
Get the node that represents the array expression being accessed.- Returns:
- the array expression node
-
getIndex
-
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
-