package net.sourceforge.phpdt.internal.compiler.ast;
-import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
-
import java.util.List;
-import java.util.ArrayList;
/**
* @author Matthieu Casanova
*/
-public class SwitchStatement extends Statement {
+public final class SwitchStatement extends Statement {
- public Expression variable;
- public AbstractCase[] cases;
+ private final Expression variable;
+ private final AbstractCase[] cases;
public SwitchStatement(final Expression variable,
final AbstractCase[] cases,
/**
* 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 < cases.length; i++) {
- list.addAll(cases[i].getOutsideVariable());
+ cases[i].getOutsideVariable(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 < cases.length; i++) {
- list.addAll(cases[i].getModifiedVariable());
+ cases[i].getModifiedVariable(list);
}
- list.addAll(variable.getModifiedVariable());
- return list;
+ variable.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 < cases.length; i++) {
- list.addAll(cases[i].getUsedVariable());
+ cases[i].getUsedVariable(list);
}
- list.addAll(variable.getUsedVariable());
- return list;
+ variable.getUsedVariable(list);
}
}