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
Trees.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NodeThe array expression being accessed.protected @Nullable ExpressionTreeIf this ArrayAccessNode is a node for an array desugared from an enhanced for loop, then thearrayExpressionfield is the expression in the for loop, e.g.,arrinfor(Object o: arr.protected final NodeThe index expresssion used to access the array.protected final ArrayAccessTreeThe corresponding ArrayAccessTree. -
Constructor Summary
ConstructorsConstructorDescriptionArrayAccessNode(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.booleangetArray()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.,arrinfor(Object o: arr.getIndex()getTree()Returns theTreein the abstract syntax tree, ornullif no corresponding tree exists.inthashCode()voidsetArrayExpression(@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, toStringDebugMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 thearrayExpressionfield is the expression in the for loop, e.g.,arrinfor(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.,arrinfor(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:NodeReturns theTreein the abstract syntax tree, ornullif no corresponding tree exists. For instance, this is the case for anImplicitThisNode. -
accept
Description copied from class:NodeAccept method of the visitor pattern. -
toString
-
equals
-
hashCode
public int hashCode() -
getOperands
Description copied from class:Node- Specified by:
getOperandsin classNode- Returns:
- a collection containing all of the operand
Nodes of thisNode
-