ast
Class ArrayExpr

java.lang.Object
  extended by ast.ASTNode
      extended by ast.Expr
          extended by ast.ArrayExpr

public class ArrayExpr
extends Expr

The ArrayExpr class represents array expressions. It contains the name of the variable and an index expression. Note: these may or may not include a reference object name (if the array is a field). Because fields are 'protected' in Bantam Java, the reference object name must always be either 'this' or 'super'.

See Also:
ASTNode, Expr

Field Summary
protected  Expr index
          The index expression
protected  java.lang.String name
          The name of the variable (possibly 'this', 'super', or 'null')
protected  Expr ref
          The optional reference object (must be 'this' or 'super')
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
ArrayExpr(int lineNum, Expr ref, java.lang.String name, Expr index)
          ArrayExpr constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 Expr getIndex()
          Get the index expression
 java.lang.String getName()
          Get the name of the array
 Expr getRef()
          Get the reference object Only applicable if array is a field (otherwise this returns null)
 
Methods inherited from class ast.Expr
getExprType, setExprType
 
Methods inherited from class ast.ASTNode
getLineNum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected Expr ref
The optional reference object (must be 'this' or 'super')


name

protected java.lang.String name
The name of the variable (possibly 'this', 'super', or 'null')


index

protected Expr index
The index expression

Constructor Detail

ArrayExpr

public ArrayExpr(int lineNum,
                 Expr ref,
                 java.lang.String name,
                 Expr index)
ArrayExpr constructor

Parameters:
lineNum - source line number corresponding to this AST node
ref - the optional reference object (must be 'this' or 'super')
name - the name of the variable
index - the index expression
Method Detail

getRef

public Expr getRef()
Get the reference object Only applicable if array is a field (otherwise this returns null)

Returns:
reference object

getName

public java.lang.String getName()
Get the name of the array

Returns:
name

getIndex

public Expr getIndex()
Get the index expression

Returns:
index expression

accept

public java.lang.Object accept(visitor.Visitor v,
                               java.lang.Object o)
Visitor method

Specified by:
accept in class Expr
Parameters:
v - visitor object
o - object to pass down
Returns:
result of visiting this node
See Also:
Visitor