koala.dynamicjava.tree
Class ForStatement

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

public class ForStatement
extends ForSlashEachStatement
implements ContinueTarget

This class represents the for statement nodes of the syntax tree

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

Constructor Summary
ForStatement(java.util.List<Node> init, Expression cond, java.util.List<Node> updt, Node body)
          Creates a new for statement
ForStatement(java.util.List<Node> init, Expression cond, java.util.List<Node> updt, Node body, SourceInfo si)
          Creates a new for statement
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 void addLabel(java.lang.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
 java.util.List<Node> getInitialization()
          Gets the initialization statements
 java.util.List<Node> getUpdate()
          Gets the update statements
 boolean hasLabel(java.lang.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
 void setInitialization(java.util.List<Node> l)
          Sets the initialization statements
 void setUpdate(java.util.List<Node> l)
          Sets the update statements
 java.lang.String toString()
           
 
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

ForStatement

public ForStatement(java.util.List<Node> init,
                    Expression cond,
                    java.util.List<Node> updt,
                    Node body)
Creates a new for statement

Parameters:
init - the initialization statements
cond - the condition to evaluate at each loop
updt - the update statements
body - the body
Throws:
java.lang.IllegalArgumentException - if body is null

ForStatement

public ForStatement(java.util.List<Node> init,
                    Expression cond,
                    java.util.List<Node> updt,
                    Node body,
                    SourceInfo si)
Creates a new for statement

Parameters:
init - the initialization statements (either Statements or declarations)
cond - the condition to evaluate at each loop
updt - the update statements (either Statements or declarations)
body - the body
Throws:
java.lang.IllegalArgumentException - if body is null
Method Detail

getInitialization

public java.util.List<Node> getInitialization()
Gets the initialization statements


setInitialization

public void setInitialization(java.util.List<Node> l)
Sets the initialization statements


getCondition

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


setCondition

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


getUpdate

public java.util.List<Node> getUpdate()
Gets the update statements


setUpdate

public void setUpdate(java.util.List<Node> l)
Sets the update statements


getBody

public Node getBody()
Returns the body of this statement


setBody

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

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

addLabel

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

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

hasLabel

public boolean hasLabel(java.lang.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object