/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- 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].getOutsideVariable());
+ statements[i].getOutsideVariable(list);
}
- return 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 < statements.length; i++) {
- list.addAll(statements[i].getModifiedVariable());
+ statements[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 < statements.length; i++) {
- list.addAll(statements[i].getUsedVariable());
+ statements[i].getUsedVariable(list);
}
- return list;
}
}
* Get the variables from outside (parameters, globals ...)
* @return an empty list
*/
- public List getOutsideVariable() {
- return new ArrayList();
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
* @return an empty list
*/
- public List getModifiedVariable() {
- return new ArrayList();
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
* @return an empty list
*/
- public List getUsedVariable() {
- return new ArrayList();
+ public void getUsedVariable(final List list) {
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final List list = prefix.getModifiedVariable();
+ public void getModifiedVariable(final List list) {
+ prefix.getModifiedVariable(list);
if (var != null) {
- list.addAll(var.getModifiedVariable());
+ var.getModifiedVariable(list);
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final List list = prefix.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ prefix.getUsedVariable(list);
if (var != null) {
- list.addAll(var.getUsedVariable());
+ var.getUsedVariable(list);
}
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ 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++) {
if (vars[i] != null) {
- list.addAll(vars[i].getModifiedVariable());
+ 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++) {
if (vars[i] != null) {
- list.addAll(vars[i].getUsedVariable());
+ vars[i].getUsedVariable(list);
}
}
- return list;
}
}
/**
* 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());
+ public void getModifiedVariable(final List list) {
+ key.getModifiedVariable(list);
if (value != null) {
- list.addAll(value.getModifiedVariable());
+ value.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) {
+ key.getUsedVariable(list);
if (value != null) {
- list.addAll(value.getUsedVariable());
+ value.getUsedVariable(list);
}
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public abstract List getOutsideVariable();
+ public abstract void getOutsideVariable(List list);
/**
* get the modified variables.
- * @return the variables modified
*/
- public abstract List getModifiedVariable();
+ public abstract void getModifiedVariable(List list);
/**
* Get the variables used.
- * @return the variables used
*/
- public abstract List getUsedVariable();
+ public abstract void getUsedVariable(List list);
/**
* This method will analyze the code.
/**
* 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(left.getModifiedVariable());
- list.addAll(right.getModifiedVariable());
- return list;
+ public void getModifiedVariable(final List list) {
+ left.getModifiedVariable(list);
+ right.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(left.getUsedVariable());
- list.addAll(right.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ left.getUsedVariable(list);
+ right.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- 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].getOutsideVariable());
+ statements[i].getOutsideVariable(list);
}
- return 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 < statements.length; i++) {
- list.addAll(statements[i].getModifiedVariable());
+ statements[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 < statements.length; i++) {
- list.addAll(statements[i].getUsedVariable());
+ statements[i].getUsedVariable(list);
}
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- if (expression == null) {
- return new ArrayList();
+ public void getOutsideVariable(final List list) {
+ if (expression != null) {
+ expression.getOutsideVariable(list);
}
- return expression.getOutsideVariable();
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- if (expression == null) {
- return new ArrayList();
+ public void getModifiedVariable(final List list) {
+ if (expression != null) {
+ expression.getModifiedVariable(list);
}
- return expression.getModifiedVariable();
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- if (expression == null) {
- return new ArrayList();
+ public void getUsedVariable(final List list) {
+ if (expression != null) {
+ expression.getUsedVariable(list);
}
- return expression.getUsedVariable();
}
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final List list = super.getModifiedVariable();
- list.addAll(value.getModifiedVariable());
- return list;
+ public void getModifiedVariable(final List list) {
+ super.getModifiedVariable(list);
+ value.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final List list = super.getUsedVariable();
- list.addAll(value.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ super.getUsedVariable(list);
+ value.getUsedVariable(list);
}
}
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() {
- return expression.getModifiedVariable();
+ public void getModifiedVariable(final List list) {
+ expression.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return expression.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ expression.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final List list = prefix.getUsedVariable();
- list.addAll(suffix.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ prefix.getUsedVariable(list);
+ suffix.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
}
/**
* 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(condition.getModifiedVariable());
- list.addAll(valueIfTrue.getModifiedVariable());
- list.addAll(valueIfFalse.getModifiedVariable());
- return list;
+ public void getModifiedVariable(final List list) {
+ condition.getModifiedVariable(list);
+ valueIfTrue.getModifiedVariable(list);
+ valueIfFalse.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getUsedVariable());
- list.addAll(valueIfTrue.getUsedVariable());
- list.addAll(valueIfFalse.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ condition.getUsedVariable(list);
+ valueIfTrue.getUsedVariable(list);
+ valueIfFalse.getUsedVariable(list);
}
}
return name;
}
- /**
+ /**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList(1);
+ public void getOutsideVariable(final List list) {
list.add(new VariableUsage(defineName.toStringExpression(),sourceStart));//todo: someday : evaluate the defineName
- return list;
}
/**
* get the modified variables.
- * @return the variables modified
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getOutsideVariable()); // todo: check if unuseful
- list.addAll(action.getOutsideVariable());
- return list;
+ public void getOutsideVariable(final List list) {
+ condition.getOutsideVariable(list); // todo: check if unuseful
+ action.getOutsideVariable(list);
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getModifiedVariable());
- list.addAll(action.getModifiedVariable());
- return list;
+ public void getModifiedVariable(final List list) {
+ condition.getModifiedVariable(list);
+ action.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getUsedVariable());
- list.addAll(action.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ condition.getUsedVariable(list);
+ action.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
+ public void getOutsideVariable(final List list) {
for (int i = 0; i < expressions.length; i++) {
- list.addAll(expressions[i].getOutsideVariable());
+ expressions[i].getOutsideVariable(list);
}
- return 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 < expressions.length; i++) {
- list.addAll(expressions[i].getModifiedVariable());
+ expressions[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 < expressions.length; i++) {
- list.addAll(expressions[i].getUsedVariable());
+ expressions[i].getUsedVariable(list);
}
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- 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].getOutsideVariable());
+ statements[i].getOutsideVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables from outside
*/
- 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 from outside
*/
- 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;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- 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
*/
- 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
*/
- 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);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return an empty list
*/
- public List getOutsideVariable() {
- return new ArrayList();
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return an empty list
*/
- public List getModifiedVariable() {
- return new ArrayList();
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return an empty list
*/
- public List getUsedVariable() {
- return new ArrayList();
+ public void getUsedVariable(final List list) {
}
}
private Object parent;
private Position position;
+
/**
* Create a new field.
* @param vars the array of variables.
* @return the image that represents a php variable
*/
public ImageDescriptor getImage() {
- return PHPUiImages.DESC_VAR;
+ return PHPUiImages.DESC_VAR;
}
public Object getParent() {
return position;
}
- /**
+ /**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
+ public void getOutsideVariable(final List list) {
if (condition != null) {
- list.addAll(condition.getOutsideVariable());
+ condition.getOutsideVariable(list);
}
if (action != null) {
- list.addAll(action.getOutsideVariable());
+ action.getOutsideVariable(list);
}
if (initializations != null) {
for (int i = 0; i < initializations.length; i++) {
- list.addAll(initializations[i].getOutsideVariable());
+ initializations[i].getOutsideVariable(list);
}
}
if (increments != null) {
for (int i = 0; i < increments.length; i++) {
- list.addAll(increments[i].getOutsideVariable());
+ increments[i].getOutsideVariable(list);
}
}
- return 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) {
if (condition != null) {
- list.addAll(condition.getModifiedVariable());
+ condition.getModifiedVariable(list);
}
if (action != null) {
- list.addAll(action.getModifiedVariable());
+ action.getModifiedVariable(list);
}
if (initializations != null) {
for (int i = 0; i < initializations.length; i++) {
- list.addAll(initializations[i].getModifiedVariable());
+ initializations[i].getModifiedVariable(list);
}
}
if (increments != null) {
for (int i = 0; i < increments.length; i++) {
- list.addAll(increments[i].getModifiedVariable());
+ increments[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) {
if (condition != null) {
- list.addAll(condition.getUsedVariable());
+ condition.getUsedVariable(list);
}
if (action != null) {
- list.addAll(action.getUsedVariable());
+ action.getUsedVariable(list);
}
if (initializations != null) {
for (int i = 0; i < initializations.length; i++) {
- list.addAll(initializations[i].getUsedVariable());
+ initializations[i].getUsedVariable(list);
}
}
if (increments != null) {
for (int i = 0; i < increments.length; i++) {
- list.addAll(increments[i].getUsedVariable());
+ increments[i].getUsedVariable(list);
}
}
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(expression.getOutsideVariable());
- list.addAll(variable.getOutsideVariable());
- list.addAll(statement.getOutsideVariable());
- return list;
+ public void getOutsideVariable(final List list) {
+ expression.getOutsideVariable(list);
+ variable.getOutsideVariable(list);
+ statement.getOutsideVariable(list);
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(expression.getModifiedVariable());
- list.addAll(variable.getModifiedVariable());
- list.addAll(statement.getModifiedVariable());
- return list;
+ public void getModifiedVariable(final List list) {
+ expression.getModifiedVariable(list);
+ variable.getUsedVariable(list);
+ statement.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(expression.getUsedVariable());
- list.addAll(statement.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ expression.getUsedVariable(list);
+ statement.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- if (args == null) {
- return new ArrayList(1);
- }
- final ArrayList list = new ArrayList();
- for (int i = 0; i < args.length; i++) {
- list.addAll(args[i].getModifiedVariable());
+ public void getModifiedVariable(final List list) {
+ if (args != null) {
+ for (int i = 0; i < args.length; i++) {
+ args[i].getModifiedVariable(list);
+ }
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final List list = functionName.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ functionName.getUsedVariable(list);
if (args != null) {
for (int i = 0; i < args.length; i++) {
- list.addAll(args[i].getUsedVariable());
+ args[i].getUsedVariable(list);
}
}
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList(variables.length);
+ public void getOutsideVariable(final List list) {
for (int i = 0; i < variables.length; i++) {
- list.addAll(variables[i].getUsedVariable());
+ variables[i].getUsedVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables modified
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
/**
/**
* Get the variables from outside (parameters, globals ...)
- * @return an empty list
*/
- public List getOutsideVariable() {
- return new ArrayList();
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return an empty list
*/
- public List getModifiedVariable() {
- return new ArrayList();
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return an empty list
*/
- public List getUsedVariable() {
- return new ArrayList();
+ public void getUsedVariable(final List list) {
}
}
package net.sourceforge.phpdt.internal.compiler.ast;
import java.util.List;
-import java.util.ArrayList;
/**
* Get the variables from outside (parameters, globals ...)
* @return an empty list
*/
- public List getOutsideVariable() {
- return new ArrayList();
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
* @return an empty list
*/
- public List getModifiedVariable() {
- return new ArrayList();
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
* @return an empty list
*/
- public List getUsedVariable() {
- return new ArrayList();
+ public void getUsedVariable(final List list) {
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getOutsideVariable()); // todo: check if unuseful
+ public void getOutsideVariable(final List list) {
+ condition.getOutsideVariable(list); // todo: check if unuseful
if (statement != null) {
- list.addAll(statement.getOutsideVariable());
+ statement.getOutsideVariable(list);
}
for (int i = 0; i < elseifs.length; i++) {
- list.addAll(elseifs[i].getOutsideVariable());
+ elseifs[i].getOutsideVariable(list);
}
if (els != null) {
- list.addAll(els.getOutsideVariable());
+ els.getOutsideVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getModifiedVariable());
+ public void getModifiedVariable(final List list) {
+ condition.getModifiedVariable(list);
if (statement != null) {
- list.addAll(statement.getModifiedVariable());
+ statement.getModifiedVariable(list);
}
for (int i = 0; i < elseifs.length; i++) {
- list.addAll(elseifs[i].getModifiedVariable());
+ elseifs[i].getModifiedVariable(list);
}
if (els != null) {
- list.addAll(els.getModifiedVariable());
+ els.getModifiedVariable(list);
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getUsedVariable());
+ public void getUsedVariable(final List list) {
+ condition.getUsedVariable(list);
if (statement != null) {
- list.addAll(statement.getUsedVariable());
+ statement.getUsedVariable(list);
}
for (int i = 0; i < elseifs.length; i++) {
- list.addAll(elseifs[i].getUsedVariable());
+ elseifs[i].getUsedVariable(list);
}
if (els != null) {
- list.addAll(els.getUsedVariable());
+ els.getUsedVariable(list);
}
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return expression.getOutsideVariable();
+ public void getOutsideVariable(final List list) {
+ expression.getOutsideVariable(list);
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- return expression.getModifiedVariable();
+ public void getModifiedVariable(final List list) {
+ expression.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return expression.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ expression.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return statement.getOutsideVariable();
+ public void getOutsideVariable(final List list) {
+ statement.getOutsideVariable(list);
}
/**
* get the modified variables.
- * @return the variables modified
*/
- public List getModifiedVariable() {
- return statement.getModifiedVariable();
+ public void getModifiedVariable(final List list) {
+ statement.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return statement.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ statement.getUsedVariable(list);
}
}
return buff.toString();
}
- /**
+ /**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ 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++) {
if (vars[i] != null) {
- list.addAll(vars[i].getUsedVariable());
+ vars[i].getUsedVariable(list);
}
}
if (expression != null) {
- list.addAll(expression.getModifiedVariable());
+ expression.getModifiedVariable(list);
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- if (expression == null) {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
+ if (expression != null) {
+ expression.getUsedVariable(list);
}
- return expression.getUsedVariable();
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return an empty list
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return an empty list
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return an empty list
*/
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
}
}
/** no outside variables. */
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
/**
* Get global variables (not parameters).
- * @return the variables from outside
*/
- public List getGlobalVariable() {
- final ArrayList list = new ArrayList();
-
+ public void getGlobalVariable(final List list) {
if (statements != null) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getOutsideVariable());
+ statements[i].getOutsideVariable(list);
}
}
- return list;
}
- private List getParameters(final List list) {
+ private void getParameters(final List list) {
if (arguments != null) {
final Enumeration vars = arguments.elements();
while (vars.hasMoreElements()) {
list.add(new VariableUsage(variable.name(), variable.sourceStart));
}
}
- return list;
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- private List getAssignedVariableInCode() {
- final ArrayList list = new ArrayList();
+ private void getAssignedVariableInCode(final List list) {
if (statements != null) {
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
*/
- private List getUsedVariableInCode() {
- final ArrayList list = new ArrayList();
+ private void getUsedVariableInCode(final List list) {
if (statements != null) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getUsedVariable());
+ statements[i].getUsedVariable(list);
}
}
- return list;
}
private boolean isVariableDeclaredBefore(final List list, final VariableUsage var) {
}
}
- final List globalsVars = getGlobalVariable();
- final List modifiedVars = getAssignedVariableInCode();
- final List parameters = getParameters(new ArrayList());
+ final List globalsVars = new ArrayList();
+ getGlobalVariable(globalsVars);
+ final List modifiedVars = new ArrayList();
+ getAssignedVariableInCode(modifiedVars);
+ final List parameters = new ArrayList();
+ getParameters(parameters);
final List declaredVars = new ArrayList(globalsVars.size() + modifiedVars.size());
declaredVars.addAll(globalsVars);
declaredVars.addAll(modifiedVars);
declaredVars.addAll(parameters);
- final List usedVars = getUsedVariableInCode();
- final List readOrWriteVars = new ArrayList(modifiedVars.size()+usedVars.size());
+ final List usedVars = new ArrayList();
+ getUsedVariableInCode(usedVars);
+ final List readOrWriteVars = new ArrayList(modifiedVars.size() + usedVars.size());
readOrWriteVars.addAll(modifiedVars);
readOrWriteVars.addAll(usedVars);
//look for used variables that were not declared before
- findUnusedParameters(readOrWriteVars,parameters);
+ findUnusedParameters(readOrWriteVars, parameters);
findUnknownUsedVars(usedVars, declaredVars);
}
*/
private void findUnusedParameters(final List vars, final List parameters) {
for (int i = 0; i < parameters.size(); i++) {
- final VariableUsage param = ((VariableUsage)parameters.get(i));
- if (!isVariableInList(param.getName(),vars)) {
+ final VariableUsage param = ((VariableUsage) parameters.get(i));
+ if (!isVariableInList(param.getName(), vars)) {
try {
- PHPParserSuperclass.setMarker("warning, the parameter "+param.getName() +" seems to be never used in your method",
- param.getStartOffset(),
- param.getStartOffset() + param.getName().length(),
- PHPParserSuperclass.WARNING,
- "");
+ PHPParserSuperclass.setMarker(
+ "warning, the parameter " + param.getName() + " seems to be never used in your method",
+ param.getStartOffset(),
+ param.getStartOffset() + param.getName().length(),
+ PHPParserSuperclass.WARNING,
+ "");
} catch (CoreException e) {
PHPeclipsePlugin.log(e);
}
if (variableUsage.getName().equals("this")) continue; // this is a special variable
if (!isVariableDeclaredBefore(declaredVars, variableUsage)) {
try {
- PHPParserSuperclass.setMarker("warning, usage of a variable that seems to be unassigned yet : " + variableUsage.getName(),
- variableUsage.getStartOffset(),
- variableUsage.getStartOffset() + variableUsage.getName().length(),
- PHPParserSuperclass.WARNING,
- "");
+ PHPParserSuperclass.setMarker(
+ "warning, usage of a variable that seems to be unassigned yet : " + variableUsage.getName(),
+ variableUsage.getStartOffset(),
+ variableUsage.getStartOffset() + variableUsage.getName().length(),
+ PHPParserSuperclass.WARNING,
+ "");
} catch (CoreException e) {
PHPeclipsePlugin.log(e);
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return an empty list
*/
- public List getOutsideVariable() {
- return new ArrayList();
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return an empty list
*/
- public List getModifiedVariable() {
- return new ArrayList();
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the used variables are the used variables from the expression
*/
- public List getUsedVariable() {
- return expr.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ expr.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return expression.getOutsideVariable();
+ public void getOutsideVariable(final List list) {
+ expression.getOutsideVariable(list);
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- return expression.getModifiedVariable();
+ public void getModifiedVariable(final List list) {
+ expression.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return expression.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ expression.getUsedVariable(list);
}
}
/**
* 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 modified
*/
- public List getModifiedVariable() {
- if (expression == null) {
- return new ArrayList();
+ public void getModifiedVariable(final List list) {
+ if (expression != null) {
+ expression.getModifiedVariable(list);
}
- return expression.getModifiedVariable();
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- if (expression == null) {
- return new ArrayList();
+ public void getUsedVariable(final List list) {
+ if (expression != null) {
+ expression.getUsedVariable(list);
}
- return expression.getUsedVariable();
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
+ public void getOutsideVariable(final List list) {
for (int i = 0; i < variables.length; i++) {
- list.addAll(variables[i].getModifiedVariable());
+ variables[i].getModifiedVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables modified
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return new ArrayList(1);
+ public void getUsedVariable(final List list) {
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- 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
*/
- 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
*/
- 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);
}
}
/**
* 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() {
- return expression.getModifiedVariable();
+ public void getModifiedVariable(final List list) {
+ expression.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- return expression.getUsedVariable();
+ public void getUsedVariable(final List list) {
+ expression.getUsedVariable(list);
}
}
}
- /**
+ /**
* 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(variableName.getUsedVariable());
- list.addAll(initializer.getModifiedVariable());
- return list;
+ public void getModifiedVariable(final List list) {
+ variableName.getUsedVariable(list);
+ initializer.getModifiedVariable(list);
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(initializer.getUsedVariable());
- return list;
+ public void getUsedVariable(final List list) {
+ initializer.getUsedVariable(list);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables modified
*/
- public List getModifiedVariable() {
- return new ArrayList(1);
+ public void getModifiedVariable(final List list) {
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
+ public void getUsedVariable(final List list) {
final String varName;
if (name != null) {
varName = name;
} else {
varName = expression.toStringExpression();//todo : do a better thing like evaluate this ??
}
- if (arrayContains(SPECIAL_VARS, name)) {
- return new ArrayList(1);
+ if (!arrayContains(SPECIAL_VARS, name)) {
+ list.add(new VariableUsage(varName, sourceStart));
}
- final ArrayList list = new ArrayList(1);
- list.add(new VariableUsage(varName, sourceStart));
- return list;
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- return new ArrayList(1);
+ public void getOutsideVariable(final List list) {
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final List list = variable.getUsedVariable();
+ public void getModifiedVariable(final List list) {
+ variable.getUsedVariable(list);
if (initialization != null) {
- list.addAll(initialization.getModifiedVariable());
+ initialization.getModifiedVariable(list);
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
+ public void getUsedVariable(final List list) {
if (initialization != null) {
- return initialization.getUsedVariable();
+ initialization.getUsedVariable(list);
}
- return new ArrayList(1);
}
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getOutsideVariable()); // todo: check if unuseful
+ public void getOutsideVariable(final List list) {
+ condition.getOutsideVariable(list); // todo: check if unuseful
if (action != null) {
- list.addAll(action.getOutsideVariable());
+ action.getOutsideVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables from we change value
*/
- public List getModifiedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getModifiedVariable());
+ public void getModifiedVariable(final List list) {
+ condition.getModifiedVariable(list);
if (action != null) {
- list.addAll(action.getModifiedVariable());
+ action.getModifiedVariable(list);
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
- list.addAll(condition.getUsedVariable());
+ public void getUsedVariable(final List list) {
+ condition.getUsedVariable(list);
if (action != null) {
- list.addAll(action.getUsedVariable());
+ action.getUsedVariable(list);
}
- return list;
}
}