1 package net.sourceforge.phpdt.internal.compiler.ast;
4 import java.util.ArrayList;
7 * @author Matthieu Casanova
9 public class ForeachStatement extends Statement {
11 public Expression expression;
12 public Expression variable;
13 public Statement statement;
15 public ForeachStatement(final Expression expression,
16 final Expression variable,
17 final Statement statement,
18 final int sourceStart,
19 final int sourceEnd) {
20 super(sourceStart, sourceEnd);
21 this.expression = expression;
22 this.variable = variable;
23 this.statement = statement;
27 * Return the object into String.
28 * @param tab how many tabs (not used here
31 public String toString(final int tab) {
32 final StringBuffer buff = new StringBuffer(tabString(tab));
33 buff.append("foreach (");
34 buff.append(expression.toStringExpression());
36 buff.append(variable.toStringExpression());
38 buff.append(statement.toString(tab+1));
40 return buff.toString();
44 * Get the variables from outside (parameters, globals ...)
46 public void getOutsideVariable(final List list) {
47 expression.getOutsideVariable(list);
48 variable.getOutsideVariable(list);
49 statement.getOutsideVariable(list);
53 * get the modified variables.
55 public void getModifiedVariable(final List list) {
56 expression.getModifiedVariable(list);
57 variable.getUsedVariable(list);
58 statement.getModifiedVariable(list);
62 * Get the variables used.
64 public void getUsedVariable(final List list) {
65 expression.getUsedVariable(list);
66 statement.getUsedVariable(list);