Modifier and Type | Field and Description |
---|---|
protected Node |
array
The array expression being accessed.
|
protected @Nullable ExpressionTree |
arrayExpression
If this ArrayAccessNode is a node for an array desugared from an enhanced for loop, then the
arrayExpression field is the expression in the for loop, e.g., arr in for(Object o: arr . |
protected Node |
index
The index expresssion used to access the array.
|
protected ArrayAccessTree |
tree
The corresponding ArrayAccessTree.
|
Constructor and Description |
---|
ArrayAccessNode(ArrayAccessTree t,
Node array,
Node index)
Create an ArrayAccessNode.
|
Modifier and Type | Method and Description |
---|---|
<R,P> R |
accept(NodeVisitor<R,P> visitor,
P p)
Accept method of the visitor pattern.
|
boolean |
equals(@Nullable Object obj) |
Node |
getArray()
Get the node that represents the array expression being accessed.
|
@Nullable ExpressionTree |
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 in for(Object o: arr . |
Node |
getIndex() |
Collection<Node> |
getOperands()
|
ArrayAccessTree |
getTree()
Returns the
Tree in the abstract syntax tree, or null if no corresponding
tree exists. |
int |
hashCode() |
void |
setArrayExpression(@Nullable ExpressionTree arrayExpression)
Set the array expression from a for loop.
|
String |
toString() |
getBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setLValue, toStringDebug
protected final ArrayAccessTree tree
protected final Node array
protected final Node index
protected @Nullable ExpressionTree arrayExpression
arrayExpression
field is the expression in the for loop, e.g., arr
in for(Object o: arr
.public ArrayAccessNode(ArrayAccessTree t, Node array, Node index)
t
- tree for the array accessarray
- the node for the array expression being accessedindex
- the node for the index used to access the arraypublic @Nullable ExpressionTree getArrayExpression()
arr
in for(Object o: arr
.
Otherwise, return null.public void setArrayExpression(@Nullable ExpressionTree arrayExpression)
arrayExpression
- array expressiongetArrayExpression()
public Node getArray()
public Node getIndex()
public ArrayAccessTree getTree()
Node
Tree
in the abstract syntax tree, or null
if no corresponding
tree exists. For instance, this is the case for an ImplicitThisNode
.public <R,P> R accept(NodeVisitor<R,P> visitor, P p)
Node
public Collection<Node> getOperands()
Node
getOperands
in class Node
Node
s of this Node