public class ArrayAccess extends Expression
| Constructor and Description |
|---|
ArrayAccess(Expression array,
Expression index)
Creates an array access with a single index expression.
|
ArrayAccess(Expression array,
java.util.List indices)
Creates an array access with multiple index expressions.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addIndex(Expression expr)
Inserts a new index at the end of the index list, increasing the dimension
of the array access.
|
ArrayAccess |
clone()
Returns a clone of the array access
|
static void |
defaultPrint(ArrayAccess e,
java.io.PrintWriter o)
Prints an array access expression to a stream.
|
Expression |
getArrayName()
Returns the expression being indexed.
|
Expression |
getIndex(int n)
Gets the n-th index expression of this array access.
|
java.util.List<Expression> |
getIndices()
Returns the list of indices in the array access.
|
int |
getNumIndices()
Returns the number of index expressions used in this array access.
|
static void |
setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently
created objects will use the supplied method.
|
void |
setIndex(int n,
Expression expr)
Sets the nth index expression of this array access.
|
void |
setIndices(java.util.List indices)
Set the list of index expressions.
|
java.lang.String |
toString()
Returns a string representation of the array access.
|
compareTo, equals, findExpression, getChildren, getParent, getStatement, hashCode, needsParens, print, printSelf, removeChild, setChild, setParens, setParent, setPrintMethod, swapWith, verifypublic ArrayAccess(Expression array, Expression index)
array - An expression evaluating to an address.index - The expression with which to index the array.NotAnOrphanException - if array or index has a parent
object.public ArrayAccess(Expression array, java.util.List indices)
array - An expression evaluating to an address.indices - A list of expressions with which to index the array.NotAnOrphanException - if array or an element of
indices has a parent object.public void addIndex(Expression expr)
expr - the new index expression to be inserted.NotAnOrphanException - if expr has a parent object.public ArrayAccess clone()
clone in class Expressionpublic static void defaultPrint(ArrayAccess e, java.io.PrintWriter o)
e - The array access to print.o - The writer on which to print the array access.public java.lang.String toString()
defaultPrint(cetus.hir.ArrayAccess, java.io.PrintWriter).toString in class Expressionpublic Expression getArrayName()
public Expression getIndex(int n)
n - The position of the index expression.java.lang.IndexOutOfBoundsException - if there is no expression at that
position.public java.util.List<Expression> getIndices()
public int getNumIndices()
public void setIndex(int n,
Expression expr)
n - The position of the index expression.expr - The expression to use for the index.NotAnOrphanException - if expr has a parent object.java.lang.IndexOutOfBoundsException - if there is no expression at that
position.public void setIndices(java.util.List indices)
indices - A list of expressions.NotAnOrphanException - if an element of indices has a parent
object.public static void setClassPrintMethod(java.lang.reflect.Method m)
m - The new print method.