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 ...)
45 * @return the variables from outside
47 public List getOutsideVariable() {
48 final ArrayList list = new ArrayList();
49 for (int i = 0; i < statements.length; i++) {
50 list.addAll(statements[i].getModifiedVariable());
56 * get the modified variables.
57 * @return the variables modified
59 public List getModifiedVariable() {
60 final ArrayList list = new ArrayList();
61 for (int i = 0; i < statements.length; i++) {
62 list.addAll(statements[i].getModifiedVariable());
64 list.addAll(condition.getModifiedVariable());
69 * Get the variables used.
70 * @return the variables used
72 public List getUsedVariable() {
73 final ArrayList list = new ArrayList();
74 for (int i = 0; i < statements.length; i++) {
75 list.addAll(statements[i].getUsedVariable());
77 list.addAll(condition.getUsedVariable());