1 package net.sourceforge.phpdt.internal.compiler.ast;
3 import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
6 import java.util.ArrayList;
10 * @author Matthieu Casanova
12 public class ElseIf extends Statement {
15 public Expression condition;
17 /** The statements. */
18 public Statement[] statements;
20 public ElseIf(final Expression condition, final Statement[] statements, final int sourceStart, final int sourceEnd) {
21 super(sourceStart, sourceEnd);
22 this.condition = condition;
23 this.statements = statements;
27 * Return the object into String.
28 * @param tab how many tabs (not used here
31 public String toString(final int tab) {
32 final StringBuffer buff = new StringBuffer(tabString(tab));
33 buff.append("elseif (");
34 buff.append(condition.toStringExpression());
36 for (int i = 0; i < statements.length; i++) {
37 final Statement statement = statements[i];
38 buff.append(statement.toString(tab + 1)).append('\n');
40 return buff.toString();
44 * Get the variables from outside (parameters, globals ...)
46 public void getOutsideVariable(final List list) {
47 for (int i = 0; i < statements.length; i++) {
48 statements[i].getModifiedVariable(list);
53 * get the modified variables.
55 public void getModifiedVariable(final List list) {
56 for (int i = 0; i < statements.length; i++) {
57 statements[i].getModifiedVariable(list);
59 condition.getModifiedVariable(list);
63 * Get the variables used.
65 public void getUsedVariable(final List list) {
66 for (int i = 0; i < statements.length; i++) {
67 statements[i].getUsedVariable(list);
69 condition.getUsedVariable(list);