package net.sourceforge.phpdt.internal.compiler.ast;
-import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
-
import java.util.List;
-import java.util.ArrayList;
/**
* An elseif statement.
* @author Matthieu Casanova
*/
-public class ElseIf extends Statement {
+public final class ElseIf extends Statement {
/** The condition. */
- public Expression condition;
+ private final Expression condition;
/** The statements. */
- public Statement[] statements;
+ private final Statement[] statements;
public ElseIf(final Expression condition, final Statement[] statements, final int sourceStart, final int sourceEnd) {
super(sourceStart, sourceEnd);
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
+ *
+ * @param list the list where we will put variables
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
+ public void getOutsideVariable(final List list) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getModifiedVariable());
+ statements[i].getModifiedVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables modified
+ *
+ * @param list the list where we will put variables
*/
- public List getModifiedVariable() {
- final ArrayList list = new ArrayList();
+ public void getModifiedVariable(final List list) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getModifiedVariable());
+ statements[i].getModifiedVariable(list);
}
- list.addAll(condition.getModifiedVariable());
- return list;
+ condition.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
+ *
+ * @param list the list where we will put variables
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
+ public void getUsedVariable(final List list) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getUsedVariable());
+ statements[i].getUsedVariable(list);
}
- list.addAll(condition.getUsedVariable());
- return list;
+ condition.getUsedVariable(list);
}
}