Some minor changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ClassDeclaration.java
index 5bdc3c6..adb4332 100644 (file)
@@ -1,16 +1,15 @@
 package net.sourceforge.phpdt.internal.compiler.ast;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
 import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
+
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.text.Position;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Enumeration;
-
 
 /**
  * This class is my ClassDeclaration declaration for php.
@@ -18,12 +17,12 @@ import java.util.Enumeration;
  * It directly extends AstNode because a class cannot appear anywhere in php
  * @author Matthieu Casanova
  */
-public class ClassDeclaration extends Statement implements OutlineableWithChildren {
+public final class ClassDeclaration extends Statement implements OutlineableWithChildren {
 
   /** The name of the class. */
-  public char[] name;
+  private final String name;
   /** The superclass. */
-  public char[] superclass;
+  private String superclass;
 
   public int declarationSourceStart;
   public int declarationSourceEnd;
@@ -32,48 +31,52 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
   /** The methods of the class. */
   private final ArrayList methods = new ArrayList();
   /** The constructor of the class. */
-  public MethodDeclaration constructor;
+  private MethodDeclaration constructor;
   /** The fields of the class. */
-  private ArrayList fields = new ArrayList();
+  private final ArrayList fields = new ArrayList();
 
-  private Object parent;
+  private final Object parent;
   /** The outlineable children (those will be in the node array too. */
-  private ArrayList children = new ArrayList();
+  private final ArrayList children = new ArrayList();
 
-  private Position position;
+  private final Position position;
 
   /**
-   * Create a class giving starting and ending offset
+   * Create a class giving starting and ending offset.
    * @param sourceStart starting offset
    * @param sourceEnd ending offset
    */
   public ClassDeclaration(final Object parent,
-                          final char[] name,
-                          final char[] superclass,
+                          final String name,
+                          final String superclass,
                           final int sourceStart,
                           final int sourceEnd) {
     super(sourceStart, sourceEnd);
     this.parent = parent;
     this.name = name;
     this.superclass = superclass;
-    position = new Position(sourceStart, name.length);
+    position = new Position(sourceStart, name.length());
   }
 
   /**
-   * Create a class giving starting and ending offset
+   * Create a class giving starting and ending offset.
    * @param sourceStart starting offset
    * @param sourceEnd ending offset
    */
   public ClassDeclaration(final Object parent,
-                          final char[] name,
+                          final String name,
                           final int sourceStart,
                           final int sourceEnd) {
     super(sourceStart, sourceEnd);
     this.parent = parent;
     this.name = name;
-    position = new Position(sourceStart, name.length);
+    position = new Position(sourceStart, name.length());
   }
 
+  /**
+   * Add a method to the class.
+   * @param method the method declaration
+   */
   public void addMethod(final MethodDeclaration method) {
     methods.add(method);
     add(method);
@@ -116,7 +119,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * @param tab how many tabs before the body of the class
    * @return the body as String
    */
-  public String toStringBody(final int tab) {
+  private String toStringBody(final int tab) {
     final StringBuffer buff = new StringBuffer(" {");//$NON-NLS-1$
     if (fields != null) {
       for (int i = 0; i < fields.size(); i++) {
@@ -139,7 +142,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * Return the header of the class as String.
    * @return the header of the class
    */
-  public String toStringHeader() {
+  private String toStringHeader() {
     final StringBuffer buff = new StringBuffer("class ").append(name);//$NON-NLS-1$
     if (superclass != null) {
       buff.append(" extends "); //$NON-NLS-1$
@@ -169,7 +172,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
   }
 
   public String toString() {
-    final StringBuffer buff = new StringBuffer(new String(name));
+    final StringBuffer buff = new StringBuffer(name);
     if (superclass != null) {
       buff.append(":"); //$NON-NLS-1$
       buff.append(superclass);
@@ -187,25 +190,22 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
 
   /**
    * Get the variables from outside (parameters, globals ...)
-   * @return the variables from outside
+   *
+   * @param list the list where we will put variables
    */
-  public List getOutsideVariable() {
-    return new ArrayList();
-  }
+  public void getOutsideVariable(final List list) {}
 
   /**
    * get the modified variables.
-   * @return the variables from we change value
+   *
+   * @param list the list where we will put variables
    */
-  public List getModifiedVariable() {
-    return new ArrayList();
-  }
+  public void getModifiedVariable(final List list) {}
 
   /**
    * Get the variables used.
-   * @return the variables used
+   *
+   * @param list the list where we will put variables
    */
-  public List getUsedVariable() {
-    return new ArrayList();
-  }
+  public void getUsedVariable(final List list) {}
 }