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