cetus.hir
Class WhileLoop

java.lang.Object
  extended by cetus.hir.Statement
      extended by cetus.hir.WhileLoop
All Implemented Interfaces:
Annotatable, Loop, Printable, SymbolTable, Traversable, java.lang.Cloneable

public class WhileLoop
extends Statement
implements Loop, SymbolTable


Field Summary
 
Fields inherited from class cetus.hir.Statement
annotations, children, line_number, object_print_method, parent
 
Constructor Summary
WhileLoop(Expression condition, Statement body)
           
 
Method Summary
 void addDeclaration(Declaration decl)
          Add a declaration to the end of the set of declarations and place the declared symbols in the symbol table.
 void addDeclarationAfter(Declaration ref, Declaration decl)
          Add a declaration after the reference declaration.
 void addDeclarationBefore(Declaration ref, Declaration decl)
          Add a declaration before the reference declaration.
static void defaultPrint(WhileLoop loop, java.io.OutputStream stream)
          Prints a loop to a stream.
 Declaration findSymbol(IDExpression name)
          Retrieves the declaration for a symbol, possibly searching through parent symbol tables.
 Statement getBody()
          Returns the statement that is the body of the loop.
 Expression getCondition()
          Returns the expression that determines the duration of the loop.
 java.util.List<SymbolTable> getParentTables()
          Returns a list of symbol tables that are parents of this table in the distributed symbol table graph.
 java.util.HashMap<IDExpression,Declaration> getTable()
          Provides direct access to the symbol table; it's generally not a good idea to modify this directly.
 void setBody(Statement body)
           
static void setClassPrintMethod(java.lang.reflect.Method m)
          Overrides the class print method, so that all subsequently created objects will use the supplied method.
 void setCondition(Expression cond)
           
 java.lang.String toString()
          Returns a string representation of this statement; every child class should implement this method.
 
Methods inherited from class cetus.hir.Statement
annotate, annotateAfter, annotateBefore, annotationToString, clone, containsAnnotation, detach, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getChildren, getParent, getProcedure, print, removeAnnotations, removeAnnotations, removeChild, setChild, setLineNumber, setParent, setPrintMethod, swapWith, toAnnotatedString, verify, where
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WhileLoop

public WhileLoop(Expression condition,
                 Statement body)
Method Detail

addDeclaration

public void addDeclaration(Declaration decl)
Description copied from interface: SymbolTable
Add a declaration to the end of the set of declarations and place the declared symbols in the symbol table.

Specified by:
addDeclaration in interface SymbolTable
Parameters:
decl - The declaration to add.

addDeclarationBefore

public void addDeclarationBefore(Declaration ref,
                                 Declaration decl)
Description copied from interface: SymbolTable
Add a declaration before the reference declaration.

Specified by:
addDeclarationBefore in interface SymbolTable
Parameters:
ref - The reference point.
decl - The declaration to add.

addDeclarationAfter

public void addDeclarationAfter(Declaration ref,
                                Declaration decl)
Description copied from interface: SymbolTable
Add a declaration after the reference declaration.

Specified by:
addDeclarationAfter in interface SymbolTable
Parameters:
ref - The reference point.
decl - The declaration to add.

defaultPrint

public static void defaultPrint(WhileLoop loop,
                                java.io.OutputStream stream)
Prints a loop to a stream.

Parameters:
loop - The loop to print.
stream - The stream on which to print the loop.

toString

public java.lang.String toString()
Description copied from class: Statement
Returns a string representation of this statement; every child class should implement this method.

Specified by:
toString in class Statement

findSymbol

public Declaration findSymbol(IDExpression name)
Description copied from interface: SymbolTable
Retrieves the declaration for a symbol, possibly searching through parent symbol tables.

Specified by:
findSymbol in interface SymbolTable
Parameters:
name - The name of the symbol.

getBody

public Statement getBody()
Description copied from interface: Loop
Returns the statement that is the body of the loop.

Specified by:
getBody in interface Loop
Returns:
the body of the loop.

setBody

public void setBody(Statement body)

getCondition

public Expression getCondition()
Description copied from interface: Loop
Returns the expression that determines the duration of the loop.

Specified by:
getCondition in interface Loop
Returns:
the condition that is tested each iteration.

setCondition

public void setCondition(Expression cond)

getParentTables

public java.util.List<SymbolTable> getParentTables()
Description copied from interface: SymbolTable
Returns a list of symbol tables that are parents of this table in the distributed symbol table graph. A list is necessary because representing multiple inheritence in C++ requires it. Note that the parent tables are not necessarily tables of the immediate parent. The list is all symbol tables enclosing this object which appear at the same level such that no other symbol tables appear between this object and those tables.

Specified by:
getParentTables in interface SymbolTable
Returns:
a List of SymbolTables.

getTable

public java.util.HashMap<IDExpression,Declaration> getTable()
Description copied from interface: SymbolTable
Provides direct access to the symbol table; it's generally not a good idea to modify this directly.

Specified by:
getTable in interface SymbolTable
Returns:
a map of IDExpressions to Declarations.

setClassPrintMethod

public static void setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently created objects will use the supplied method.

Parameters:
m - The new print method.