1 package net.sourceforge.phpdt.internal.compiler.ast;
7 * @author Matthieu Casanova
9 public class ElseIf extends Statement {
12 public Expression condition;
14 /** The statements. */
15 public 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 public void getOutsideVariable(final List list) {
44 for (int i = 0; i < statements.length; i++) {
45 statements[i].getModifiedVariable(list);
50 * get the modified variables.
52 public void getModifiedVariable(final List list) {
53 for (int i = 0; i < statements.length; i++) {
54 statements[i].getModifiedVariable(list);
56 condition.getModifiedVariable(list);
60 * Get the variables used.
62 public void getUsedVariable(final List list) {
63 for (int i = 0; i < statements.length; i++) {
64 statements[i].getUsedVariable(list);
66 condition.getUsedVariable(list);