koala.dynamicjava.tree
Class WhileStatement

java.lang.Object
  extended bykoala.dynamicjava.tree.Node
      extended bykoala.dynamicjava.tree.Statement
          extended bykoala.dynamicjava.tree.WhileStatement
All Implemented Interfaces:
ContinueTarget

public class WhileStatement
extends Statement
implements ContinueTarget

This class represents the while 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
 
Fields inherited from class koala.dynamicjava.tree.Node
BEGIN_COLUMN, BEGIN_LINE, END_COLUMN, END_LINE, FILENAME
 
Constructor Summary
WhileStatement(Expression cond, Node body)
          Creates a new while statement
WhileStatement(Expression cond, Node body, java.lang.String fn, int bl, int bc, int el, int ec)
          Creates a new while 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
 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
 
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

CONDITION

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

See Also:
Constant Field Values

BODY

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

See Also:
Constant Field Values
Constructor Detail

WhileStatement

public WhileStatement(Expression cond,
                      Node body)
Creates a new while statement

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

WhileStatement

public WhileStatement(Expression cond,
                      Node body,
                      java.lang.String fn,
                      int bl,
                      int bc,
                      int el,
                      int ec)
Creates a new while statement

Parameters:
cond - the condition to evaluate at each loop
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 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:
java.lang.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:
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

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


Copyright © 2001 Stephane Hillion. All Rights Reserved.