koala.dynamicjava.tree
Class ForStatement

java.lang.Object
  |
  +--koala.dynamicjava.tree.Node
        |
        +--koala.dynamicjava.tree.Statement
              |
              +--koala.dynamicjava.tree.ForStatement
All Implemented Interfaces:
ContinueTarget

public class ForStatement
extends Statement
implements ContinueTarget

This class represents the for statement nodes of the syntax tree


Field Summary
static java.lang.String BODY
          The body property name
static java.lang.String CONDITION
          The condition property name
static java.lang.String INITIALIZATION
          The initialization property name
static java.lang.String UPDATE
          The update property name
 
Fields inherited from class koala.dynamicjava.tree.Node
BEGIN_COLUMN, BEGIN_LINE, END_COLUMN, END_LINE, FILENAME
 
Constructor Summary
ForStatement(java.util.List init, Expression cond, java.util.List updt, Node body)
          Creates a new for statement
ForStatement(java.util.List init, Expression cond, java.util.List updt, Node body, java.lang.String fn, int bl, int bc, int el, int ec)
          Creates a new for statement
 
Method Summary
 java.lang.Object acceptVisitor(Visitor 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 getInitialization()
          Gets the initialization statements
 java.util.List 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 l)
          Sets the initialization statements
 void setUpdate(java.util.List l)
          Sets the update statements
 
Methods inherited from class koala.dynamicjava.tree.Node
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getFilename, getProperties, getProperty, hasProperty, removePropertyChangeListener, removePropertyChangeListener, setBeginColumn, setBeginLine, setEndColumn, setEndLine, setFilename, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIALIZATION

public static final java.lang.String INITIALIZATION
The initialization property name

CONDITION

public static final java.lang.String CONDITION
The condition property name

UPDATE

public static final java.lang.String UPDATE
The update property name

BODY

public static final java.lang.String BODY
The body property name
Constructor Detail

ForStatement

public ForStatement(java.util.List init,
                    Expression cond,
                    java.util.List 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 init,
                    Expression cond,
                    java.util.List updt,
                    Node body,
                    java.lang.String fn,
                    int bl,
                    int bc,
                    int el,
                    int ec)
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
fn - the filename
bl - the begin line
bc - the begin column
el - the end line
ec - the end column
Throws:
java.lang.IllegalArgumentException - if body is null
Method Detail

getInitialization

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

setInitialization

public void setInitialization(java.util.List 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 getUpdate()
Gets the update statements

setUpdate

public void setUpdate(java.util.List 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 java.lang.Object acceptVisitor(Visitor visitor)
Allows a visitor to traverse the tree
Overrides:
acceptVisitor in class Node
Parameters:
visitor - the visitor to accept


Copyright © 2001 Stephane Hillion. All Rights Reserved.