Some minor changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / AstNode.java
index 2f0fe2d..4d3aec2 100644 (file)
@@ -9,16 +9,16 @@ import java.util.List;
 public abstract class AstNode {
 
   /** Starting and ending position of the node in the sources. */
-  private int sourceStart, sourceEnd;
+  public int sourceStart, sourceEnd;
 
   /**
-   * Create a node giving starting and ending offset
+   * Create a node giving starting and ending offset.
    * @param sourceStart starting offset
    * @param sourceEnd ending offset
    */
-  public AstNode(final int sourceStart, final int sourceEnd) {
-    this.setSourceStart(sourceStart);
-    this.setSourceEnd(sourceEnd);
+  protected AstNode(final int sourceStart, final int sourceEnd) {
+    this.sourceStart = sourceStart;
+    this.sourceEnd = sourceEnd;
   }
 
   /**
@@ -52,35 +52,40 @@ public abstract class AstNode {
 
   /**
    * Get the variables from outside (parameters, globals ...)
-   * @return the variables from outside
+   * @param list the list where we will put variables
    */
-  public abstract List getOutsideVariable();
+  public abstract void getOutsideVariable(List list);
 
   /**
    * get the modified variables.
-   * @return the variables modified
+   * @param list the list where we will put variables
    */
-  public abstract List getModifiedVariable();
+  public abstract void getModifiedVariable(List list);
 
   /**
    * Get the variables used.
-   * @return the variables used
+   * @param list the list where we will put variables
    */
-  public abstract List getUsedVariable();
-
-  public int getSourceStart() {
-    return sourceStart;
-  }
+  public abstract void getUsedVariable(List list);
 
-  public int getSourceEnd() {
-    return sourceEnd;
-  }
-
-  public void setSourceStart(int sourceStart) {
-    this.sourceStart = sourceStart;
-  }
+  /**
+   * This method will analyze the code.
+   * by default it will do nothing
+   */
+  public void analyzeCode() {}
 
-  public void setSourceEnd(int sourceEnd) {
-    this.sourceEnd = sourceEnd;
+  /**
+   * Check if the array array contains the object o.
+   * @param array an array
+   * @param o an obejct
+   * @return true if the array contained the object o
+   */
+  public final boolean arrayContains(final Object[] array, final Object o) {
+    for (int i = 0; i < array.length; i++) {
+      if (array[i].equals(o)) {
+        return true;
+      }
+    }
+    return false;
   }
 }