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 SummaryFieldsModifier 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 @Nullable EnhancedForLoopTreeIf this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then theenhancedForLoopfield is theEnhancedForLoopTreeAST node.protected final NodeThe index expresssion used to access the array.protected final ArrayAccessTreeThe corresponding ArrayAccessTree.
- 
Constructor SummaryConstructorsConstructorDescriptionArrayAccessNode(ArrayAccessTree t, Node array, Node index) Create an ArrayAccessNode.
- 
Method SummaryModifier 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.If this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then return theEnhancedForLoopTreeAST node.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.voidsetEnhancedForLoop(@Nullable EnhancedForLoopTree enhancedForLoop) Set the enhanced for loop from whichthisis desugared from.toString()Methods inherited from class org.checkerframework.dataflow.cfg.node.NodegetBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setLValue, toStringDebugMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.plumelib.util.UniqueIdgetClassAndUid
- 
Field Details- 
treeThe corresponding ArrayAccessTree.
- 
arrayThe array expression being accessed.
- 
indexThe index expresssion used to access the array.
- 
arrayExpressionIf 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).
- 
enhancedForLoopIf this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then theenhancedForLoopfield is theEnhancedForLoopTreeAST node.Is set by setEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree).
 
- 
- 
Constructor Details- 
ArrayAccessNodeCreate an ArrayAccessNode.- Parameters:
- t- tree for the array access
- array- the node for the array expression being accessed
- index- the node for the index used to access the array
 
 
- 
- 
Method Details- 
getArrayExpressionIf 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
 
- 
setArrayExpressionSet the array expression from a for loop.- Parameters:
- arrayExpression- array expression
- See Also:
 
- 
getEnhancedForLoopIf this ArrayAccessNode is a node for an array access desugared from an enhanced for loop, then return theEnhancedForLoopTreeAST node. Otherwise, return null.- Returns:
- the EnhancedForLoopTree, or null if this is not an array access desugared from an enhanced for loop
 
- 
setEnhancedForLoopSet the enhanced for loop from whichthisis desugared from.- Parameters:
- enhancedForLoop- the- EnhancedForLoopTree
- See Also:
 
- 
getArrayGet the node that represents the array expression being accessed.- Returns:
- the array expression node
 
- 
getIndex
- 
getTreeDescription copied from class:NodeReturns theTreein the abstract syntax tree, ornullif no corresponding tree exists. For instance, this is the case for anImplicitThisNode.
- 
acceptDescription copied from class:NodeAccept method of the visitor pattern.
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
- 
getOperandsDescription copied from class:Node- Specified by:
- getOperandsin class- Node
- Returns:
- a collection containing all of the operand Nodes of thisNode
 
 
-