1 package net.sourceforge.phpdt.internal.compiler.ast;
5 * @author Matthieu Casanova
7 public class WhileStatement extends Statement {
9 /** The condition expression. */
10 public Expression condition;
11 /** The action of the while. (it could be a block) */
12 public Statement action;
15 * Create a While statement.
16 * @param condition the condition
17 * @param action the action
18 * @param sourceStart the starting offset
19 * @param sourceEnd the ending offset
21 public WhileStatement(Expression condition,
25 super(sourceStart, sourceEnd);
26 this.condition = condition;
31 * Return the object into String.
32 * @param tab how many tabs (not used here
35 public String toString(int tab) {
36 final String s = tabString(tab);
37 final StringBuffer buff = new StringBuffer("while ("); //$NON-NLS-1$
38 buff.append(condition.toStringExpression()).append(")"); //$NON-NLS-1$
40 buff.append(" {} ;"); //$NON-NLS-1$
42 buff.append("\n").append(action.toString(tab + 1)); //$NON-NLS-1$
44 return buff.toString();