koala.dynamicjava.tree
Class DoStatement

java.lang.Object
  extended by koala.dynamicjava.tree.Node
      extended by koala.dynamicjava.tree.Statement
          extended by koala.dynamicjava.tree.DoStatement
All Implemented Interfaces:
ContinueTarget, SourceInfo.Wrapper

public class DoStatement
extends Statement
implements ContinueTarget

This class represents the do statement nodes of the syntax tree

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

Constructor Summary
DoStatement(Expression cond, Node body)
          Creates a new do statement
DoStatement(Expression cond, Node body, SourceInfo si)
          Creates a new do statement
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 void addLabel(String label)
          Adds a label to this statement
 Node getBody()
          Returns the body of this statement
 Expression getCondition()
          Gets the condition to evaluate at each loop
 boolean hasLabel(String label)
          Test whether this statement has the given label
 void setBody(Node node)
          Sets the body of this statement
 void setCondition(Expression e)
          Sets the condition to evaluate
 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

DoStatement

public DoStatement(Expression cond,
                   Node body)
Creates a new do statement

Parameters:
cond - the condition to evaluate at each loop
body - the body
Throws:
IllegalArgumentException - if cond is null or body is null

DoStatement

public DoStatement(Expression cond,
                   Node body,
                   SourceInfo si)
Creates a new do statement

Parameters:
cond - the condition to evaluate at each loop
body - the body
Throws:
IllegalArgumentException - if cond is null or body 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:
IllegalArgumentException - if e is null

getBody

public Node getBody()
Returns the body of this statement


setBody

public void setBody(Node node)
Sets the body of this statement

Throws:
IllegalArgumentException - if node is null

addLabel

public void addLabel(String label)
Adds a label to this statement

Specified by:
addLabel in interface ContinueTarget
Parameters:
label - the label to add
Throws:
IllegalArgumentException - if label is null

hasLabel

public boolean hasLabel(String label)
Test whether this statement has the given label

Specified by:
hasLabel in interface ContinueTarget
Returns:
true if this statement has the given label

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 String toString()
Implementation of toString for use in unit testing

Overrides:
toString in class Object