First try for AST structure. A lot of things to change
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ElseIf.java
1 package net.sourceforge.phpdt.internal.compiler.ast;
2
3 /**
4  * @author Matthieu Casanova
5  */
6 public class ElseIf extends Statement {
7
8   public Expression condition;
9
10   public Statement[] statements;
11
12   public ElseIf(Expression condition, Statement[] statements, int sourceStart, int sourceEnd) {
13     super(sourceStart, sourceEnd);
14     this.condition = condition;
15     this.statements = statements;
16   }
17
18   /**
19    * Return the object into String.
20    * @param tab how many tabs (not used here
21    * @return a String
22    */
23   public String toString(int tab) {
24     final StringBuffer buff = new StringBuffer(tabString(tab));
25     buff.append("elseif (");
26     buff.append(condition.toStringExpression());
27     buff.append(") \n");
28     for (int i = 0; i < statements.length; i++) {
29       Statement statement = statements[i];
30       buff.append(statement.toString(tab+1)).append('\n');
31     }
32     return buff.toString();
33   }
34 }