ast
Class Field

java.lang.Object
  extended by ast.ASTNode
      extended by ast.Member
          extended by ast.Field

public class Field
extends Member

The Field class represents a field (instance variable) declaration appearing in a class declaration. It contains a variable type (type ), a name (name), and an optional initialization expression ( init).

See Also:
ASTNode

Field Summary
protected  Expr init
          The (optional) initialization expression for the field (instance variable)
protected  java.lang.String name
          The name of the field (instance variable)
protected  java.lang.String type
          The type of the field (instance variable)
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
Field(int lineNum, java.lang.String type, java.lang.String name, Expr init)
          Field constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 Expr getInit()
          Get the initialization expression of the field
 java.lang.String getName()
          Get the name of the field
 java.lang.String getType()
          Get the type of the field
 
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

type

protected java.lang.String type
The type of the field (instance variable)


name

protected java.lang.String name
The name of the field (instance variable)


init

protected Expr init
The (optional) initialization expression for the field (instance variable)

Constructor Detail

Field

public Field(int lineNum,
             java.lang.String type,
             java.lang.String name,
             Expr init)
Field constructor

Parameters:
lineNum - source line number corresponding to this AST node
type - the type of the field (instance variable)
name - the name of the field (instance variable)
init - the (optional) initialization expression for the field (instance variable)
Method Detail

getType

public java.lang.String getType()
Get the type of the field

Returns:
field type

getName

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

Returns:
field name

getInit

public Expr getInit()
Get the initialization expression of the field

Returns:
initialization expression

accept

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

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