many changes and fixes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ClassDeclaration.java
index 5bdc3c6..af9ed52 100644 (file)
@@ -2,14 +2,12 @@ package net.sourceforge.phpdt.internal.compiler.ast;
 
 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;
 
 
 /**
@@ -21,9 +19,9 @@ import java.util.Enumeration;
 public class ClassDeclaration extends Statement implements OutlineableWithChildren {
 
   /** The name of the class. */
-  public char[] name;
+  public String name;
   /** The superclass. */
-  public char[] superclass;
+  public String superclass;
 
   public int declarationSourceStart;
   public int declarationSourceEnd;
@@ -48,15 +46,15 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * @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());
   }
 
   /**
@@ -65,15 +63,19 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * @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);
@@ -169,7 +171,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);
@@ -190,7 +192,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * @return the variables from outside
    */
   public List getOutsideVariable() {
-    return new ArrayList();
+    return new ArrayList(1);
   }
 
   /**
@@ -198,7 +200,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * @return the variables from we change value
    */
   public List getModifiedVariable() {
-    return new ArrayList();
+    return new ArrayList(1);
   }
 
   /**
@@ -206,6 +208,6 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * @return the variables used
    */
   public List getUsedVariable() {
-    return new ArrayList();
+    return new ArrayList(1);
   }
 }