ast
Class Method

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

public class Method
extends Member

The Method class represents a method declaration within a class declaration. It contains the name of the method (name), a list of formal parameters (formalList), the return type of the method (returnType), and a list of statements from the method body (stmtList).

See Also:
ASTNode

Field Summary
protected  FormalList formalList
          A list of formal parameters
protected  java.lang.String name
          The name of the method
protected  java.lang.String returnType
          The return type of the method
protected  StmtList stmtList
          A list of statements appearing in the method body
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
Method(int lineNum, java.lang.String returnType, java.lang.String name, FormalList formalList, StmtList stmtList)
          Method constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 FormalList getFormalList()
          Get list of formal parameters
 java.lang.String getName()
          Get the name of this method
 java.lang.String getReturnType()
          Get the return type of this method
 StmtList getStmtList()
          Get list of statements from method body
 
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

returnType

protected java.lang.String returnType
The return type of the method


name

protected java.lang.String name
The name of the method


formalList

protected FormalList formalList
A list of formal parameters


stmtList

protected StmtList stmtList
A list of statements appearing in the method body

Constructor Detail

Method

public Method(int lineNum,
              java.lang.String returnType,
              java.lang.String name,
              FormalList formalList,
              StmtList stmtList)
Method constructor

Parameters:
lineNum - source line number corresponding to this AST node
returnType - the return type of this method
name - the name of this method
formalList - a list of formal parameters
stmtList - a list of statements appearing in the method body
Method Detail

getReturnType

public java.lang.String getReturnType()
Get the return type of this method

Returns:
return type of method

getName

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

Returns:
method name

getFormalList

public FormalList getFormalList()
Get list of formal parameters

Returns:
list of formal parameters

getStmtList

public StmtList getStmtList()
Get list of statements from method body

Returns:
list of statements

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