1 package net.sourceforge.phpdt.internal.compiler.ast;
4 * @author Matthieu Casanova
6 public class IfStatement extends Statement {
8 public Expression condition;
9 public Statement statement;
10 public ElseIf[] elseifs;
14 * Create a new If statement
15 * @param condition the condition
16 * @param statement a statement or a block of statements
17 * @param elseifs the elseifs
18 * @param els the else (or null)
19 * @param sourceStart the starting position
20 * @param sourceEnd the ending offset
22 public IfStatement(Expression condition,
28 super(sourceStart, sourceEnd);
29 this.condition = condition;
30 this.statement = statement;
31 this.elseifs = elseifs;
36 * Return the object into String.
37 * @param tab how many tabs (not used here
40 public String toString(int tab) {
41 final StringBuffer buff = new StringBuffer(tabString(tab));
43 buff.append(condition.toStringExpression()).append(") ");
44 for (int i = 0; i < elseifs.length; i++) {
45 ElseIf elseif = elseifs[i];
46 buff.append(elseif.toString(tab+1));
50 buff.append(els.toString(tab+1));
53 return buff.toString();