cetus.hir
Class IfStatement

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

public class IfStatement
extends Statement


Field Summary
 
Fields inherited from class cetus.hir.Statement
annotations, children, line_number, object_print_method, parent
 
Constructor Summary
IfStatement(Expression condition, Statement true_clause)
          Create an if statement that has no else clause.
IfStatement(Expression condition, Statement true_clause, Statement false_clause)
          Create an if statement that has an else clause.
 
Method Summary
static void defaultPrint(IfStatement stmt, java.io.OutputStream stream)
          Prints a break statement to a stream.
 Expression getControlExpression()
           
 Statement getElseStatement()
           
 Statement getThenStatement()
           
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 setControlExpression(Expression cond)
           
 void setElseStatement(Statement stmt)
           
 void setThenStatement(Statement stmt)
           
 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

IfStatement

public IfStatement(Expression condition,
                   Statement true_clause)
Create an if statement that has no else clause.

Parameters:
condition - The condition tested by the statement.
true_clause - The code to execute if the condition is true.

IfStatement

public IfStatement(Expression condition,
                   Statement true_clause,
                   Statement false_clause)
Create an if statement that has an else clause.

Parameters:
condition - The condition tested by the statement.
true_clause - The code to execute if the condition is true.
false_clause - The code to execute if the condition is false.
Method Detail

defaultPrint

public static void defaultPrint(IfStatement stmt,
                                java.io.OutputStream stream)
Prints a break statement to a stream.

Parameters:
stmt - The statement to print.
stream - The stream on which to print the statement.

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

getControlExpression

public Expression getControlExpression()

setControlExpression

public void setControlExpression(Expression cond)

getThenStatement

public Statement getThenStatement()

setThenStatement

public void setThenStatement(Statement stmt)

getElseStatement

public Statement getElseStatement()

setElseStatement

public void setElseStatement(Statement stmt)

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.