new version with WorkingCopy Management
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / IfStatement.java
index cb6c88b..bb2e3a0 100644 (file)
@@ -1,7 +1,6 @@
 package net.sourceforge.phpdt.internal.compiler.ast;
 
 import java.util.List;
-import java.util.ArrayList;
 
 /**
  * This is a if statement.
@@ -11,12 +10,12 @@ import java.util.ArrayList;
  * else statement
  * @author Matthieu Casanova
  */
-public class IfStatement extends Statement {
+public final class IfStatement extends Statement {
 
-  public Expression condition;
-  public Statement statement;
-  public ElseIf[] elseifs;
-  public Else els;
+  private final Expression condition;
+  private final Statement statement;
+  private final ElseIf[] elseifs;
+  private final Else els;
 
   /**
    * Create a new If statement.
@@ -65,58 +64,55 @@ public class IfStatement 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();
-    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
+   *
+   * @param list the list where we will put variables
    */
-  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
+   *
+   * @param list the list where we will put variables
    */
-  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;
   }
 }