edu.ksu.cis.projects.bogor.ast
Class BlockStatement

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.ast.Node
      extended by edu.ksu.cis.projects.bogor.ast.Statement
          extended by edu.ksu.cis.projects.bogor.ast.BlockStatement
All Implemented Interfaces:
IStatementParent, Disposable, Serializable, Cloneable

public class BlockStatement
extends Statement
implements IStatementParent

The block (sequence of statements) statement AST.

Version:
CVS $Revision: 1.5 $ $Date: 2005/05/01 20:03:26 $
Author:
Robby
See Also:
Serialized Form

Field Summary
protected  ArrayList<Statement> stmts
          Holds the statements.
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node
ILLEGAL_LOCAL_ID_CHAR
 
Constructor Summary
BlockStatement(List<? extends Statement> stmts)
          Default constructor.
 
Method Summary
 BlockStatement clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Disposes stmt.
 Statement getStatement(int index)
          Gets a statement at a specified index.
 int getStatementCount()
          Gets the number of statements.
 void setStatements(List<? extends Statement> stmts)
          Sets the statements.
protected  String toString(String indent)
          Returns the string representation of this object.
 void visit(ASTVisitor visitor)
           
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.Statement
getParent, setParent, toString
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.Node
getLocationInfo, getProperty, putProperty, setLocationInfo
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stmts

protected ArrayList<Statement> stmts
Holds the statements. Must be non-null.

Constructor Detail

BlockStatement

public BlockStatement(List<? extends Statement> stmts)
Default constructor. Sets this object as the parent of all the statement in stmts.

Parameters:
stmts - The statements. Must be non-null. Each element in stmts must be non-null.
Method Detail

clone

public BlockStatement clone()
Clones this object (deep clone); including location info.

Specified by:
clone in class Statement
Returns:
The clone of this object. Non-null.

dispose

public void dispose()
Disposes stmt. Can be called repeatedly. Once called, avoid using this object.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class Statement

getStatement

public Statement getStatement(int index)
Gets a statement at a specified index.

Parameters:
index - The index of the statement. Must be between 0 and getStatementCount() - 1, inclusive.
Returns:
The statement at the specified index. Non-null.

getStatementCount

public int getStatementCount()
Gets the number of statements.

Returns:
The number of statements.

setStatements

public void setStatements(List<? extends Statement> stmts)
Sets the statements. Sets this object as the parent of all the statement in stmts.

Parameters:
stmts - The statements. Must be non-null. Each element in stmts must be non-null.

visit

public void visit(ASTVisitor visitor)
Specified by:
visit in class Node

toString

protected String toString(String indent)
Returns the string representation of this object.

Specified by:
toString in class Statement
Parameters:
indent - The indentation for this statement.
Returns:
 
  
           "s1\n" + 
           "s2\n" + 
           "...\n" +
           "sN\n".