package net.sourceforge.phpdt.internal.compiler.ast;
import java.util.List;
-import java.util.ArrayList;
/**
- * This variable declaration do not extend AbstractVariableDeclaration because
+ * a variable declaration in an array().
* it could take Expression as key.
* @author Matthieu Casanova
*/
public class ArrayVariableDeclaration extends Expression {
- public Expression key,value;
+ /** the array key. */
+ public Expression key;
- public ArrayVariableDeclaration(final Expression key,final Expression value) {
+ /** the array value. */
+ public Expression value;
+
+ /**
+ * Create a new array variable declaration.
+ * @param key the key
+ * @param value the value
+ */
+ public ArrayVariableDeclaration(final Expression key, final Expression value) {
super(key.sourceStart, value.sourceEnd);
this.key = key;
this.value = value;
}
- public ArrayVariableDeclaration(final Expression key,final int sourceEnd) {
+ /**
+ * Create a new array variable declaration.
+ * @param key the key
+ * @param sourceEnd the end position
+ */
+ public ArrayVariableDeclaration(final Expression key, final int sourceEnd) {
super(key.sourceStart, sourceEnd);
this.key = key;
}
+
/**
* Return the expression as String.
* @return the expression
}
-
- /**
+ /**
* 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();
- list.addAll(key.getModifiedVariable());
- list.addAll(value.getModifiedVariable());
- return list;
+ public void getModifiedVariable(final List list) {
+ key.getModifiedVariable(list);
+ if (value != null) {
+ value.getModifiedVariable(list);
+ }
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(value.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ key.getUsedVariable(list);
+ if (value != null) {
+ value.getUsedVariable(list);
+ }
}
}