User: rinkrank
  Date: 02/02/23 20:38:56

  Modified:    src/xjavadoc XJavaDocTest.java XJavaDoc.java XDocTest.java
                        XDoc.java XClass.java UnknownClass.java Token.java
                        SourceClass.java ProxyClass.java Primitive.java
                        MethodImpl.java ClassDump.java BinaryClass.java
                        AbstractProgramElement.java AbstractClass.java
  Log:
  No class variables. The variables are passed to the productions that need to modify 
them. This solves innerclass problem too.
  Added new production rules (with underscore in the name) which are only used in 
special cases
  -Added complete() method to AbstractClass. This will fill in a class' members, but 
not before it's needed. BIG optimizer!
  -Using wait() (Thanks for this incredibly fantastic idea Ara!!!!!!!!!!!!!!!!!!!!!)
  -Changed back to methodNameWithSignature for the sake of a simpler API
  -xjavadoc is 4-5 times faster if only class level docs are accessed ;-)))
  
  Revision  Changes    Path
  1.13      +21 -50    xjavadoc/src/xjavadoc/XJavaDocTest.java
  
  Index: XJavaDocTest.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XJavaDocTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -w -r1.12 -r1.13
  --- XJavaDocTest.java 22 Feb 2002 22:50:27 -0000      1.12
  +++ XJavaDocTest.java 24 Feb 2002 04:38:56 -0000      1.13
  @@ -122,69 +122,41 @@
   
   
        /**
  -      * Read a class, modify it, reread it and see if change was successful.
  +      * Read a class, get a method, modify a tag parameter, reread it and see if
  +      * change was successful.
         *
         * @todo reread
         * @exception Exception Describe the exception
         * @todo-javadoc Write javadocs for exception
         */
  -     public void testModifyClassDoc() throws Exception {
  -             String newJavadoc =
  -                             "/**\n" +
  -                             " *  XJavaDoc   \n" +
  -                             " *   rules    \n" +
  -                             "  indeed    \n" +
  -                             " */";
  +     public void testGetMethodParameterValue() throws Exception {
                XClass clazz = XJavaDoc.getInstance().getXClass("Hello", true);
  -             XDoc doc = clazz.doc();
  -             doc.setJavadoc(newJavadoc);
  -
  -             File testDir = new File("build/junit/testModifyClassDoc");
  +             XMethod method = clazz.getMethod("whatever(java.lang.String[][],int)");
  +             XDoc doc = method.doc();
  +             assertEquals("is", doc.tagValue("maybe", "this"));
  +             File testDir = new File("build/junit/testGetMethodParameterValue");
                String fileName = clazz.save(testDir);
        }
   
   
  -     /**
  -      * Read a class, get a method, modify a tag parameter, reread it and see if
  -      * change was successful.
  -      *
  -      * @todo reread
  -      * @exception Exception Describe the exception
  -      * @todo-javadoc Write javadocs for exception public void
  -      *      testGetMethodParameterValue() throws Exception { XClass clazz =
  -      *      _xj.getXClass("Hello"); XMethod method = clazz.getMethod("whatever (
  -      *      java.lang.String[][] , int )"); XDoc doc = method.doc();
  -      *      assertEquals("is", doc.tagValue("maybe", "this")); File testDir = new
  -      *      File("build/junit/testGetMethodParameterValue"); String fileName =
  -      *      clazz.save(testDir); }
  -      */
   
        /**
  -      * A unit test for JUnit
  -      *
         * @exception Exception Describe the exception
  -      * @todo-javadoc Write javadocs for exception public void
  -      *      testModifyMethodParameterValue() throws Exception { XClass clazz =
  -      *      _xj.getXClass("Hello"); XMethod method =
  -      *      clazz.getMethod("whatever(java.lang.String[],int)"); XDoc doc =
  -      *      method.doc(); / modify a tag parameter XTag tag = doc.tag("numbers");
  -      *      XTagParameter tagParameter = tag.getParameter("three");
  -      *      tagParameter.setValue("trois"); File testDir = new
  -      *      File("build/junit/testModifyMethodParameterValue"); String fileName =
  -      *      clazz.save(testDir); }
  +      * @todo-javadoc Write javadocs for exception
         */
  +     public void testModifyMethodParameterValue() throws Exception {
  +             XClass clazz = XJavaDoc.getInstance().updateMethodTag(
  +                             "Hello",
  +                             "whatever(java.lang.String[],int)",
  +                             "numbers",
  +                             "three",
  +                             "trois",
  +                             0
  +                             );
  +             File testDir = new File("build/junit/testModifyMethodParameterValue");
  +             String fileName = clazz.save(testDir);
  +     }
   
  -     /**
  -      * This test method is equivalent to testModifyMethodParameterValue()
  -      *
  -      * @exception Exception Describe the exception
  -      * @todo-javadoc Write javadocs for exception public void
  -      *      testModifyMethodParameterValue2() throws Exception { XClass clazz =
  -      *      _xj.updateMethodTag("Hello", " whatever ( java.lang.String[] , int ) ",
  -      *      "numbers", "three", "trois", 0); File testDir = new
  -      *      File("build/junit/testModifyMethodParameterValue2"); String fileName =
  -      *      clazz.save(testDir); }
  -      */
   
        /**
         * A unit test for JUnit
  @@ -237,8 +209,7 @@
                XClass clazz;
                clazz = XJavaDoc.getInstance().updateMethodTag(
                                "Hello",
  -                             "noComment",
  -                             null,
  +                             "noComment()",
                                "here",
                                "is",
                                "a tag for ya",
  
  
  
  1.15      +76 -30    xjavadoc/src/xjavadoc/XJavaDoc.java
  
  Index: XJavaDoc.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XJavaDoc.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -w -r1.14 -r1.15
  --- XJavaDoc.java     22 Feb 2002 22:50:27 -0000      1.14
  +++ XJavaDoc.java     24 Feb 2002 04:38:56 -0000      1.15
  @@ -129,7 +129,6 @@
         * @param dir The new Dir value
         */
        public void setDir(File dir) {
  -             System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXX Using dir : " + 
dir.getAbsolutePath());
                this._dir = dir;
        }
   
  @@ -192,12 +191,12 @@
         * @param parameterName Describe what the parameter does
         * @param parameterValue Describe what the parameter does
         * @param tagIndex Describe what the parameter does
  -      * @param methodName Describe what the parameter does
  -      * @param parameters Describe what the parameter does
  +      * @param methodNameWithSignature Describe what the parameter does
         * @return Describe the return value
         * @exception XJavaDocException Describe the exception
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
  @@ -210,15 +209,14 @@
         */
        public XClass updateMethodTag(
                        String className,
  -                     String methodName,
  -                     String[] parameters,
  +                     String methodNameWithSignature,
                        String tagName,
                        String parameterName,
                        String parameterValue,
                        int tagIndex
                        ) throws XJavaDocException {
                XClass clazz = getXClass(className, false);
  -             XMethod method = clazz.getMethod(methodName, parameters);
  +             XMethod method = clazz.getMethod(methodNameWithSignature);
                XDoc doc = method.doc();
                doc.updateTagValue(tagName, parameterName, parameterValue, tagIndex);
                return clazz;
  @@ -272,33 +270,44 @@
         */
        public XClass scan(String qualifiedName) throws XJavaDocException {
                File f = null;
  -             try {
  +//           try {
                        f = new File(_dir, qualifiedName.replace('.', '/') + ".java");
                        if (!f.exists()) {
                                throw new XJavaDocException("No source found for " + 
qualifiedName + " at " + f.getAbsolutePath());
                        }
   
                        _log.debug("Scanning class: " + qualifiedName);
  -                     Token.lastParsedToken = null;
  -                     SourceClass sourceClass = new SourceClass(null, qualifiedName);
  +             //Token.lastParsedToken = null;
   
  -                     Reader in = new FileReader(f);
  -                     if (_javaParser == null) {
  -                             _javaParser = new JavaParser(in);
  +             /*
  +              *  if (_javaParser == null) {
  +              *  _javaParser = new JavaParser(in);
  +              *  }
  +              *  else {
  +              *  _javaParser.ReInit(in);
  +              *  }
  +              *  _javaParser.CompilationUnit(sourceClass);
  +              */
  +             SourceClass sourceClass = new SourceClass(null, qualifiedName, f);
  +
  +             ParseThread parseThread = new ParseThread(sourceClass);
  +             parseThread.start();
  +             // We must wait here until the first part of the parsing is done.
  +             // we'll be notified by the parser when it's done
  +             synchronized (sourceClass.getParseLock()) {
  +                     try {
  +                             sourceClass.getParseLock().wait();
  +                     } catch (InterruptedException e) {
  +                             e.printStackTrace();
                        }
  -                     else {
  -                             _javaParser.ReInit(in);
                        }
  -                     _log.debug("Parsing " + sourceClass.qualifiedName());
  -                     _javaParser.CompilationUnit(sourceClass);
  -                     _log.debug("Done. ");
   
                        return sourceClass;
  -             } catch (FileNotFoundException e) {
  -                     throw new XJavaDocException(e.getMessage());
  -             } catch (ParseException e) {
  -                     throw new XJavaDocException("Error parsing " + 
f.getAbsolutePath() + ":" + e.getMessage());
  -             }
  +//           } catch (FileNotFoundException e) {
  +//                   throw new XJavaDocException(e.getMessage());
  +//           } catch (ParseException e) {
  +//                   throw new XJavaDocException("Error parsing " + 
f.getAbsolutePath() + ":" + e.getMessage());
  +//           }
        }
   
   
  @@ -598,6 +607,43 @@
         */
        private final static void addPrimitive(String name) {
                _primitiveClasses.put(name, new Primitive(name));
  +     }
  +
  +
  +     /**
  +      * Describe what this class does
  +      *
  +      * @author Aslak Helles�y
  +      * @created 23. februar 2002
  +      * @todo-javadoc Write javadocs
  +      */
  +     private class ParseThread extends Thread {
  +             /**
  +              * @todo-javadoc Describe the field
  +              */
  +             private final SourceClass _sourceClass;
  +
  +
  +             /**
  +              * Describe what the ParseThread constructor does
  +              *
  +              * @param sourceClass Describe what the parameter does
  +              * @todo-javadoc Write javadocs for constructor
  +              * @todo-javadoc Write javadocs for method parameter
  +              */
  +             public ParseThread(SourceClass sourceClass) {
  +                     super(sourceClass.qualifiedName());
  +                     setDaemon(true);
  +                     _sourceClass = sourceClass;
  +             }
  +
  +
  +             /**
  +              * Main processing method for the ParseThread object
  +              */
  +             public void run() {
  +                     _sourceClass.parse();
  +             }
        }
   
        static {
  
  
  
  1.3       +2 -1      xjavadoc/src/xjavadoc/XDocTest.java
  
  Index: XDocTest.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XDocTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- XDocTest.java     20 Feb 2002 00:12:01 -0000      1.2
  +++ XDocTest.java     24 Feb 2002 04:38:56 -0000      1.3
  @@ -86,7 +86,8 @@
   
                Token token = Token.newToken(0);
                token.image = javadoc;
  -             XDoc doc = new XDoc(token, token);
  +//           XDoc doc = new XDoc(token, token);
  +             XDoc doc = new XDoc(token);
   
                assertEquals("This is in the doc too JUnit test for JavaDocReader.", 
doc.firstSentence());
                assertEquals("This is in the doc too JUnit test for JavaDocReader. 
This is sentence number two.", doc.commentText());
  
  
  
  1.11      +24 -29    xjavadoc/src/xjavadoc/XDoc.java
  
  Index: XDoc.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XDoc.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -r1.10 -r1.11
  --- XDoc.java 20 Feb 2002 00:12:01 -0000      1.10
  +++ XDoc.java 24 Feb 2002 04:38:56 -0000      1.11
  @@ -89,7 +89,7 @@
        /**
         * Token on which the javadoc belongs. Needed for proper indentation
         */
  -     private final Token _programElementToken;
  +//   private final Token _programElementToken;
   
        /**
         * @todo-javadoc Describe the field
  @@ -111,35 +111,17 @@
         * Describe what the XDoc constructor does
         *
         * @param javadocToken Describe what the parameter does
  -      * @param programElementToken Describe what the parameter does
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for constructor
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public XDoc(Token javadocToken, Token programElementToken) {
  -             if (programElementToken == null) {
  -                     throw new IllegalStateException("programElementToken can't be 
null");
  -             }
  -             if (programElementToken.image == null) {
  -                     throw new IllegalStateException("programElementToken's image 
can't be null");
  -             }
  +     public XDoc(Token javadocToken) {
                _javadocToken = javadocToken;
                if (_javadocToken.image == null) {
                        // the passed token was not from source code, but was created 
because no javadoc existed.
                        _javadocToken.image = "/**\n */";
                }
  -             _programElementToken = programElementToken;
  -     }
  -
  -
  -     /**
  -      * @todo emit an event, and let listeners register for this event.
  -      * @param s The new Javadoc value
  -      * @exception UnsupportedOperationException Won't happen for this class
  -      */
  -     public void setJavadoc(String s) throws UnsupportedOperationException {
  -             _javadocToken.image = s;
        }
   
   
  @@ -418,6 +400,16 @@
   
   
        /**
  +      * @todo emit an event, and let listeners register for this event.
  +      * @param s The new Javadoc value
  +      * @exception UnsupportedOperationException Won't happen for this class
  +      */
  +     private void setJavadoc(String s) throws UnsupportedOperationException {
  +             _javadocToken.image = s;
  +     }
  +
  +
  +     /**
         * Describe what the method does
         *
         * @todo-javadoc Write javadocs for method
  @@ -442,15 +434,18 @@
         * @todo-javadoc Write javadocs for return value
         */
        private StringBuffer appendWhiteSpaces(StringBuffer sb) {
  -             Token tk = _programElementToken;
  -             while (tk.previous != null && isTabOrSpace(tk.previous)) {
  -                     tk = tk.previous;
  -             }
  -             while (tk.next != null && tk != _programElementToken) {
  -                     sb.append(tk.image);
  -                     tk = tk.next;
  -             }
  -             return sb;
  +             return sb.append("   ");
  +             /*
  +              *  Token tk = _programElementToken;
  +              *  while (tk.previous != null && isTabOrSpace(tk.previous)) {
  +              *  tk = tk.previous;
  +              *  }
  +              *  while (tk.next != null && tk != _programElementToken) {
  +              *  sb.append(tk.image);
  +              *  tk = tk.next;
  +              *  }
  +              *  return sb;
  +              */
        }
   
   
  
  
  
  1.15      +3 -3      xjavadoc/src/xjavadoc/XClass.java
  
  Index: XClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XClass.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -w -r1.14 -r1.15
  --- XClass.java       22 Feb 2002 22:50:27 -0000      1.14
  +++ XClass.java       24 Feb 2002 04:38:56 -0000      1.15
  @@ -50,13 +50,13 @@
         * Returns an XMethod with the given name and parameters. Example:
         * getMethod("hello",new String[]{"java.lang.String","int"});
         *
  -      * @param methodName Describe what the parameter does
  -      * @param parameters Describe what the parameter does
  +      * @param methodNameWithSignature Describe what the parameter does
         * @return The Method value
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         */
  -     public XMethod getMethod(String methodName, String[] parameters);
  +     public XMethod getMethod(String methodNameWithSignature);
   
   
        /**
  
  
  
  1.8       +9 -0      xjavadoc/src/xjavadoc/UnknownClass.java
  
  Index: UnknownClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/UnknownClass.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -r1.7 -r1.8
  --- UnknownClass.java 20 Feb 2002 00:12:01 -0000      1.7
  +++ UnknownClass.java 24 Feb 2002 04:38:56 -0000      1.8
  @@ -61,5 +61,14 @@
                // be defensive since we know nothing about the class
                addModifier(Modifier.ABSTRACT);
        }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @todo-javadoc Write javadocs for method
  +      */
  +     protected void complete() {
  +     }
   }
   
  
  
  
  1.2       +4 -3      xjavadoc/src/xjavadoc/Token.java
  
  Index: Token.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/Token.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- Token.java        20 Feb 2002 00:12:01 -0000      1.1
  +++ Token.java        24 Feb 2002 04:38:56 -0000      1.2
  @@ -88,11 +88,12 @@
         */
        public Token previous;
   
  +
        /**
         * Added for xjavadoc. We'll use this field to know the preceding whitespace
         * when we encounter javadoc. Needed for proper indentation of javadoc
         */
  -     public static Token lastParsedToken;
  +//   public static Token lastParsedToken;
   
   
        /**
  @@ -114,8 +115,8 @@
        private Token(int ofKind) {
                kind = ofKind;
   
  -             previous = lastParsedToken;
  -             lastParsedToken = this;
  +//           previous = lastParsedToken;
  +//           lastParsedToken = this;
        }
   
   
  
  
  
  1.6       +86 -21    xjavadoc/src/xjavadoc/SourceClass.java
  
  Index: SourceClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/SourceClass.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- SourceClass.java  22 Feb 2002 22:50:27 -0000      1.5
  +++ SourceClass.java  24 Feb 2002 04:38:56 -0000      1.6
  @@ -52,10 +52,24 @@
        /**
         * @todo-javadoc Describe the field
         */
  -//   private ASTCompilationUnit _compilationUnit;
  +     private JavaParser _javaParser;
  +
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
        private SimpleNode _compilationUnit;
   
        /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private boolean _isParseCompleted = false;
  +
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private final Object _parseLock = new Object();
  +
  +     /**
         * Get static reference to Log4J Logger
         */
        private static org.apache.log4j.Category _log = 
org.apache.log4j.Category.getInstance(SourceClass.class.getName());
  @@ -66,14 +80,26 @@
         *
         * @param qualifiedName Describe what the parameter does
         * @param containingClass Describe what the parameter does
  +      * @param sourceFile Describe what the parameter does
  +      * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for constructor
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public SourceClass(XClass containingClass, String qualifiedName) {
  +     public SourceClass(XClass containingClass, String qualifiedName, File 
sourceFile) {
                super(containingClass, qualifiedName);
  +             // We need to check if sourceFile is null. All inner classes will have 
it set to null
  +             if (sourceFile != null) {
  +                     try {
  +                             Reader in = new FileReader(sourceFile);
  +                             _javaParser = new JavaParser(in);
  +                     } catch (FileNotFoundException e) {
  +                             // That's tough. Shouldn't happen
  +                             throw new IllegalStateException("Couldn't find source 
for " + qualifiedName + " at " + sourceFile.getAbsolutePath());
  +                     }
  +             }
        }
   
   
  @@ -88,6 +114,31 @@
        }
   
   
  +     /**
  +      * Gets the BodyParseLock attribute of the SourceClass object
  +      *
  +      * @return The BodyParseLock value
  +      */
  +     public Object getParseLock() {
  +             return _parseLock;
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @todo-javadoc Write javadocs for method
  +      */
  +     public void parse() {
  +             try {
  +                     _javaParser.CompilationUnit(this);
  +             } catch (ParseException e) {
  +                     // Source code is bad. Not according to grammar. User's fault.
  +                     System.err.println("Error parsing " + qualifiedName() + ":" + 
e.getMessage());
  +             }
  +     }
  +
  +
   
        /**
         * Prints this class to a stream
  @@ -96,7 +147,7 @@
         * @todo-javadoc Write javadocs for method parameter
         */
        public void print(PrintStream out) {
  -//           new PrintVisitor().visit(_compilationUnit, out);
  +             complete();
                NodePrinter.print(_compilationUnit, out);
        }
   
  @@ -170,6 +221,30 @@
   
   
        /**
  +      * Describe what the method does
  +      *
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     protected void complete() {
  +             if (!_isParseCompleted) {
  +                     // wake up the waiting parser thread
  +                     synchronized (getParseLock()) {
  +                             getParseLock().notify();
  +
  +                             // and wait until it's done with the rest
  +                             try {
  +                                     getParseLock().wait();
  +                             } catch (InterruptedException e) {
  +                                     e.printStackTrace();
  +                             }
  +                     }
  +                     _isParseCompleted = true;
  +             }
  +     }
  +
  +
  +     /**
         * Gets the UnqualifiedNameAPrimitiveType attribute of the SourceClass object
         *
         * @param unqualifiedClassName Describe what the parameter does
  @@ -202,23 +277,18 @@
         */
        private XClass isUnqualifiedNameInImportedClasses(String unqualifiedClassName, 
XClass result) {
   
  -             if (_ximportedClasses == null) {
  +             if (!hasImportedClasses()) {
                        return result;
                }
   
                String suffix = "." + unqualifiedClassName;
   
  -             for (int i = 0; i < _ximportedClasses.length; i++) {
  -                     String imported_class_str = (String)_ximportedClasses[i];
  +             for (int i = 0; i < getImportedClassCount(); i++) {
  +                     String importedClassName = getImportedClassName(i);
   
  -                     //if( imported_class_str instanceof String )
  -                     //   imported_class_str = (String)ximportedClass;
  -                     //else
  -                     //   imported_class_str = ((XClass)ximportedClass).name();
  -
  -                     if (imported_class_str.endsWith(suffix)) {
  +                     if (importedClassName.endsWith(suffix)) {
                                // We've found a candidate
  -                             XClass clazz = 
XJavaDoc.getInstance().getXClass(imported_class_str, true);
  +                             XClass clazz = 
XJavaDoc.getInstance().getXClass(importedClassName, true);
                                if (clazz != null && result != null) {
                                        throw new IllegalStateException("Ambiguous 
class:" + unqualifiedClassName);
                                }
  @@ -248,19 +318,14 @@
         */
        private XClass isUnqualifiedNameInImportedPackages(String 
unqualifiedClassName, XClass result) {
   
  -             if (_ximportedPackages == null) {
  +             if (!hasImportedPackages()) {
                        return result;
                }
   
                String suffix = "." + unqualifiedClassName;
   
  -             for (int i = 0; i < _ximportedPackages.length; i++) {
  -                     String importedPackageName = (String)_ximportedPackages[i];
  -
  -                     //if( imported_class_str instanceof String )
  -                     //   importedPackageName = (String)ximportedClass;
  -                     //else
  -                     //   importedPackageName = ((XClass)ximportedClass).name();
  +             for (int i = 0; i < getImportedPackageCount(); i++) {
  +                     String importedPackageName = getImportedPackageName(i);
   
                        String qualifiedClassName = importedPackageName + "." + 
unqualifiedClassName;
                        XClass clazz = 
XJavaDoc.getInstance().getXClass(qualifiedClassName, true);
  
  
  
  1.5       +2 -3      xjavadoc/src/xjavadoc/ProxyClass.java
  
  Index: ProxyClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/ProxyClass.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- ProxyClass.java   22 Feb 2002 22:50:27 -0000      1.4
  +++ ProxyClass.java   24 Feb 2002 04:38:56 -0000      1.5
  @@ -145,14 +145,13 @@
         * Gets the Method attribute of the ProxyClass object
         *
         * @param method Describe what the parameter does
  -      * @param parameters Describe what the parameter does
         * @return The Method value
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public XMethod getMethod(String method, String[] parameters) {
  +     public XMethod getMethod(String method) {
                resolve();
  -             return _subject.getMethod(method, null);
  +             return _subject.getMethod(method);
        }
   
   
  
  
  
  1.6       +9 -0      xjavadoc/src/xjavadoc/Primitive.java
  
  Index: Primitive.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/Primitive.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- Primitive.java    20 Feb 2002 00:12:01 -0000      1.5
  +++ Primitive.java    24 Feb 2002 04:38:56 -0000      1.6
  @@ -58,5 +58,14 @@
                setName(name);
                setContainingPackage(null);
        }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @todo-javadoc Write javadocs for method
  +      */
  +     protected void complete() {
  +     }
   }
   
  
  
  
  1.4       +11 -1     xjavadoc/src/xjavadoc/MethodImpl.java
  
  Index: MethodImpl.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/MethodImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- MethodImpl.java   22 Feb 2002 20:22:30 -0000      1.3
  +++ MethodImpl.java   24 Feb 2002 04:38:56 -0000      1.4
  @@ -139,7 +139,17 @@
         * @todo-javadoc Write javadocs for return value
         */
        public String toString() {
  -             return name();
  +             StringBuffer sb = new StringBuffer();
  +             sb.append(modifiers());
  +             sb.append(" ");
  +             sb.append(returnType());
  +             for (int i = returnDimension() - 1; i >= 0; i--) {
  +                     sb.append("[]");
  +             }
  +             sb.append(" ");
  +             sb.append(name());
  +             sb.append(signature());
  +             return sb.toString();
        }
   
        /*
  
  
  
  1.8       +3 -3      xjavadoc/src/xjavadoc/ClassDump.java
  
  Index: ClassDump.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/ClassDump.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -r1.7 -r1.8
  --- ClassDump.java    22 Feb 2002 20:22:30 -0000      1.7
  +++ ClassDump.java    24 Feb 2002 04:38:56 -0000      1.8
  @@ -44,7 +44,7 @@
    * @author Ara Abrahamian ([EMAIL PROTECTED])
    * @author <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
    * @created Feb 2, 2002
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class ClassDump extends Task {
   
  @@ -161,8 +161,8 @@
                for (int i = 0; i < methods.length; i++) {
                        XMethod method = methods[i];
                        System.out.println("method=" + method);
  -                     System.out.println("method.returnType().qualifiedName()=" + 
method.returnType().qualifiedName());
  -                     System.out.println("method.signature()=" + method.signature());
  +//                   System.out.println("method.returnType().qualifiedName()=" + 
method.returnType().qualifiedName());
  +//                   System.out.println("method.signature()=" + method.signature());
                }
   
                if (!clazz.qualifiedName().equals("java.lang.Object")) {
  
  
  
  1.5       +33 -3     xjavadoc/src/xjavadoc/BinaryClass.java
  
  Index: BinaryClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/BinaryClass.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- BinaryClass.java  22 Feb 2002 22:50:27 -0000      1.4
  +++ BinaryClass.java  24 Feb 2002 04:38:56 -0000      1.5
  @@ -47,10 +47,22 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
    * @created February 17, 2002
    * @todo-javadoc Write javadocs
  + * @todo lazy instantiate members
    */
   class BinaryClass extends AbstractClass {
   
        /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private final Class _clazz;
  +
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private boolean _isMembersAssigned = false;
  +
  +
  +     /**
         * Describe what the BinaryClass constructor does
         *
         * @param clazz Describe what the parameter does
  @@ -61,6 +73,7 @@
         */
        public BinaryClass(Class clazz) {
                super(null, clazz.getName());
  +             _clazz = clazz;
   
                addModifier(clazz.getModifiers());
   
  @@ -79,8 +92,6 @@
                        setSuperclass(superclassName);
                }
   
  -             setMethods(clazz);
  -             setConstructors(clazz);
                setInterfaces(clazz);
        }
   
  @@ -88,6 +99,20 @@
        /**
         * Describe what the method does
         *
  +      * @todo-javadoc Write javadocs for method
  +      */
  +     protected void complete() {
  +             if (!_isMembersAssigned) {
  +                     setMethods(_clazz);
  +                     setConstructors(_clazz);
  +                     _isMembersAssigned = true;
  +             }
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
         * @param clazz The new Constructors value
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
  @@ -96,6 +121,7 @@
                Constructor[] constructors = clazz.getDeclaredConstructors();
                for (int i = 0; i < constructors.length; i++) {
                        ConstructorImpl xconstructor = new ConstructorImpl(this, 
constructors[i].getName());
  +                     xconstructor.addModifier(constructors[i].getModifiers());
                        populateExecutableMember(xconstructor, constructors[i]);
                        addConstructor(xconstructor);
                }
  @@ -110,7 +136,10 @@
         * @todo-javadoc Write javadocs for return value
         */
        private void setInterfaces(Class clazz) {
  -             _xinterfaces = clazz.getInterfaces();
  +             Class[] interfaces = clazz.getInterfaces();
  +             for (int i = 0; i < interfaces.length; i++) {
  +                     addInterface(interfaces[i].getName());
  +             }
        }
   
   
  @@ -125,6 +154,7 @@
                Method[] methods = clazz.getDeclaredMethods();
                for (int i = 0; i < methods.length; i++) {
                        MethodImpl xmethod = new MethodImpl(this, 
methods[i].getName());
  +                     xmethod.addModifier(methods[i].getModifiers());
                        populateExecutableMember(xmethod, methods[i]);
                        Class returnType = methods[i].getReturnType();
                        xmethod.setReturnType(returnType.getName());
  
  
  
  1.3       +44 -29    xjavadoc/src/xjavadoc/AbstractProgramElement.java
  
  Index: AbstractProgramElement.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/AbstractProgramElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- AbstractProgramElement.java       20 Feb 2002 00:12:01 -0000      1.2
  +++ AbstractProgramElement.java       24 Feb 2002 04:38:56 -0000      1.3
  @@ -105,6 +105,7 @@
        public final void setToken(Token token) {
                if (_token == null && token != null) {
                        _token = token;
  +                     setJavaDoc();
                }
        }
   
  @@ -122,32 +123,13 @@
        /**
         * Sets the QualifiedName attribute of the AbstractProgramElement object
         *
  -      * @param javaDoc The new Doc value
  +      * @return The Final value
         */
        //public final void setQualifiedName(String qualifiedName) {
        //      _qualifiedName = qualifiedName;
        //}
   
   
  -
  -     /**
  -      * Sets the Doc attribute of the SourceClass object
  -      *
  -      * @todo keep the bloody token, so we can modify it later.
  -      * @param javaDoc The new Doc value
  -      */
  -     public final void setDoc(Token javaDoc) {
  -             if (javaDoc != null) {
  -                     if (_doc != null) {
  -                             //throw new IllegalStateException("Doc has already 
been set!!");
  -                     }
  -                     else {
  -                             _doc = new XDoc(javaDoc, _token);
  -                     }
  -             }
  -     }
  -
  -
        /**
         * Gets the Final attribute of the AbstractProgramElement object
         *
  @@ -254,27 +236,24 @@
        public final XDoc doc() {
                if (_doc == null) {
                        // there was no doc in the original source. Create it.
  -                     Token firstParentToken = _token;
  -                     // We have to create a new token and attach it
  +                     // We have to create a new token and attach it to _token as 
specialToken
                        // The pre and post tokens are only to ensure proper line 
breaks before and after
                        Token preJavadocToken = 
Token.newToken(JavaParserConstants.DEFAULT);
                        preJavadocToken.image = "\n\n";
  +
                        Token javadocToken = 
Token.newToken(JavaParserConstants.FORMAL_COMMENT);
                        javadocToken.image = "";
  +
                        Token postJavadocToken = 
Token.newToken(JavaParserConstants.DEFAULT);
                        postJavadocToken.image = "\n";
   
                        // Link the new tokens properly
  -                     preJavadocToken.previous = firstParentToken.previous;
                        preJavadocToken.next = javadocToken;
  -                     javadocToken.previous = preJavadocToken;
                        javadocToken.next = postJavadocToken;
  -                     postJavadocToken.previous = javadocToken;
  -
  -                     //postJavadocToken.next = firstParentToken;
   
  -                     firstParentToken.specialToken = preJavadocToken;
  -                     _doc = new XDoc(javadocToken, firstParentToken);
  +                     _token.specialToken = preJavadocToken;
  +//                   _doc = new XDoc(javadocToken, firstParentToken);
  +                     _doc = new XDoc(javadocToken);
                }
                return _doc;
        }
  @@ -327,6 +306,42 @@
                }
                else {
                        return null;
  +             }
  +     }
  +
  +
  +     /**
  +      * Sets the JavaDoc attribute of the AbstractProgramElement object
  +      */
  +     private final void setJavaDoc() {
  +             Token javadoc = null;
  +
  +             Token tt = _token.specialToken;
  +             if (tt != null) {
  +                     while (tt.specialToken != null) {
  +                             tt = tt.specialToken;
  +                     }
  +                     while (tt != null) {
  +                             if (tt.kind == JavaParserConstants.FORMAL_COMMENT) {
  +                                     // it's JavaDoc
  +                                     javadoc = tt;
  +                             }
  +                             else if (tt.kind == 
JavaParserConstants.SINGLE_LINE_COMMENT || tt.kind == 
JavaParserConstants.MULTI_LINE_COMMENT) {
  +                                     // reset it. some other comment is standalone 
or followed what could have been a javadoc comment
  +                                     //_log.debug("Not javadoc anyway:" + tt.image);
  +                                     javadoc = null;
  +                             }
  +                             tt = tt.next;
  +                     }
  +             }
  +             if (javadoc != null) {
  +                     // There was javadoc here!
  +                     if (_doc != null) {
  +                             throw new IllegalStateException("Doc has already been 
set!!");
  +                     }
  +                     else {
  +                             _doc = new XDoc(javadoc);
  +                     }
                }
        }
   
  
  
  
  1.6       +252 -147  xjavadoc/src/xjavadoc/AbstractClass.java
  
  Index: AbstractClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/AbstractClass.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- AbstractClass.java        22 Feb 2002 22:50:27 -0000      1.5
  +++ AbstractClass.java        24 Feb 2002 04:38:56 -0000      1.6
  @@ -53,22 +53,30 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     protected Object[] _ximportedClasses;
  +     protected XClass[] _xinterfaces;
  +
        /**
         * @todo-javadoc Describe the field
         */
  -     protected Object[] _ximportedPackages;
  -
  +     private XClass[] _ximportedClasses;
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private ArrayList _importedClasses;
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private XPackage[] _ximportedPackages;
        /**
         * @todo-javadoc Describe the field
         */
  -     protected XConstructor[] _xconstructors;
  +     private ArrayList _importedPackages;
   
        /**
  -      * The same Object[] is used to store the literal form of interfaces and it's
  -      * converted/qualified to XClass[] on first use!
  +      * @todo-javadoc Describe the field
         */
  -     protected Object[] _xinterfaces;
  +     private XConstructor[] _xconstructors;
  +
        /**
         * @todo-javadoc Describe the field
         */
  @@ -77,11 +85,20 @@
        /**
         * @todo-javadoc Describe the field
         */
  +     private ArrayList _interfaces;
  +
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
        private XMethod[] _xmethods;
        /**
         * @todo-javadoc Describe the field
         */
        private ArrayList _methods;
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private HashMap _namedMethods;
   
        /**
         * @todo-javadoc Describe the field
  @@ -95,7 +112,11 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     private HashMap _innerClasses;
  +     private XClass[] _xinnerClasses;
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private ArrayList _innerClasses;
   
        /**
         * @todo-javadoc Describe the field
  @@ -115,11 +136,20 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     protected final static XClass[] NULL_CLASSES = new XClass[0];
  +     private final static XClass[] ZERO_CLASSES = new XClass[0];
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private final static XField[] ZERO_FIELDS = new XField[0];
        /**
         * @todo-javadoc Describe the field
         */
  -     protected final static XConstructor[] NULL_CONSTRUCTORS = new XConstructor[0];
  +     private final static XConstructor[] ZERO_CONSTRUCTORS = new XConstructor[0];
  +
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private final static XMethod[] ZERO_METHODS = new XMethod[0];
   
        /**
         * Get static reference to Log4J Logger
  @@ -176,57 +206,6 @@
   
   
        /**
  -      * Sets the ImportedClasses attribute of the AbstractClass object
  -      *
  -      * @param imported_classes The new ImportedClasses value
  -      */
  -     public void setImportedClasses(String[] imported_classes) {
  -             _ximportedClasses = imported_classes;
  -     }
  -
  -
  -     /**
  -      * Sets the ImportedPackages attribute of the AbstractClass object
  -      *
  -      * @param imported_packages The new ImportedPackages value
  -      */
  -     public void setImportedPackages(String[] imported_packages) {
  -             _ximportedPackages = imported_packages;
  -     }
  -
  -
  -     /**
  -      * Describe the method
  -      *
  -      * @param nameList Describe the method parameter
  -      * @todo-javadoc Describe the method
  -      * @todo-javadoc Describe the method parameter
  -      */
  -     public final void setInterfaces(String nameList) {
  -             StringTokenizer st = new StringTokenizer(nameList, ",");
  -
  -             _xinterfaces = new Object[st.countTokens()];
  -
  -             int i = 0;
  -             while (st.hasMoreTokens()) {
  -                     _xinterfaces[i] = st.nextToken();
  -                     i++;
  -             }
  -
  -             /*
  -              *  XClass interfaze = qualify(implementedInterface);
  -              *  _interfaces.add(interfaze);
  -              *  _interfaces.addAll(Arrays.asList(interfaze.interfaces()));
  -              *  /_log.debug("ADD INTERFACE: " + implementedInterface + " to " + 
qualifiedName());
  -              *  /_log.debug("-------------> " + interfaze.qualifiedName());
  -              *  for (int i = interfaze.interfaces().length - 1; i >= 0; i--) {
  -              *  /_log.debug("-------------> " + 
interfaze.interfaces()[i].qualifiedName());
  -              *  }
  -              */
  -     }
  -
  -
  -     /**
         * Gets the Interface attribute of the SourceClass object
         *
         * @return The Interface value
  @@ -260,37 +239,37 @@
   
   
        /**
  -      * Returns an XMethod with the given name and parameters. Because we're not
  -      * going to call this method quite often there's no need for a Map-backed list
  -      * of methods. Example: getMethod("hello",new
  -      * String[]{"java.lang.String","int"});
  +      * Ara: Returns an XMethod with the given name and parameters. Because we're
  +      * not going to call this method quite often there's no need for a Map-backed
  +      * list of methods. Example: getMethod("hello",new
  +      * String[]{"java.lang.String","int"}); public final XMethod getMethod(String
  +      * methodName, String[] parameters) { if (_methods == null) { return null; }
  +      * for (int i = 0; i < _methods.size(); i++) { XMethod method =
  +      * (XMethod)_methods.get(i); if (method.name().equals(methodName)) {
  +      * XParameter[] method_params = method.parameters(); if ((parameters == null &&
  +      * method_params.length == 0) || Arrays.equals(parameters, method_params) ==
  +      * true) { return method; } } } return null; } Aslak: Disagree. It's low-cost
  +      * to instantiate a HashMap, since it only happens when methods are accessed,
  +      * and the overhead is big in that case anyway. And with your approach there is
  +      * more object creation. An array is instantiated. With the recent wait()
  +      * system, this optimisation seems like a pee in the ocean to me ;-)
         *
  -      * @param methodName Describe what the parameter does
  -      * @param parameters Describe what the parameter does
  +      * @param methodNameWithSignature Describe what the parameter does
         * @return The Method value
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         */
  -     public final XMethod getMethod(String methodName, String[] parameters) {
  -
  -             if (_methods == null) {
  -                     return null;
  -             }
  -
  -             for (int i = 0; i < _methods.size(); i++) {
  -                     XMethod method = (XMethod)_methods.get(i);
  -
  -                     if (method.name().equals(methodName)) {
  -                             XParameter[] method_params = method.parameters();
  -
  -                             if ((parameters == null && method_params.length == 0) 
|| Arrays.equals(parameters, method_params) == true) {
  -                                     return method;
  +     public final XMethod getMethod(String methodNameWithSignature) {
  +             complete();
  +             if (_namedMethods != null) {
  +                     return (XMethod)_namedMethods.get(methodNameWithSignature);
                                }
  +             else {
  +                     return null;
                        }
                }
   
  -             return null;
  -     }
   
   
        /**
  @@ -319,6 +298,70 @@
   
   
        /**
  +      * Sets the ImportedClasses attribute of the AbstractClass object
  +      *
  +      * @param importedClass Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      */
  +     public void addImportedClass(String importedClass) {
  +             if (_importedClasses == null) {
  +                     _importedClasses = new ArrayList();
  +             }
  +             _importedClasses.add(importedClass);
  +     }
  +
  +
  +     /**
  +      * Sets the ImportedPackages attribute of the AbstractClass object
  +      *
  +      * @param importedPackage Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      */
  +     public void addImportedPackage(String importedPackage) {
  +             if (_importedPackages == null) {
  +                     _importedPackages = new ArrayList();
  +             }
  +             _importedPackages.add(importedPackage);
  +     }
  +
  +
  +     /**
  +      * Describe the method
  +      *
  +      * @param interfaceName Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      * @todo-javadoc Describe the method
  +      * @todo-javadoc Describe the method parameter
  +      */
  +     public final void addInterface(String interfaceName) {
  +             if (_interfaces == null) {
  +                     _interfaces = new ArrayList();
  +             }
  +             _interfaces.add(interfaceName);
  +
  +             /*
  +              *  StringTokenizer st = new StringTokenizer(nameList, ",");
  +              *  _xinterfaces = new Object[st.countTokens()];
  +              *  int i = 0;
  +              *  while (st.hasMoreTokens()) {
  +              *  _xinterfaces[i] = st.nextToken();
  +              *  i++;
  +              *  }
  +              */
  +             /*
  +              *  XClass interfaze = qualify(implementedInterface);
  +              *  _interfaces.add(interfaze);
  +              *  _interfaces.addAll(Arrays.asList(interfaze.interfaces()));
  +              *  /_log.debug("ADD INTERFACE: " + implementedInterface + " to " + 
qualifiedName());
  +              *  /_log.debug("-------------> " + interfaze.qualifiedName());
  +              *  for (int i = interfaze.interfaces().length - 1; i >= 0; i--) {
  +              *  /_log.debug("-------------> " + 
interfaze.interfaces()[i].qualifiedName());
  +              *  }
  +              */
  +     }
  +
  +
  +     /**
         * Describe what the method does
         *
         * @return Describe the return value
  @@ -388,6 +431,10 @@
         * @todo-javadoc Write javadocs for return value
         */
        public final XMethod[] methods() {
  +             complete();
  +             if (_methods == null) {
  +                     return ZERO_METHODS;
  +             }
                if (_xmethods == null) {
                        _xmethods = new XMethod[_methods.size()];
                        _xmethods = (XMethod[])_methods.toArray(_xmethods);
  @@ -404,7 +451,10 @@
         * @todo-javadoc Write javadocs for return value
         */
        public final XField[] fields() {
  -
  +             complete();
  +             if (_fields == null) {
  +                     return ZERO_FIELDS;
  +             }
                if (_xfields == null) {
                        _xfields = new XField[_fields.size()];
                        _xfields = (XField[])_fields.toArray(_xfields);
  @@ -424,8 +474,9 @@
         * @return the constructors.
         */
        public final XConstructor[] constructors() {
  +             complete();
                if (_constructors == null) {
  -                     return NULL_CONSTRUCTORS;
  +                     return ZERO_CONSTRUCTORS;
                }
   
                if (_xconstructors == null) {
  @@ -436,6 +487,7 @@
                        // not abstract or interface
                        //Ara: I disagree. We're in business of code 
generation/mutation unlike javadoc which is in business of docs.
                        // We should be accurate. We also support code mutation. How 
are you going to mutate a nonexisting constructor?
  +                     //Aslak: agree :-)
   
   //                   if (_constructors.size() == 0 && !isInterface() && 
!isAbstract()) {
   //                           _constructors.add(new SourceConstructor(this));
  @@ -457,60 +509,33 @@
         * @todo-javadoc Write javadocs for return value
         */
        public final XClass[] interfaces() {
  -             if (_xinterfaces == null) {
  -                     return NULL_CLASSES;
  -             }
  -
  -             //elements of the array may be Strings so iterate and convert them to 
XClass
  -             for (int i = 0; i < _xinterfaces.length; i++) {
  -                     Object xinterface = _xinterfaces[i];
  -
  -                     if (xinterface instanceof String) {
  -                             _xinterfaces[i] = qualify((String)xinterface);
  -                     }
  -             }
  -
  -             return (XClass[])_xinterfaces;
  +             if (_interfaces == null) {
  +                     return ZERO_CLASSES;
        }
   
  -
  -     /**
  -      * Describe the method
  -      *
  -      * @param method Describe the method parameter
  -      * @todo-javadoc Describe the method
  -      * @todo-javadoc Describe the method parameter
  -      */
  -     public final void addMethod(XMethod method) {
  -             getMethods().add(method);
  +             if (_xinterfaces == null) {
  +                     _xinterfaces = new XClass[_interfaces.size()];
  +                     for (int i = _interfaces.size() - 1; i >= 0; i--) {
  +                             _xinterfaces[i] = qualify((String)_interfaces.get(i));
        }
  -
  -
  -     /**
  -      * Describe the method
  -      *
  -      * @param field Describe the method parameter
  -      * @todo-javadoc Describe the method
  -      * @todo-javadoc Describe the method parameter
  -      */
  -     public final void addField(XField field) {
  -             getFields().add(field);
        }
  -
  -
  -     /**
  -      * Describe the method
  -      *
  -      * @param constructor Describe the method parameter
  -      * @todo-javadoc Describe the method
  -      * @todo-javadoc Describe the method parameter
  +             return _xinterfaces;
  +             /*
  +              *  if (_xinterfaces == null) {
  +              *  return ZERO_CLASSES;
  +              *  }
  +              *  /elements of the array may be Strings so iterate and convert them 
to XClass
  +              *  for (int i = 0; i < _xinterfaces.length; i++) {
  +              *  Object xinterface = _xinterfaces[i];
  +              *  if (xinterface instanceof String) {
  +              *  _xinterfaces[i] = qualify((String)xinterface);
  +              *  }
  +              *  }
  +              *  return (XClass[])_xinterfaces;
         */
  -     public final void addConstructor(XConstructor constructor) {
  -             getConstructors().add(constructor);
        }
   
   
  -
        /**
         * Describe what the method does
         *
  @@ -613,7 +638,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public final String toString() {
  -             return getClass().getName() + ":" + qualifiedName();
  +             return qualifiedName() + "[" + getClass().getName() + "]";
        }
   
   
  @@ -635,56 +660,136 @@
        /**
         * Gets the Constructors attribute of the AbstractClass object
         *
  -      * @return The Constructors value
  +      * @param constructor Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
         */
  -     protected ArrayList getConstructors() {
  +     public void addConstructor(XConstructor constructor) {
   
                if (_constructors == null) {
                        _constructors = new ArrayList();
                }
   
  -             return _constructors;
  +             _constructors.add(constructor);
        }
   
   
        /**
         * Gets the Fields attribute of the AbstractClass object
         *
  -      * @return The Fields value
  +      * @param field Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
         */
  -     protected ArrayList getFields() {
  +     public void addField(XField field) {
                if (_fields == null) {
                        _fields = new ArrayList();
                }
   
  -             return _fields;
  +             _fields.add(field);
        }
   
   
        /**
         * Gets the InnerClasses attribute of the AbstractClass object
         *
  -      * @return The InnerClasses value
  +      * @param clazz Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
         */
  -     protected HashMap getInnerClasses() {
  +     public void addInnerClass(XClass clazz) {
                if (_innerClasses == null) {
  -                     _innerClasses = new HashMap();
  +                     _innerClasses = new ArrayList();
                }
   
  -             return _innerClasses;
  +             _innerClasses.add(clazz);
        }
   
   
        /**
         * Gets the Methods attribute of the AbstractClass object
         *
  -      * @return The Methods value
  +      * @param method Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
         */
  -     protected ArrayList getMethods() {
  +     public void addMethod(XMethod method) {
                if (_methods == null) {
                        _methods = new ArrayList();
  +                     _namedMethods = new HashMap();
  +             }
  +
  +             _methods.add(method);
  +             _namedMethods.put(method.name() + method.signature(), method);
  +     }
  +
  +
  +     /**
  +      * Gets the ImportedClassName attribute of the AbstractClass object
  +      *
  +      * @param i Describe what the parameter does
  +      * @return The ImportedClassName value
  +      * @todo-javadoc Write javadocs for method parameter
  +      */
  +     protected final String getImportedClassName(int i) {
  +             return (String)_importedClasses.get(i);
  +     }
  +
  +
  +     /**
  +      * Gets the ImportedPackageName attribute of the AbstractClass object
  +      *
  +      * @param i Describe what the parameter does
  +      * @return The ImportedPackageName value
  +      * @todo-javadoc Write javadocs for method parameter
  +      */
  +     protected final String getImportedPackageName(int i) {
  +             return (String)_importedPackages.get(i);
  +     }
  +
  +
  +     /**
  +      * Gets the ImportedClassCount attribute of the AbstractClass object
  +      *
  +      * @return The ImportedClassCount value
  +      */
  +     protected final int getImportedClassCount() {
  +             return _importedClasses.size();
  +     }
  +
  +
  +     /**
  +      * Gets the ImportedPackageCount attribute of the AbstractClass object
  +      *
  +      * @return The ImportedPackageCount value
  +      */
  +     protected final int getImportedPackageCount() {
  +             return _importedPackages.size();
                }
   
  -             return _methods;
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     protected final boolean hasImportedClasses() {
  +             return _importedClasses != null;
        }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     protected final boolean hasImportedPackages() {
  +             return _importedPackages != null;
  +     }
  +
  +
  +     /**
  +      * This method completes the class' fields, constructors and methods.
  +      */
  +     protected abstract void complete();
   }
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to