3.x RC1 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ForStatement.java
index 689a737..b11d6f0 100644 (file)
@@ -1,27 +1,27 @@
 package net.sourceforge.phpdt.internal.compiler.ast;
 
 import java.util.List;
-import java.util.ArrayList;
 
 /**
  * A For statement.
  * for(initializations;condition;increments) action
  * @author Matthieu Casanova
  */
-public class ForStatement extends Statement {
+public final class ForStatement extends Statement {
 
   /** the initializations. */
-  public Expression[] initializations;
+  private final Expression[] initializations;
 
   /** the condition. */
-  public Expression condition;
+  private final Expression condition;
   /** the increments. */
-  public Expression[] increments;
+  private final Expression[] increments;
 
-  public Statement action;
+  private final Statement action;
 
   /**
-   * a for statement
+   * a for statement.
+   *
    * @param initializations the initializations expressions
    * @param condition the condition when the for get out
    * @param increments the increments statements
@@ -79,76 +79,73 @@ public class ForStatement extends Statement {
 
   /**
    * Get the variables from outside (parameters, globals ...)
-   * @return the variables from outside
+   *
+   * @param list the list where we will put variables
    */
-  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
+   *
+   * @param list the list where we will put variables
    */
-  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
+   *
+   * @param list the list where we will put variables
    */
-  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;
   }
 }