package net.sourceforge.phpdt.internal.compiler.ast;
import java.util.List;
-import java.util.ArrayList;
/**
* Superclass of case statement that we can find in a switch.
public abstract class AbstractCase extends Statement {
/** The statements in the case. */
- public Statement[] statements;
+ public final Statement[] statements;
/**
- * Create a case statement
+ * Create a case statement.
* @param statements the statements array
* @param sourceStart the beginning source offset
* @param sourceEnd the ending offset
*/
- public AbstractCase(final Statement[] statements,
- final int sourceStart,
- final int sourceEnd) {
+ protected AbstractCase(final Statement[] statements,
+ final int sourceStart,
+ final int sourceEnd) {
super(sourceStart, sourceEnd);
this.statements = statements;
}
/**
- * Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
+ * Get the variables from outside (parameters, globals ...).
+ * @param list the list where we will put variables
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
+ public final void getOutsideVariable(final List list) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getOutsideVariable());
+ statements[i].getOutsideVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables from we change value
+ * @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);
}
- return 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);
}
- return list;
}
}