X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
index f7a2352..5570ff9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
@@ -1,16 +1,15 @@
+package net.sourceforge.phpdt.core.dom;
/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package net.sourceforge.phpdt.core.dom;
-
/**
* Java compilation unit AST node type. This is the type of the root of an AST.
@@ -33,43 +32,43 @@ package net.sourceforge.phpdt.core.dom;
* { ImportDeclaration }
* { TypeDeclaration | EnumDeclaration | AnnotationTypeDeclaration | ; }
*
- *
+ *
* @since 2.0
*/
-public class CompilationUnit {
+public class CompilationUnit {
// /**
// * The "package" structural property of this node type.
-// *
+// *
// * @since 3.0
// */
-// public static final ChildPropertyDescriptor PACKAGE_PROPERTY =
+// public static final ChildPropertyDescriptor PACKAGE_PROPERTY =
// new ChildPropertyDescriptor(CompilationUnit.class, "package", PackageDeclaration.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
-//
+//
// /**
// * The "imports" structural property of this node type.
-// *
+// *
// * @since 3.0
// */
// public static final ChildListPropertyDescriptor IMPORTS_PROPERTY =
// new ChildListPropertyDescriptor(CompilationUnit.class, "imports", ImportDeclaration.class, NO_CYCLE_RISK); //$NON-NLS-1$
-//
+//
// /**
// * The "types" structural property of this node type.
-// *
+// *
// * @since 3.0
// */
// public static final ChildListPropertyDescriptor TYPES_PROPERTY =
// new ChildListPropertyDescriptor(CompilationUnit.class, "types", AbstractTypeDeclaration.class, CYCLE_RISK); //$NON-NLS-1$
-//
+//
// /**
-// * A list of property descriptors (element type:
+// * A list of property descriptors (element type:
// * {@link StructuralPropertyDescriptor}),
// * or null if uninitialized.
// * @since 3.0
// */
// private static final List PROPERTY_DESCRIPTORS;
-//
+//
// static {
// createPropertyList(CompilationUnit.class);
// addProperty(PACKAGE_PROPERTY);
@@ -81,18 +80,18 @@ public class CompilationUnit {
// /**
// * Returns a list of structural property descriptors for this node type.
// * Clients must not modify the result.
-// *
+// *
// * @param apiLevel the API level; one of the
// * AST.JLS*
constants
//
-// * @return a list of property descriptors (element type:
+// * @return a list of property descriptors (element type:
// * {@link StructuralPropertyDescriptor})
// * @since 3.0
// */
// public static List propertyDescriptors(int apiLevel) {
// return PROPERTY_DESCRIPTORS;
// }
-//
+//
// /**
// * The comment table, or null
if none; initially
// * null
. This array is the storage underlying
@@ -100,39 +99,39 @@ public class CompilationUnit {
// * @since 3.0
// */
// Comment[] optionalCommentTable = null;
-//
+//
// /**
-// * The comment list (element type: Comment
,
+// * The comment list (element type: Comment
,
// * or null
if none; initially null
.
// * @since 3.0
// */
// private List optionalCommentList = null;
-//
+//
// /**
// * The package declaration, or null
if none; initially
// * null
.
// */
// private PackageDeclaration optionalPackageDeclaration = null;
-//
+//
// /**
-// * The list of import declarations in textual order order;
+// * The list of import declarations in textual order order;
// * initially none (elementType: ImportDeclaration
).
// */
// private ASTNode.NodeList imports =
// new ASTNode.NodeList(IMPORTS_PROPERTY);
-//
+//
// /**
-// * The list of type declarations in textual order order;
+// * The list of type declarations in textual order order;
// * initially none (elementType: AbstractTypeDeclaration
)
// */
// private ASTNode.NodeList types =
// new ASTNode.NodeList(TYPES_PROPERTY);
-//
+//
// /**
// * Line end table. If lineEndTable[i] == p
then the
-// * line number i+1
ends at character position
+// * line number i+1
ends at character position
// * p
. Except for the last line, the positions are that
-// * of the last character of the line delimiter.
+// * of the last character of the line delimiter.
// * For example, the source string A\nB\nC
has
// * line end table {1, 3} (if \n is one character).
// */
@@ -152,27 +151,27 @@ public class CompilationUnit {
// * Messages reported by the compiler during parsing or name resolution.
// */
// private Message[] messages;
-//
+//
// /**
// * Problems reported by the compiler during parsing or name resolution.
// */
// private IProblem[] problems = EMPTY_PROBLEMS;
-//
+//
// /**
-// * The comment mapper, or null
in none;
+// * The comment mapper, or null
in none;
// * initially null
.
// * @since 3.0
// */
// private DefaultCommentMapper commentMapper = null;
-//
+//
// /**
// * Sets the line end table for this compilation unit.
-// * If lineEndTable[i] == p
then line number i+1
-// * ends at character position p
. Except for the last line, the
+// * If lineEndTable[i] == p
then line number i+1
+// * ends at character position p
. Except for the last line, the
// * positions are that of (the last character of) the line delimiter.
// * For example, the source string A\nB\nC
has
// * line end table {1, 3, 4}.
-// *
+// *
// * @param lineEndtable the line end table
// */
// void setLineEndTable(int[] lineEndTable) {
@@ -190,11 +189,11 @@ public class CompilationUnit {
// * The compilation unit initially has no package declaration, no
// * import declarations, and no type declarations.
// *
-// * N.B. This constructor is package-private; all subclasses must be -// * declared in the same package; clients are unable to declare +// * N.B. This constructor is package-private; all subclasses must be +// * declared in the same package; clients are unable to declare // * additional subclasses. // *
-// * +// * // * @param ast the AST that is to own this node // */ // CompilationUnit(AST ast) { @@ -208,7 +207,7 @@ public class CompilationUnit { // final List internalStructuralPropertiesForType(int apiLevel) { // return propertyDescriptors(apiLevel); // } -// +// // /* (omit javadoc for this method) // * Method declared on ASTNode. // */ @@ -224,7 +223,7 @@ public class CompilationUnit { // // allow default implementation to flag the error // return super.internalGetSetChildProperty(property, get, child); // } -// +// // /* (omit javadoc for this method) // * Method declared on ASTNode. // */ @@ -238,7 +237,7 @@ public class CompilationUnit { // // allow default implementation to flag the error // return super.internalGetChildListProperty(property); // } -// +// // /* (omit javadoc for this method) // * Method declared on ASTNode. // */ @@ -281,23 +280,23 @@ public class CompilationUnit { // } // visitor.endVisit(this); // } -// +// // /** -// * Returns the node for the package declaration of this compilation -// * unit, ornull
if this compilation unit is in the
+// * Returns the node for the package declaration of this compilation
+// * unit, or null
if this compilation unit is in the
// * default package.
-// *
+// *
// * @return the package declaration node, or null
if none
-// */
+// */
// public PackageDeclaration getPackage() {
// return this.optionalPackageDeclaration;
// }
-//
+//
// /**
-// * Sets or clears the package declaration of this compilation unit
+// * Sets or clears the package declaration of this compilation unit
// * node to the given package declaration node.
-// *
-// * @param pkgDecl the new package declaration node, or
+// *
+// * @param pkgDecl the new package declaration node, or
// * null
if this compilation unit does not have a package
// * declaration (that is in the default package)
// * @exception IllegalArgumentException if:
@@ -305,7 +304,7 @@ public class CompilationUnit {
// * ImportDeclaration
)
-// */
+// */
// public List imports() {
// return this.imports;
// }
-//
+//
// /**
-// * Returns the live list of nodes for the top-level type declarations of this
+// * Returns the live list of nodes for the top-level type declarations of this
// * compilation unit, in order of appearance.
// *
// * Note that in JLS3, the types may include both enum declarations
// * and annotation type declarations introduced in J2SE 1.5.
// * For JLS2, the elements are always TypeDeclaration
.
// *
AbstractTypeDeclaration
)
-// */
+// */
// public List types() {
// return this.types;
// }
//
// /**
-// * Finds the corresponding AST node in the given compilation unit from
+// * Finds the corresponding AST node in the given compilation unit from
// * which the given binding originated. Returns null
if the
// * binding does not correspond to any node in this compilation unit.
// * This method always returns null
if bindings were not requested
@@ -356,11 +355,11 @@ public class CompilationUnit {
// * AnonymousClassDeclaration
(for anonymous classes)
// * VariableDeclarationFragment
in a
+// * VariableDeclarationFragment
in a
// * FieldDeclaration
SingleVariableDeclaration
, or
-// * a VariableDeclarationFragment
in a
-// * VariableDeclarationStatement
or
+// * a VariableDeclarationFragment
in a
+// * VariableDeclarationStatement
or
// * VariableDeclarationExpression
MethodDeclaration
MethodDeclaration
findDeclaringNode(binding.getKey())
when the binding comes
// * from a different AST.
// *
-// *
+// *
// * @param binding the binding
// * @return the corresponding node where the given binding is declared,
// * or null
if the binding does not correspond to a node in this
@@ -389,7 +388,7 @@ public class CompilationUnit {
// }
//
// /**
-// * Finds the corresponding AST node in the given compilation unit from
+// * Finds the corresponding AST node in the given compilation unit from
// * which the binding with the given key originated. Returns
// * null
if the corresponding node cannot be determined.
// * This method always returns null
if bindings were not requested
@@ -404,11 +403,11 @@ public class CompilationUnit {
// * AnonymousClassDeclaration
(for anonymous classes)
// * VariableDeclarationFragment
in a
+// * VariableDeclarationFragment
in a
// * FieldDeclaration
SingleVariableDeclaration
, or
-// * a VariableDeclarationFragment
in a
-// * VariableDeclarationStatement
or
+// * a VariableDeclarationFragment
in a
+// * VariableDeclarationStatement
or
// * VariableDeclarationExpression
MethodDeclaration
MethodDeclaration
null
// * @return the corresponding node where a binding with the given
// * key is declared, or null
if the key is null
@@ -435,10 +434,10 @@ public class CompilationUnit {
// public ASTNode findDeclaringNode(String key) {
// return this.ast.getBindingResolver().findDeclaringNode(key);
// }
-//
+//
// /**
// * Returns the internal comment mapper.
-// *
+// *
// * @return the comment mapper, or null
if none.
// * @since 3.0
// */
@@ -449,7 +448,7 @@ public class CompilationUnit {
// /**
// * Initializes the internal comment mapper with the given
// * scanner.
-// *
+// *
// * @param scanner the scanner
// * @since 3.0
// */
@@ -463,7 +462,7 @@ public class CompilationUnit {
// * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
// * the extended source range may include comments and whitespace
// * immediately before or after the normal source range for the node.
-// *
+// *
// * @param node the node
// * @return the 0-based character index, or -1
// * if no source position information is recorded for this node
@@ -483,7 +482,7 @@ public class CompilationUnit {
// * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
// * the extended source range may include comments and whitespace
// * immediately before or after the normal source range for the node.
-// *
+// *
// * @param node the node
// * @return a (possibly 0) length, or 0
// * if no source position information is recorded for this node
@@ -497,10 +496,10 @@ public class CompilationUnit {
// return this.commentMapper.getExtendedLength(node);
// }
// }
-//
+//
// /**
// * Returns the line number corresponding to the given source character
-// * position in the original source string. The initial line of the
+// * position in the original source string. The initial line of the
// * compilation unit is numbered 1, and each line extends through the
// * last character of the end-of-line delimiter. The very last line extends
// * through the end of the source string and has no line delimiter.
@@ -509,7 +508,7 @@ public class CompilationUnit {
// * Returns 1 for a character position that does not correspond to any
// * source line, or if no line number information is available for this
// * compilation unit.
-// *
+// *
// * @param position a 0-based character position, possibly
// * negative or out of range
// * @return the 1-based line number, or 1
if the character
@@ -542,7 +541,7 @@ public class CompilationUnit {
// }
// // assert lineEndTable[low] < position <= lineEndTable[hi]
// // && low == 0 && hi == length - 1 && low < hi
-//
+//
// // binary search line end table
// while (true) {
// // invariant lineEndTable[low] < position <= lineEndTable[hi]
@@ -571,8 +570,8 @@ public class CompilationUnit {
// }
//
// /**
-// * Returns the list of messages reported by the compiler during the parsing
-// * or the type checking of this compilation unit. This list might be a subset of
+// * Returns the list of messages reported by the compiler during the parsing
+// * or the type checking of this compilation unit. This list might be a subset of
// * errors detected and reported by a Java compiler.
// *
// * This list of messages is suitable for simple clients that do little
@@ -612,7 +611,7 @@ public class CompilationUnit {
// * Simple clients that do little more than log the messages or display
// * them to the user should probably call getMessages
instead.
// *
// * Since the Java language allows comments to appear most anywhere // * in the source text, it is problematic to locate comments in relation -// * to the structure of an AST. The one exception is doc comments +// * to the structure of an AST. The one exception is doc comments // * which, by convention, immediately precede type, field, and // * method declarations; these comments are located in the AST // * by {@link BodyDeclaration#getJavadoc BodyDeclaration.getJavadoc}. @@ -649,7 +648,7 @@ public class CompilationUnit { // * is provided for clients that need to find the source ranges of // * all comments in the original source string. It includes entries // * for comments of all kinds (line, block, and doc), arranged in order -// * of increasing source position. +// * of increasing source position. // *
// * Note on comment parenting: The {@link ASTNode#getParent() getParent()} // * of a doc comment associated with a body declaration is the body @@ -660,7 +659,7 @@ public class CompilationUnit { // * However, for other comment nodes, {@link ASTNode#getParent() getParent()} // * will returnnull
, and {@link ASTNode#getRoot() getRoot()}
// * will return the comment node itself, indicating that these comment nodes
-// * are not directly connected to the AST for the compilation unit. The
+// * are not directly connected to the AST for the compilation unit. The
// * {@link Comment#getAlternateRoot Comment.getAlternateRoot}
// * method provides a way to navigate from a comment to its compilation
// * unit.
@@ -675,7 +674,7 @@ public class CompilationUnit {
// * // * Clients cannot modify the resulting list. // *
-// * +// * // * @return an unmodifiable list of comments in increasing order of source // * start position, ornull
if comment information
// * for this compilation unit is not available
@@ -685,11 +684,11 @@ public class CompilationUnit {
// public List getCommentList() {
// return this.optionalCommentList;
// }
-//
+//
// /**
// * Sets the list of the comments encountered while parsing
// * this compilation unit.
-// *
+// *
// * @param commentTable a list of comments in increasing order
// * of source start position, or null
if comment
// * information for this compilation unit is not available
@@ -725,8 +724,8 @@ public class CompilationUnit {
// this.optionalCommentList = Collections.unmodifiableList(commentList);
// }
// }
-//
-//
+//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -743,7 +742,7 @@ public class CompilationUnit {
// }
// buffer.append("]"); //$NON-NLS-1$
// }
-//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -758,7 +757,7 @@ public class CompilationUnit {
// // ignore the space taken up by optionalCommentList
// return size;
// }
-//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -780,7 +779,7 @@ public class CompilationUnit {
// }
// return size;
// }
-//
+//
// /**
// * Enables the recording of changes to this compilation
// * unit and its descendents. The compilation unit must have
@@ -789,18 +788,18 @@ public class CompilationUnit {
// * arbitrary changes to the subtree rooted at this compilation
// * unit are recorded internally. Once the modification has
// * been completed, call rewrite
to get an object
-// * representing the corresponding edits to the original
+// * representing the corresponding edits to the original
// * source code string.
// *
// * @exception IllegalArgumentException if this compilation unit is
-// * marked as unmodifiable, or if this compilation unit has already
+// * marked as unmodifiable, or if this compilation unit has already
// * been tampered with, or recording has already been enabled
// * @since 3.0
// */
// public void recordModifications() {
// getAST().recordModifications(this);
// }
-//
+//
// /**
// * Converts all modifications recorded for this compilation
// * unit into an object representing the corresponding text
@@ -821,7 +820,7 @@ public class CompilationUnit {
// * accurately reflect the net cumulative affect of all those
// * changes.
// *
-// *
+// *
// * @param document original document containing source code
// * for this compilation unit
// * @param options the table of formatter options