koala.dynamicjava.tree
Class IfThenStatement

java.lang.Object
  extended by koala.dynamicjava.tree.Node
      extended by koala.dynamicjava.tree.Statement
          extended by koala.dynamicjava.tree.IfThenStatement
All Implemented Interfaces:
SourceInfo.Wrapper
Direct Known Subclasses:
IfThenElseStatement

public class IfThenStatement
extends Statement

This class represents the if-then statement nodes of the syntax tree

Version:
1.0 - 1999/05/16
Author:
Stephane Hillion

Constructor Summary
IfThenStatement(Expression cond, Node tstmt)
          Creates a new while statement
IfThenStatement(Expression cond, Node tstmt, SourceInfo si)
          Creates a new while statement
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 Expression getCondition()
          Gets the condition to evaluate at each loop
 Node getThenStatement()
          Returns the then statement of this statement
 void setCondition(Expression e)
          Sets the condition to evaluate
 void setThenStatement(Node node)
          Sets the then statement of this statement
 java.lang.String toString()
          Implementation of toString for use in unit testing
 
Methods inherited from class koala.dynamicjava.tree.Node
archiveProperties, getProperties, getProperty, getSourceInfo, hasProperty, setProperty, setSourceInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IfThenStatement

public IfThenStatement(Expression cond,
                       Node tstmt)
Creates a new while statement

Parameters:
cond - the condition
tstmt - the statement
Throws:
java.lang.IllegalArgumentException - if cond is null or tstmt is null

IfThenStatement

public IfThenStatement(Expression cond,
                       Node tstmt,
                       SourceInfo si)
Creates a new while statement

Parameters:
cond - the condition
tstmt - the statement
Throws:
java.lang.IllegalArgumentException - if cond is null or tstmt is null
Method Detail

getCondition

public Expression getCondition()
Gets the condition to evaluate at each loop


setCondition

public void setCondition(Expression e)
Sets the condition to evaluate

Throws:
java.lang.IllegalArgumentException - if e is null

getThenStatement

public Node getThenStatement()
Returns the then statement of this statement


setThenStatement

public void setThenStatement(Node node)
Sets the then statement of this statement

Throws:
java.lang.IllegalArgumentException - if node is null

acceptVisitor

public <T> T acceptVisitor(Visitor<T> visitor)
Allows a visitor to traverse the tree

Specified by:
acceptVisitor in class Node
Parameters:
visitor - the visitor to accept

toString

public java.lang.String toString()
Implementation of toString for use in unit testing

Overrides:
toString in class java.lang.Object