*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / AstNode.java
index 9eabb41..2f0fe2d 100644 (file)
@@ -1,5 +1,7 @@
 package net.sourceforge.phpdt.internal.compiler.ast;
 
+import java.util.List;
+
 /**
  * It will be the mother of our own ast tree for php just like the ast tree of Eclipse.
  * @author Matthieu Casanova
@@ -7,16 +9,16 @@ package net.sourceforge.phpdt.internal.compiler.ast;
 public abstract class AstNode {
 
   /** Starting and ending position of the node in the sources. */
-  public int sourceStart, sourceEnd;
+  private int sourceStart, sourceEnd;
 
   /**
    * Create a node giving starting and ending offset
    * @param sourceStart starting offset
    * @param sourceEnd ending offset
    */
-  public AstNode(int sourceStart, int sourceEnd) {
-    this.sourceStart = sourceStart;
-    this.sourceEnd = sourceEnd;
+  public AstNode(final int sourceStart, final int sourceEnd) {
+    this.setSourceStart(sourceStart);
+    this.setSourceEnd(sourceEnd);
   }
 
   /**
@@ -24,10 +26,11 @@ public abstract class AstNode {
    * @param tab the number of tabulations
    * @return a String containing some spaces
    */
-  public static String tabString(int tab) {
-    StringBuffer s = new StringBuffer();
-    for (int i = tab; i > 0; i--)
+  public static String tabString(final int tab) {
+    final StringBuffer s = new StringBuffer(2 * tab);
+    for (int i = tab; i > 0; i--) {
       s.append("  "); //$NON-NLS-1$
+    }
     return s.toString();
   }
 
@@ -46,4 +49,38 @@ public abstract class AstNode {
    * @return a String
    */
   public abstract String toString(int tab);
+
+  /**
+   * Get the variables from outside (parameters, globals ...)
+   * @return the variables from outside
+   */
+  public abstract List getOutsideVariable();
+
+  /**
+   * get the modified variables.
+   * @return the variables modified
+   */
+  public abstract List getModifiedVariable();
+
+  /**
+   * Get the variables used.
+   * @return the variables used
+   */
+  public abstract List getUsedVariable();
+
+  public int getSourceStart() {
+    return sourceStart;
+  }
+
+  public int getSourceEnd() {
+    return sourceEnd;
+  }
+
+  public void setSourceStart(int sourceStart) {
+    this.sourceStart = sourceStart;
+  }
+
+  public void setSourceEnd(int sourceEnd) {
+    this.sourceEnd = sourceEnd;
+  }
 }