X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Class.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Class.java index cad94c9..2d58b82 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Class.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Class.java @@ -16,12 +16,12 @@ public class Class extends AstNode { public VariableDeclaration[] fields; public int declarationSourceStart; - public int declarationSourceEnd; - public int bodyStart; - public int bodyEnd; - + public int declarationSourceEnd; + public int bodyStart; + public int bodyEnd; + /** The methods of the class. */ public MethodDeclaration[] methods; - + /** The constructor of the class. */ public MethodDeclaration constructor; /** @@ -32,40 +32,53 @@ public class Class extends AstNode { return constructor != null; } - public String toString(int tab) { - - return tabString(tab) + toStringHeader() + toStringBody(tab); - } + /** + * Return the class as String. + * @param tab how many tabs before the class + * @return the code of this class into String + */ + public String toString(int tab) { + return tabString(tab) + toStringHeader() + toStringBody(tab); + } - public String toStringBody(int tab) { + /** + * Return the body of the class as String + * @param tab how many tabs before the body of the class + * @return the body as String + */ + public String toStringBody(int tab) { final StringBuffer buff = new StringBuffer(" {");//$NON-NLS-1$ - if (fields != null) { - for (int fieldI = 0; fieldI < fields.length; fieldI++) { - if (fields[fieldI] != null) { - buff.append("\n"); //$NON-NLS-1$ + if (fields != null) { + for (int fieldI = 0; fieldI < fields.length; fieldI++) { + if (fields[fieldI] != null) { + buff.append("\n"); //$NON-NLS-1$ buff.append(fields[fieldI].toString(tab + 1)); buff.append(";");//$NON-NLS-1$ - } - } - } - if (methods != null) { - for (int i = 0; i < methods.length; i++) { - if (methods[i] != null) { - buff.append("\n");//$NON-NLS-1$ + } + } + } + if (methods != null) { + for (int i = 0; i < methods.length; i++) { + if (methods[i] != null) { + buff.append("\n");//$NON-NLS-1$ buff.append(methods[i].toString(tab + 1)); - } - } - } - buff.append("\n").append(tabString(tab)).append("}"); //$NON-NLS-2$ //$NON-NLS-1$ - return buff.toString(); - } + } + } + } + buff.append("\n").append(tabString(tab)).append("}"); //$NON-NLS-2$ //$NON-NLS-1$ + return buff.toString(); + } - public String toStringHeader() { - final StringBuffer buff = new StringBuffer("class").append(name); - if (superclass != null) { - buff.append(" extends "); //$NON-NLS-1$ + /** + * Return the header of the class as String. + * @return the header of the class + */ + public String toStringHeader() { + final StringBuffer buff = new StringBuffer("class").append(name);//$NON-NLS-1$ + if (superclass != null) { + buff.append(" extends "); //$NON-NLS-1$ buff.append(superclass); } - return buff.toString(); - } + return buff.toString(); + } }