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 @Nullable EnhancedForLoopTree
If this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then theenhancedForLoop
field is theEnhancedForLoopTree
AST node.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
.If this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then return theEnhancedForLoopTree
AST node.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.void
setEnhancedForLoop
(@Nullable EnhancedForLoopTree enhancedForLoop) Set the enhanced for loop from whichthis
is desugared from.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)
. -
enhancedForLoop
If this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then theenhancedForLoop
field is theEnhancedForLoopTree
AST node.Is set by
setEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree)
.
-
-
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:
-
getEnhancedForLoop
If this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then return theEnhancedForLoopTree
AST node. Otherwise, return null.- Returns:
- the
EnhancedForLoopTree
, or null if this is not an array access desugared from an enhanced for loop
-
setEnhancedForLoop
Set the enhanced for loop from whichthis
is desugared from.- Parameters:
enhancedForLoop
- theEnhancedForLoopTree
- 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
-