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

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.WhileStatement
All Implemented Interfaces:
IExpParent, IStatementParent, Disposable, Serializable, Cloneable

public class WhileStatement
extends Statement
implements IExpParent, IStatementParent

The while statement AST.

Version:
CVS $Revision: 1.2 $ $Date: 2005/01/13 23:40:09 $
Author:
Robby
See Also:
Serialized Form

Field Summary
protected  Exp exp
          Holds the condition.
protected  Statement stmt
          Holds the statement.
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node
ILLEGAL_LOCAL_ID_CHAR
 
Constructor Summary
WhileStatement(Exp exp, Statement stmt)
          Default constructor.
 
Method Summary
 WhileStatement clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Disposes exp and stmt.
 Exp getExp()
          Gets the condition.
 Statement getStatement()
          Gets the statement.
 void setExp(Exp exp)
          Sets the condition.
 void setStatement(Statement stmt)
          Sets the statement.
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

exp

protected Exp exp
Holds the condition. Must be non-null.


stmt

protected Statement stmt
Holds the statement. Must be non-null.

Constructor Detail

WhileStatement

public WhileStatement(Exp exp,
                      Statement stmt)
Default constructor. Sets this object as the exp's parent. Sets this object as the stmt's parent.

Parameters:
exp - The condition. Must be non-null.
stmt - The statement. Must be non-null.
Method Detail

clone

public WhileStatement 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 exp and stmt. Can be called repeatedly. Once called, avoid using this object.

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

getExp

public Exp getExp()
Gets the condition.

Returns:
The condition. Non-null.

setExp

public void setExp(Exp exp)
Sets the condition. Sets this object as the exp's parent.

Parameters:
exp - The condition. Must be non-null.

getStatement

public Statement getStatement()
Gets the statement.

Returns:
The statement. Non-null.

setStatement

public void setStatement(Statement stmt)
Sets the statement. Sets this object as the stmt's parent.

Parameters:
stmt - The statement. 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:
 
  
       "while exp do\n" + 
       "    stmt\n" + 
       "end\n".