import java.util.ArrayList;
/**
+ * an array initializer.
+ * array('a','b','c') or array('a' => 2,'b' = '3');
* @author Matthieu Casanova
*/
public class ArrayInitializer extends Expression {
public String toStringExpression() {
final StringBuffer buff = new StringBuffer("array(");
for (int i = 0; i < vars.length; i++) {
- final ArrayVariableDeclaration var = vars[i];
if (i != 0) {
buff.append(",");
}
- buff.append(var.toStringExpression());
+ if (vars[i] != null) {
+ buff.append(vars[i].toStringExpression());
+ }
}
buff.append(")");
return buff.toString();
}
- /**
+ /**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList();
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final ArrayList list = new ArrayList();
+ public void getModifiedVariable(final List list) {
for (int i = 0; i < vars.length; i++) {
- list.addAll(vars[i].getModifiedVariable());
+ if (vars[i] != null) {
+ vars[i].getModifiedVariable(list);
+ }
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
+ public void getUsedVariable(final List list) {
for (int i = 0; i < vars.length; i++) {
- list.addAll(vars[i].getUsedVariable());
+ if (vars[i] != null) {
+ vars[i].getUsedVariable(list);
+ }
}
- return list;
}
}