1 package net.sourceforge.phpdt.internal.compiler.ast;
7 * @author Matthieu Casanova
9 public final class ElseIf extends Statement {
12 private final Expression condition;
14 /** The statements. */
15 private final Statement[] statements;
17 public ElseIf(final Expression condition, final Statement[] statements, final int sourceStart, final int sourceEnd) {
18 super(sourceStart, sourceEnd);
19 this.condition = condition;
20 this.statements = statements;
24 * Return the object into String.
25 * @param tab how many tabs (not used here
28 public String toString(final int tab) {
29 final StringBuffer buff = new StringBuffer(tabString(tab));
30 buff.append("elseif (");
31 buff.append(condition.toStringExpression());
33 for (int i = 0; i < statements.length; i++) {
34 final Statement statement = statements[i];
35 buff.append(statement.toString(tab + 1)).append('\n');
37 return buff.toString();
41 * Get the variables from outside (parameters, globals ...)
43 * @param list the list where we will put variables
45 public void getOutsideVariable(final List list) {
46 for (int i = 0; i < statements.length; i++) {
47 statements[i].getModifiedVariable(list);
52 * get the modified variables.
54 * @param list the list where we will put variables
56 public void getModifiedVariable(final List list) {
57 for (int i = 0; i < statements.length; i++) {
58 statements[i].getModifiedVariable(list);
60 condition.getModifiedVariable(list);
64 * Get the variables used.
66 * @param list the list where we will put variables
68 public void getUsedVariable(final List list) {
69 for (int i = 0; i < statements.length; i++) {
70 statements[i].getUsedVariable(list);
72 condition.getUsedVariable(list);