User: rinkrank
  Date: 02/03/10 09:56:01

  Modified:    src/xjavadoc XTagTest.java XTagFactory.java XTag.java
                        XJavaDocTest.java XJavaDoc.java XDoc.java
                        XClass.java UnknownClass.java SourceClass.java
                        SimpleNode.java ProxyClass.java Primitive.java
                        DefaultXTagFactory.java DefaultXTag.java
                        BinaryClass.java AbstractProgramElement.java
                        AbstractClass.java
  Removed:     src/xjavadoc XTagParameter.java Token.java
  Log:
  -Modified grammar and core, so both plain JavaCC and JJTree is supported.
  JavaCC is faster, and will be used by XDoclet. The sources will be read-only. JJTree 
is slower,
  but enables svaing of (modified) sources.
  -Removed XTagParameter class for the sake of simpler API and implementation
  -Removed old benchmark tests
  -Fixed some more deadlock issues
  -Implemented wait/notify in interfaces too
  -And some more tests (I think)
  
  Revision  Changes    Path
  1.6       +5 -10     xjavadoc/src/xjavadoc/XTagTest.java
  
  Index: XTagTest.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XTagTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- XTagTest.java     20 Feb 2002 00:12:00 -0000      1.5
  +++ XTagTest.java     10 Mar 2002 17:56:00 -0000      1.6
  @@ -70,16 +70,11 @@
         * @todo-javadoc Write javadocs for exception
         */
        public void testSimpleOne() throws Exception {
  -             String text = "one=\"en\" two=\"to\" fiftysix=\"femti seks\" 
two=\"deux\"";
  -             XTag tag = XTagFactory.getInstance().createTag("test", text, null);
  -             XTagParameter[] tagParameters = tag.getParameters("two");
  -             assertEquals(2, tagParameters.length);
  -             assertEquals("two", tagParameters[0].name());
  -             assertEquals("to", tagParameters[0].value());
  -             assertEquals("two=\"to\"", tagParameters[0].toString());
  -             assertEquals("two", tagParameters[1].name());
  -             assertEquals("deux", tagParameters[1].value());
  -             assertEquals("two=\"deux\"", tagParameters[1].toString());
  +             String text = "one=\"en\" two=\"to\" fiftysix=\"femti seks\"";
  +             XTag tag = XTagFactory.getInstance().createTag("test", text);
  +             assertEquals("en", tag.getAttribute("one"));
  +             assertEquals("to", tag.getAttribute("two"));
  +             assertEquals("femti seks", tag.getAttribute("fiftysix"));
        }
   
   }
  
  
  
  1.3       +1 -2      xjavadoc/src/xjavadoc/XTagFactory.java
  
  Index: XTagFactory.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XTagFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- XTagFactory.java  20 Feb 2002 00:12:01 -0000      1.2
  +++ XTagFactory.java  10 Mar 2002 17:56:00 -0000      1.3
  @@ -61,7 +61,6 @@
         *
         * @param tagName Describe what the parameter does
         * @param text Describe what the parameter does
  -      * @param doc Describe what the parameter does
         * @return Describe the return value
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for method parameter
  @@ -69,7 +68,7 @@
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for return value
         */
  -     public abstract XTag createTag(String tagName, String text, XDoc doc);
  +     public abstract XTag createTag(String tagName, String text);
   
   
        /**
  
  
  
  1.10      +15 -30    xjavadoc/src/xjavadoc/XTag.java
  
  Index: XTag.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -r1.9 -r1.10
  --- XTag.java 20 Feb 2002 00:12:01 -0000      1.9
  +++ XTag.java 10 Mar 2002 17:56:00 -0000      1.10
  @@ -41,39 +41,31 @@
    * @todo implement equals. seems xdoclet.util.DocletUtil.getTagsByName() wants
    *      it
    */
  -public interface XTag extends Comparable {
  +public interface XTag {
        /**
  -      * Returns the first tag parameter with the given name, or null if none exist;
  +      * Returns the value of the tag parameter with the given name, or null if none
  +      * exist;
         *
         * @todo don't throw exception
  -      * @param parameterName Describe what the parameter does
  +      * @param attributeName Describe what the parameter does
         * @return The Parameter value
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for exception
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public XTagParameter getParameter(String parameterName);
  +     public String getAttribute(String attributeName);
   
   
        /**
         * Returns all tag parameters with the given name, or an empty array if none
         * exist;
         *
  -      * @param parameterName Describe what the parameter does
         * @return The Parameters value
         * @todo-javadoc Write javadocs for exception
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public XTagParameter[] getParameters(String parameterName);
  -
  -
  -     /**
  -      * Returns all tag parameters
  -      *
  -      * @return all tag parameters
  -      * @todo-javadoc Write javadocs for exception
  -      */
  -     public XTagParameter[] getParameters();
  +     public String[] getAttributeNames();
   
   
        /**
  @@ -97,9 +89,8 @@
        /**
         * Adds a parameter
         *
  -      * @param attribute Describe the method parameter
  -      * @param value Describe the method parameter
  -      * @return Describe the return value
  +      * @param attributeName The new Attribute value
  +      * @param attributeValue The new Attribute value
         * @todo-javadoc Describe the method parameter
         * @todo-javadoc Describe the method parameter
         * @todo-javadoc Write javadocs for return value
  @@ -107,28 +98,22 @@
         * @todo-javadoc Describe the method parameter
         * @todo-javadoc Describe the method parameter
         */
  -     public XTagParameter addTagParameter(String attribute, String value);
  +     public void setAttribute(String attributeName, String attributeValue);
   
   
        /**
         * Describe what the method does
         *
  -      * @param tagParameter Describe what the parameter does
  +      * @param attributeName Describe what the parameter does
         * @return Describe the return value
  +      * @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 return value
         */
  -     public boolean removeTagParameter(XTagParameter tagParameter);
  -
  +     public String removeAttribute(String attributeName);
   
  -     /**
  -      * This method is called by any aggregated XTagParameter when it is modified,
  -      * in order to notify the surrounding XDoc about the change, so it gets a
  -      * chance to reformat itself. Hopefully we can remove this method.
  -      *
  -      * @todo try to remove this method
  -      */
  -     public void formatDoc();
  +//   public void formatDoc();
   }
   
  
  
  
  1.18      +1 -1      xjavadoc/src/xjavadoc/XJavaDocTest.java
  
  Index: XJavaDocTest.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XJavaDocTest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -w -r1.17 -r1.18
  --- XJavaDocTest.java 1 Mar 2002 10:44:40 -0000       1.17
  +++ XJavaDocTest.java 10 Mar 2002 17:56:00 -0000      1.18
  @@ -113,7 +113,7 @@
                assertEquals("", tags[1].value());
   
                doc = clazz.getMethod("whatever(java.lang.String[][],int)").doc();
  -             assertEquals("", doc.firstSentence());
  +             assertEquals("Mr.", doc.firstSentence());
                tags = doc.tags();
                assertEquals("more", tags[0].name());
                assertEquals("testdata, bla bla", tags[0].value());
  
  
  
  1.21      +62 -23    xjavadoc/src/xjavadoc/XJavaDoc.java
  
  Index: XJavaDoc.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XJavaDoc.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -w -r1.20 -r1.21
  --- XJavaDoc.java     1 Mar 2002 10:44:40 -0000       1.20
  +++ XJavaDoc.java     10 Mar 2002 17:56:00 -0000      1.21
  @@ -117,11 +117,6 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     private static JavaParser _javaParser;
  -
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
        private final static HashMap _primitiveClasses = new HashMap();
   
   
  @@ -203,13 +198,27 @@
         * method will return a proxy class if the class hasn't previouslu been loaded.
         *
         * @param qualifiedName Describe what the parameter does
  +      * @param saveable true -> slower parsing, but the class can be saved after it
  +      *      has been modified. false -> fast parsing, but the class can't be saved.
         * @return The XClass value
         * @todo-javadoc Write javadocs for method parameter
         * @pre qualifiedName != null
         * @post return != null
         */
  +     public XClass getXClass(String qualifiedName, boolean saveable) {
  +             return getXClass(qualifiedName, true, saveable);
  +     }
  +
  +
  +     /**
  +      * Returns a non saveable class
  +      *
  +      * @param qualifiedName Describe what the parameter does
  +      * @return The XClass value
  +      * @todo-javadoc Write javadocs for method parameter
  +      */
        public XClass getXClass(String qualifiedName) {
  -             return getXClass(qualifiedName, true);
  +             return getXClass(qualifiedName, true, false);
        }
   
   
  @@ -266,7 +275,7 @@
                        String parameterValue,
                        int tagIndex
                        ) throws XJavaDocException {
  -             XClass clazz = getXClass(className, false);
  +             XClass clazz = getXClass(className, false, true);
                XMethod method = clazz.getMethod(methodNameWithSignature);
                XDoc doc = method.doc();
                doc.updateTagValue(tagName, parameterName, parameterValue, tagIndex);
  @@ -301,7 +310,7 @@
                        int tagIndex
                        ) throws XJavaDocException {
                // Don't get proxy. It's only overhead
  -             XClass clazz = getXClass(className, false);
  +             XClass clazz = getXClass(className, false, true);
                XDoc doc = clazz.doc();
                doc.updateTagValue(tagName, parameterName, parameterValue, tagIndex);
                return clazz;
  @@ -326,10 +335,19 @@
                        String qualifiedName = _files[i].replace('/', '.');
                        qualifiedName = qualifiedName.replace('\\', '.');
                        qualifiedName = qualifiedName.substring(0, 
qualifiedName.length() - 5);
  -                     XClass clazz = scanAndPut(qualifiedName);
  +                     XClass clazz = getXClass(qualifiedName);
  +//                   Uncomment this line to see what performance is like when all 
classes are parsed completely
  +                     XClass[] intfs = clazz.interfaces();
  +                     /*
  +                      *  XMethod[] methods = clazz.methods();
  +                      *  if (methods.length > 0) {
  +                      *  XClass ret = methods[0].returnType();
  +                      *  XMethod[] retmet = ret.methods();
  +                      *  }
  +                      */
                }
                long end = System.currentTimeMillis();
  -             System.out.println("Scanned " + _sourceClasses.size() + " classes in " 
+ (end - start) + " milliseconds.");
  +             System.out.println("Scanned " + _files.length + " classes in " + (end 
- start) + " milliseconds.");
                printMemoryStatus();
                if (_docletClass != null) {
                        invokeDoclet();
  @@ -374,7 +392,7 @@
   
   
        /**
  -      * Describe what the method does
  +      * Returns the XPackage with the given name
         *
         * @param s Describe what the parameter does
         * @return Describe the return value
  @@ -392,14 +410,16 @@
         * source, a precompiled class or a primitive. UnknownClass is never returned
         * from this method. If a class can't be resolved, null is returned.
         *
  -      * @param qualifiedName Describe what the parameter does
  -      * @param proxyIfNotCached Describe what the parameter does
  +      * @param qualifiedName Fully qualified class name
  +      * @param proxyIfNotCached Return a proxy if the class is not cached
  +      * @param useNodeParser Use node parser if true. This means the class can be
  +      *      saved.
         * @return The XClass value
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         * @pre qualifiedName != null
         */
  -     XClass getXClass(String qualifiedName, boolean proxyIfNotCached) {
  +     XClass getXClass(String qualifiedName, boolean proxyIfNotCached, boolean 
useNodeParser) {
                if (_dir == null) {
                        throw new IllegalStateException("setDir must pe called 
first!");
                }
  @@ -431,7 +451,7 @@
                        if (proxyIfNotCached) {
                                // Return a proxy class since proxyIfNotCached is true
                                // The will ask for a non-proxy later
  -                             ProxyClass proxyClass = getProxyClass(qualifiedName);
  +                             ProxyClass proxyClass = getProxyClass(qualifiedName, 
useNodeParser);
                                result = proxyClass;
                        }
                        else {
  @@ -440,7 +460,7 @@
                                if (sourceExists(qualifiedName, false)) {
                                        // The source exists. Let's parse it.
                                        try {
  -                                             sourceClass = 
scanAndPut(qualifiedName);
  +                                             sourceClass = 
scanAndPut(qualifiedName, useNodeParser);
                                                result = sourceClass;
                                        } catch (XJavaDocException e1) {
                                                throw new IllegalStateException("Error 
during parse:" + e1.getMessage());
  @@ -535,16 +555,18 @@
         * Gets the ProxyClass attribute of the XJavaDoc object
         *
         * @param qualifiedName Describe what the parameter does
  +      * @param useNodeParser Describe what the parameter does
         * @return The ProxyClass value
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         */
  -     private ProxyClass getProxyClass(String qualifiedName) {
  +     private ProxyClass getProxyClass(String qualifiedName, boolean useNodeParser) {
                if (qualifiedName.equals("")) {
                        throw new IllegalStateException("Classname can't be empty 
String");
                }
                ProxyClass result = (ProxyClass)_proxyClasses.get(qualifiedName);
                if (result == null) {
  -                     result = new ProxyClass(qualifiedName);
  +                     result = new ProxyClass(qualifiedName, useNodeParser);
                        _proxyClasses.put(qualifiedName, result);
                }
                return result;
  @@ -552,17 +574,21 @@
   
   
        /**
  -      * Describe what the method does
  +      * Scan's a class' header and puts it in the cache. If the class' body methods
  +      * are called (like methods()), the thread will block until the rest is parsed
  +      * (if not already done).
         *
         * @param qualifiedName Describe what the parameter does
  +      * @param useNodeParser 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
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for return value
         * @todo-javadoc Write javadocs for exception
         */
  -     private SourceClass scanAndPut(String qualifiedName) throws XJavaDocException {
  +     private SourceClass scanAndPut(String qualifiedName, boolean useNodeParser) 
throws XJavaDocException {
                File f = null;
                f = new File(_dir, qualifiedName.replace('.', '/') + ".java");
                if (!f.exists()) {
  @@ -573,7 +599,7 @@
   
                //sourceClass.parse();
   
  -             ParseThread parseThread = new ParseThread(sourceClass);
  +             ParseThread parseThread = new ParseThread(sourceClass, useNodeParser);
                _parseThreads.add(parseThread);
                // We must wait here until the first part of the parsing is done.
                // we'll be notified by the parser when it's done
  @@ -602,6 +628,12 @@
                System.out.println("MethodImpl instances:      " + 
MethodImpl.instanceCount);
                System.out.println("ConstructorImpl instances: " + 
ConstructorImpl.instanceCount);
                System.out.println("SimpleNode instances:      " + 
SimpleNode.instanceCount);
  +             System.out.println("SourceClass instances:     " + 
SourceClass.instanceCount);
  +             System.out.println("XDoc instances:            " + XDoc.instanceCount);
  +             System.out.println("DefaultXTag instances:     " + 
DefaultXTag.instanceCount);
  +             System.out.println("BinaryClass instances:     " + 
BinaryClass.instanceCount);
  +             System.out.println("UnknownClass instances:    " + 
UnknownClass.instanceCount);
  +             System.out.println("ProxyClass instances:      " + 
ProxyClass.instanceCount);
        }
   
   
  @@ -699,17 +731,24 @@
                 * @todo-javadoc Describe the field
                 */
                private final SourceClass _sourceClass;
  +             /**
  +              * @todo-javadoc Describe the field
  +              */
  +             private final boolean _useNodeParser;
   
   
                /**
                 * Describe what the ParseThread constructor does
                 *
                 * @param sourceClass Describe what the parameter does
  +              * @param useNodeParser Describe what the parameter does
  +              * @todo-javadoc Write javadocs for method parameter
                 * @todo-javadoc Write javadocs for constructor
                 * @todo-javadoc Write javadocs for method parameter
                 */
  -             public ParseThread(SourceClass sourceClass) {
  +             public ParseThread(SourceClass sourceClass, boolean useNodeParser) {
                        super(sourceClass.qualifiedName());
  +                     _useNodeParser = useNodeParser;
                        setDaemon(true);
                        _sourceClass = sourceClass;
                }
  @@ -719,7 +758,7 @@
                 * Main processing method for the ParseThread object
                 */
                public void run() {
  -                     _sourceClass.parse();
  +                     _sourceClass.parse(_useNodeParser);
                        _parseThreads.remove(this);
                }
        }
  
  
  
  1.13      +106 -109  xjavadoc/src/xjavadoc/XDoc.java
  
  Index: XDoc.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XDoc.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -w -r1.12 -r1.13
  --- XDoc.java 1 Mar 2002 10:44:40 -0000       1.12
  +++ XDoc.java 10 Mar 2002 17:56:00 -0000      1.13
  @@ -45,7 +45,6 @@
   import java.util.StringTokenizer;
   import java.util.Iterator;
   import xjavadoc.XTag;
  -import xjavadoc.XTagParameter;
   import xjavadoc.Token;
   import xjavadoc.event.XDocListener;
   import xjavadoc.event.XDocEvent;
  @@ -95,6 +94,10 @@
         * @todo-javadoc Describe the field
         */
        private HashSet _docListeners = new HashSet();
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     public static int instanceCount = 0;
   
        /**
         * Platform specific NEWLINE. Javadoc will use this as new line.
  @@ -117,6 +120,7 @@
         * @todo-javadoc Write javadocs for method parameter
         */
        public XDoc(Token javadocToken) {
  +             instanceCount++;
                _javadocToken = javadocToken;
                if (_javadocToken.image == null) {
                        // the passed token was not from source code, but was created 
because no javadoc existed.
  @@ -128,44 +132,33 @@
        /**
         * Utility method to set the value of a tag parameter. If the tag doesn't
         * exist, it is created. If the parameter doesn't exist it is created. If the
  -      * tag parameter exists, it is created
  +      * tag parameter exists, it is updated.
         *
         * @todo check for ArrayIndexOutOfBoundsException? (1)
         * @param tagName The new TagValue value
  -      * @param parameterName The tag parameter value
  -      * @param parameterValue The new TagValue value
         * @param tagIndex Describe what the parameter does
  +      * @param attributeName Describe what the parameter does
  +      * @param attributeValue Describe what the parameter does
         * @exception XJavaDocException Describe the exception
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for exception
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for exception
         */
  -     public void updateTagValue(String tagName, String parameterName, String 
parameterValue, int tagIndex) throws XJavaDocException {
  +     public void updateTagValue(String tagName, String attributeName, String 
attributeValue, int tagIndex) throws XJavaDocException {
                XTag[] tags = tags(tagName);
                XTag tag = null;
                if (tags.length == 0 || tags.length <= tagIndex) {
                        //_log.debug("@" + tagName + " at index " + tagIndex + " 
doesn't exist. creating new tag");
                        // There was no such tags. Create a new one.
  -                     String tagValue = parameterName + "=\"" + parameterValue + 
"\"";
  -                     tag = addTag(tagName, tagValue);
  -
  -                     tags = tags(tagName);
  -                     //_log.debug("" + tags.length);
  +                     String tagValue = attributeName + "=\"" + attributeValue + 
"\"";
  +                     tag = addTag_Impl(tagName, tagValue);
                }
                else {
                        // (1)
                        tag = tags[tagIndex];
  -                     XTagParameter parameter = tag.getParameter(parameterName);
  -                     if (parameter == null) {
  -                             // parameter doesn't exist. Create it.
  -                             //_log.debug("@" + tagName + " " + parameterName + " 
at index " + tagIndex + " doesn't exist. creating new tag parameter");
  -                             parameter = tag.addTagParameter(parameterName, 
parameterValue);
  -                     }
  -                     else {
  -                             //_log.debug("@" + tagName + " " + parameterName + " 
at index " + tagIndex + " exists. updating tag parameter");
  -                             // parameter exists. Modify it.
  -                             parameter.setValue(parameterValue);
  -                     }
  +                     tag.setAttribute(attributeName, attributeValue);
                }
        }
   
  @@ -177,6 +170,7 @@
         * @return the first XTag with name equal to tagName
         */
        public XTag tag(String tagName) {
  +             parse();
                XTag[] tags = tags(tagName);
                if (tags.length == 0) {
                        return null;
  @@ -209,20 +203,19 @@
         * Utility method to get the value of a tag parameter.
         *
         * @param tagName Describe what the parameter does
  -      * @param parameterName Describe what the parameter does
  +      * @param attributeName Describe what the parameter does
         * @return Describe the return value
         * @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 return value
         */
  -     public String tagValue(String tagName, String parameterName) {
  +     public String tagValue(String tagName, String attributeName) {
                String result = null;
                XTag tag = tag(tagName);
  +             System.out.println("tagName:" + tagName + ":" + tag);
                if (tag != null) {
  -                     XTagParameter parameter = tag.getParameter(parameterName);
  -                     if (parameter != null) {
  -                             result = parameter.value();
  -                     }
  +                     result = tag.getAttribute(attributeName);
                }
                return result;
        }
  @@ -260,6 +253,7 @@
         * @return a String representation of this doc.
         */
        public String toString() {
  +             parse();
                StringBuffer sb = new StringBuffer("/**").append(NEWLINE);
                if (!_commentText.trim().equals("")) {
                        appendWhiteSpaces(sb).append(" * 
").append(_commentText).append(NEWLINE);
  @@ -269,7 +263,7 @@
                XTag[] tags = tags();
                for (int i = 0; i < tags.length; i++) {
                        appendWhiteSpaces(sb).append(" * @").append(tags[i].name());
  -                     XTagParameter[] parameters = tags[i].getParameters();
  +                     String[] parameters = tags[i].getAttributeNames();
                        if (parameters.length == 0) {
                                // no parameters, or malformed
                                sb.append(" ").append(tags[i].value()).append(NEWLINE);
  @@ -277,7 +271,7 @@
                        else {
                                sb.append(NEWLINE);
                                for (int j = 0; j < parameters.length; j++) {
  -                                     appendWhiteSpaces(sb).append(" *    
").append(parameters[j].toString()).append(NEWLINE);
  +                                     appendWhiteSpaces(sb).append(" *    
").append(parameters[j]).append("=\"").append(tags[i].getAttribute(parameters[j])).append("\"").append(NEWLINE);
                                }
                        }
                }
  @@ -294,6 +288,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public String commentText() {
  +             parse();
                return _commentText;
        }
   
  @@ -306,9 +301,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public String firstSentence() {
  -             if (_dirty) {
                        parse();
  -             }
                int dotIndex = _commentText.indexOf(".");
                if (dotIndex != -1) {
                        return _commentText.substring(0, dotIndex) + ".";
  @@ -327,6 +320,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public XTag[] tags() {
  +             parse();
                XTag[] tagArray = new XTag[_allTags.size()];
                return (XTag[])_allTags.toArray(tagArray);
        }
  @@ -342,9 +336,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public XTag[] tags(String tagName) {
  -             if (_dirty) {
                        parse();
  -             }
                ArrayList tags = (ArrayList)_tagMap.get(tagName);
                if (tags == null) {
                        return new XTag[0];
  @@ -357,6 +349,46 @@
   
   
        /**
  +      * Reformats the javadoc String representation.
  +      *
  +      * @todo make package private when we move this class back to xjavadoc package.
  +      * @param tagName Describe the method parameter
  +      * @param text Describe the method parameter
  +      * @return Describe the return value
  +      * @todo-javadoc Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +//   public void format() {
  +//           String newImage = toString();
  +//           if (!newImage.equals(_javadocToken.image)) {
  +//                   _javadocToken.image = newImage;
  +//                   fireDocChanged();
  +//           }
  +//           else {
  +// System.out.println("XDoc: doc didn't change. Not firing event.");
  +//           }
  +//   }
  +
  +
  +     /**
  +      * Describe the method
  +      *
  +      * @param tagName Describe the method parameter
  +      * @param text Describe the method parameter
  +      * @return Describe the return value
  +      * @todo-javadoc Describe the method
  +      * @todo-javadoc Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     private XTag addTag(String tagName, String text) {
  +             parse();
  +             return addTag_Impl(tagName, text);
  +     }
  +
  +
  +     /**
         * Describe the method
         *
         * @param tagName Describe the method parameter
  @@ -367,49 +399,20 @@
         * @todo-javadoc Describe the method parameter
         * @todo-javadoc Describe the method parameter
         */
  -     public XTag addTag(String tagName, String text) {
  -             //_log.debug("addTag: @" + tagName + " " + text);
  +     private XTag addTag_Impl(String tagName, String text) {
                ArrayList tags = (ArrayList)_tagMap.get(tagName);
                if (tags == null) {
                        tags = new ArrayList();
                        _tagMap.put(tagName, tags);
                }
  -             XTag tag = XTagFactory.getInstance().createTag(tagName, text, this);
  +             XTag tag = XTagFactory.getInstance().createTag(tagName, text);
                tags.add(tag);
                _allTags.add(tag);
  -             format();
                return tag;
        }
   
   
        /**
  -      * Reformats the javadoc String representation.
  -      *
  -      * @todo make package private when we move this class back to xjavadoc package.
  -      */
  -     public void format() {
  -             String newImage = toString();
  -             if (!newImage.equals(_javadocToken.image)) {
  -                     _javadocToken.image = newImage;
  -                     fireDocChanged();
  -             }
  -             else {
  -// System.out.println("XDoc: doc didn't change. Not firing event.");
  -             }
  -     }
  -
  -
  -     /**
  -      * @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
  @@ -463,6 +466,7 @@
                StringBuffer docElement = new StringBuffer();
                String tagName = null;
                String line = null;
  +             if (_dirty) {
                try {
                        while ((line = in.readLine()) != null) {
                                if (line.startsWith("@")) {
  @@ -473,7 +477,7 @@
                                        }
                                        else {
                                                // Add the previous tag
  -                                             addTag(tagName, 
docElement.toString().trim());
  +                                                     addTag_Impl(tagName, 
docElement.toString().trim());
                                        }
   
                                        docElement = new StringBuffer();
  @@ -496,25 +500,18 @@
                        }
                        else {
                                // Add the previous tag
  -                             addTag(tagName, docElement.toString().trim());
  +                                     addTag_Impl(tagName, 
docElement.toString().trim());
                        }
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (StringIndexOutOfBoundsException e) {
                        e.printStackTrace();
                }
  +             }
                _dirty = false;
        }
   
  -
  -     /**
  -      * Gets the TabOrSpace attribute of the XDoc class
  -      *
  -      * @param t Describe what the parameter does
  -      * @return The TabOrSpace value
  -      * @todo-javadoc Write javadocs for method parameter
  -      */
  -     private final static boolean isTabOrSpace(Token t) {
  -             return (t.image.charAt(0) == ' ') || (t.image.charAt(0) == '\t');
  -     }
  +//   private final static boolean isTabOrSpace(String s) {
  +//           return (s.charAt(0) == ' ') || (s.charAt(0) == '\t');
  +//   }
   }
  
  
  
  1.17      +8 -0      xjavadoc/src/xjavadoc/XClass.java
  
  Index: XClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XClass.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -w -r1.16 -r1.17
  --- XClass.java       24 Feb 2002 20:33:50 -0000      1.16
  +++ XClass.java       10 Mar 2002 17:56:00 -0000      1.17
  @@ -214,4 +214,12 @@
         * @todo-javadoc Write javadocs for return value
         */
        public boolean implementsInterface(String interfaceName);
  +
  +
  +     /**
  +      * Returns true if this instance can be saved.
  +      *
  +      * @return The Writeable value
  +      */
  +     public boolean isWriteable();
   }
  
  
  
  1.9       +17 -0     xjavadoc/src/xjavadoc/UnknownClass.java
  
  Index: UnknownClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/UnknownClass.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -w -r1.8 -r1.9
  --- UnknownClass.java 24 Feb 2002 04:38:56 -0000      1.8
  +++ UnknownClass.java 10 Mar 2002 17:56:00 -0000      1.9
  @@ -50,6 +50,12 @@
   class UnknownClass extends AbstractClass {
   
        /**
  +      * @todo-javadoc Describe the field
  +      */
  +     public static int instanceCount = 0;
  +
  +
  +     /**
         * Describe what the UnknownClass constructor does
         *
         * @param qualifiedName Describe what the parameter does
  @@ -60,6 +66,17 @@
                super(null, qualifiedName);
                // be defensive since we know nothing about the class
                addModifier(Modifier.ABSTRACT);
  +             instanceCount++;
  +     }
  +
  +
  +     /**
  +      * Gets the Writeable attribute of the UnknownClass object
  +      *
  +      * @return The Writeable value
  +      */
  +     public boolean isWriteable() {
  +             return false;
        }
   
   
  
  
  
  1.14      +489 -409  xjavadoc/src/xjavadoc/SourceClass.java
  
  Index: SourceClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/SourceClass.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -w -r1.13 -r1.14
  --- SourceClass.java  8 Mar 2002 15:34:12 -0000       1.13
  +++ SourceClass.java  10 Mar 2002 17:56:00 -0000      1.14
  @@ -48,26 +48,29 @@
    * @created 3. januar 2002
    */
   class SourceClass extends AbstractClass {
  -
        /**
         * @todo-javadoc Describe the field
         */
  -     private JavaParser _javaParser;
  +     private SimpleNode _compilationUnit;
   
        /**
         * @todo-javadoc Describe the field
         */
  -     private SimpleNode _compilationUnit;
  +     private boolean _isParseCompleted = false;
   
        /**
         * @todo-javadoc Describe the field
         */
  -     private boolean _isParseCompleted = false;
  +     private final Object _parseLock = new Object();
   
        /**
         * @todo-javadoc Describe the field
         */
  -     private final Object _parseLock = new Object();
  +     private Reader _in = null;
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     public static int instanceCount = 0;
   
        /**
         * Get static reference to Log4J Logger
  @@ -95,13 +98,13 @@
                        //_log.debug("A normal source class:" + qualifiedName);
                        addImportedPackage("java.lang");
                        try {
  -                             Reader in = new FileReader(sourceFile);
  -                             _javaParser = new JavaParser(in);
  +                             _in = new FileReader(sourceFile);
                        } catch (FileNotFoundException e) {
                                // That's tough. Shouldn't happen
                                throw new IllegalStateException("Couldn't find source 
for " + qualifiedName + " at " + sourceFile.getAbsolutePath());
                        }
                }
  +             instanceCount++;
        }
   
   
  @@ -133,6 +136,16 @@
   
   
        /**
  +      * Gets the OuterClass attribute of the SourceClass object
  +      *
  +      * @return The OuterClass value
  +      */
  +     public boolean isOuterClass() {
  +             return _in != null;
  +     }
  +
  +
  +     /**
         * Gets the BodyParseLock attribute of the SourceClass object
         *
         * @return The BodyParseLock value
  @@ -143,13 +156,33 @@
   
   
        /**
  +      * Gets the Writeable attribute of the SourceClass object
  +      *
  +      * @return The Writeable value
  +      */
  +     public boolean isWriteable() {
  +             return _compilationUnit != null;
  +     }
  +
  +
  +     /**
         * Describe what the method does
         *
  +      * @param useNodeParser Describe what the parameter does
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method
         */
  -     public void parse() {
  +     public void parse(boolean useNodeParser) {
  +             JavaParser parser;
  +             if (useNodeParser) {
  +                     parser = new NodeParser(_in);
  +             }
  +             else {
  +                     parser = new SimpleParser(_in);
  +             }
                try {
  -                     _javaParser.CompilationUnit(this);
  +                     parser.CompilationUnit(this);
                } catch (ParseException e) {
                        // Source code is bad. Not according to grammar. User's fault.
                        System.out.println("Error parsing " + qualifiedName() + ":" + 
e.getMessage());
  @@ -168,6 +201,10 @@
         */
        public void print(PrintStream out) {
                complete();
  +             if (!isWriteable()) {
  +                     // parsed with simple parser
  +                     throw new UnsupportedOperationException("Can't save classes 
that are parsed with simpleparser");
  +             }
                NodePrinter.print(_compilationUnit, out);
        }
   
  @@ -228,13 +265,16 @@
                                }
                                else {
                                        String qualifiedName;
  -                                     if ((qualifiedName = 
qualifiedNameInImportedClasses(unqualifiedClassName)) != null) {
  +                                     if ((qualifiedName = 
unqualifiedNameInImportedClasses(unqualifiedClassName)) != null) {
  +                                             result = 
XJavaDoc.getInstance().getXClass(qualifiedName);
  +                                     }
  +                                     else if ((qualifiedName = 
unqualifiedNameInImportedPackages(unqualifiedClassName)) != null) {
                                                result = 
XJavaDoc.getInstance().getXClass(qualifiedName);
                                        }
  -                                     else if ((qualifiedName = 
qualifiedNameInImportedPackages(unqualifiedClassName)) != null) {
  +                                     else if ((qualifiedName = 
unqualifiedNameInTheSamePackage(unqualifiedClassName)) != null) {
                                                result = 
XJavaDoc.getInstance().getXClass(qualifiedName);
                                        }
  -                                     else if ((qualifiedName = 
qualifiedNameInTheSamePackage(unqualifiedClassName)) != null) {
  +                                     else if ((qualifiedName = 
unqualifiedNameInInnerClasses(unqualifiedClassName)) != null) {
                                                result = 
XJavaDoc.getInstance().getXClass(qualifiedName);
                                        }
                                        else {
  @@ -257,28 +297,30 @@
         * @todo-javadoc Write javadocs for return value
         */
        protected void complete() {
  -             if (containingClass() == null) {
  +             if (isOuterClass()) {
                        if (!_isParseCompleted) {
   
                                // wake up the waiting parser thread
  -                             _log.debug("parse thread " + qualifiedName() + " 
completing. entering synchronized block...");
  +                             _log.debug("in " + qualifiedName() + "'s complete(). 
entering sync");
                                synchronized (getParseLock()) {
  -                                     _log.debug("parse thread " + qualifiedName() + 
" inside synchronized block. notifying main thread waiting in scanAndPut()");
  +                                     _log.debug("in " + qualifiedName() + "'s 
complete(). inside sync");
                                        getParseLock().notify();
  -                                     //      }
  -                                     // synchronized (getParseLock()) {
  +                                     _log.debug("notified parser in 
notifyAndWait()");
  +
                                        /// and wait until it's done with the rest
                                        try {
  +                                             _log.debug("waiting for parser to 
complete in complete()");
                                                getParseLock().wait();
  +                                             _log.debug("notified by completed 
parser to in complete()");
                                        } catch (InterruptedException e) {
                                                _log.debug("The complete() of " + 
qualifiedName() + " has been interrupted");
                                        }
  -                             }
   
                                _isParseCompleted = true;
                        }
                }
        }
  +     }
   
   
        /**
  @@ -287,7 +329,7 @@
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
  -     private final String qualifiedNameInImportedClasses(final String 
unqualifiedClassName) {
  +     private final String unqualifiedNameInImportedClasses(final String 
unqualifiedClassName) {
   
                if (!hasImportedClasses()) {
                        return null;
  @@ -324,7 +366,45 @@
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for return value
         */
  -     private final String qualifiedNameInImportedPackages(final String 
unqualifiedClassName) {
  +     private final String unqualifiedNameInInnerClasses(final String 
unqualifiedClassName) {
  +
  +             if (!hasInnerClasses()) {
  +                     return null;
  +             }
  +
  +             final String innerClassName = qualifiedName() + "." + 
unqualifiedClassName;
  +             String candidate = null;
  +             XClass[] innerClasses = innerClasses();
  +             for (int i = 0; i < innerClasses.length; i++) {
  +                     String qualifiedClassName = innerClasses[i].qualifiedName();
  +
  +                     if (innerClassName.equals(qualifiedClassName)) {
  +                             // We've found a candidate. See if source or binary is 
available.
  +                             if (candidateExists(qualifiedClassName)) {
  +                                     if (candidate != null) {
  +                                             // ambiguous class import
  +                                             throw new IllegalStateException("In 
class " + qualifiedName() + ": Ambiguous class:" + unqualifiedClassName + ". Is it " + 
candidate + " or " + qualifiedClassName + "?");
  +                                     }
  +                                     else {
  +                                             candidate = qualifiedClassName;
  +                                     }
  +                             }
  +                     }
  +             }
  +             return candidate;
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @param unqualifiedClassName Describe what the parameter does
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     private final String unqualifiedNameInImportedPackages(final String 
unqualifiedClassName) {
   
                if (!hasImportedPackages()) {
                        return null;
  @@ -358,7 +438,7 @@
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for return value
         */
  -     private final String qualifiedNameInTheSamePackage(final String 
unqualifiedClassName) {
  +     private final String unqualifiedNameInTheSamePackage(final String 
unqualifiedClassName) {
                String qualifiedClassName = containingPackage().name() + "." + 
unqualifiedClassName;
                if (candidateExists(qualifiedClassName)) {
                        return qualifiedClassName;
  
  
  
  1.4       +1 -1      xjavadoc/src/xjavadoc/SimpleNode.java
  
  Index: SimpleNode.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/SimpleNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- SimpleNode.java   1 Mar 2002 10:44:40 -0000       1.3
  +++ SimpleNode.java   10 Mar 2002 17:56:00 -0000      1.4
  @@ -268,7 +268,7 @@
         * @todo-javadoc Write javadocs for return value
         */
        public String toString() {
  -             return JavaParserTreeConstants.jjtNodeName[id];
  +             return NodeParserTreeConstants.jjtNodeName[id];
        }
   
   
  
  
  
  1.8       +30 -3     xjavadoc/src/xjavadoc/ProxyClass.java
  
  Index: ProxyClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/ProxyClass.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -r1.7 -r1.8
  --- ProxyClass.java   1 Mar 2002 10:44:40 -0000       1.7
  +++ ProxyClass.java   10 Mar 2002 17:56:00 -0000      1.8
  @@ -49,7 +49,6 @@
    * @todo-javadoc Write javadocs
    */
   class ProxyClass implements XClass {
  -
        /**
         * @todo-javadoc Describe the field
         */
  @@ -59,19 +58,44 @@
         */
        private XClass _subject = null;
   
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private final boolean _useNodeParser;
  +
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     public static int instanceCount = 0;
  +
   
        /**
         * Describe what the BinaryClass constructor does
         *
         * @param qualifiedName Describe what the parameter does
  +      * @param useNodeParser Describe what the parameter does
  +      * @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 constructor
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public ProxyClass(String qualifiedName) {
  +     public ProxyClass(String qualifiedName, boolean useNodeParser) {
                _qualifiedName = qualifiedName;
  +             _useNodeParser = useNodeParser;
  +             instanceCount++;
  +     }
  +
  +
  +     /**
  +      * Gets the Writeable attribute of the ProxyClass object
  +      *
  +      * @return The Writeable value
  +      */
  +     public boolean isWriteable() {
  +             resolve();
  +             return _subject.isWriteable();
        }
   
   
  @@ -482,7 +506,10 @@
         */
        private final void resolve() {
                if (_subject == null) {
  -                     _subject = XJavaDoc.getInstance().getXClass(_qualifiedName, 
false);
  +                     _subject = XJavaDoc.getInstance().getXClass(_qualifiedName, 
false, _useNodeParser);
  +                     if (_subject instanceof ProxyClass) {
  +                             throw new IllegalStateException("Can't be a proxy for 
a proxy!");
  +                     }
                }
        }
   }
  
  
  
  1.8       +10 -0     xjavadoc/src/xjavadoc/Primitive.java
  
  Index: Primitive.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/Primitive.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -r1.7 -r1.8
  --- Primitive.java    1 Mar 2002 10:44:40 -0000       1.7
  +++ Primitive.java    10 Mar 2002 17:56:00 -0000      1.8
  @@ -60,6 +60,16 @@
   
   
        /**
  +      * Gets the Writeable attribute of the Primitive object
  +      *
  +      * @return The Writeable value
  +      */
  +     public boolean isWriteable() {
  +             return false;
  +     }
  +
  +
  +     /**
         * Describe what the method does
         *
         * @return Describe the return value
  
  
  
  1.3       +2 -3      xjavadoc/src/xjavadoc/DefaultXTagFactory.java
  
  Index: DefaultXTagFactory.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/DefaultXTagFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- DefaultXTagFactory.java   20 Feb 2002 00:12:01 -0000      1.2
  +++ DefaultXTagFactory.java   10 Mar 2002 17:56:00 -0000      1.3
  @@ -48,7 +48,6 @@
         *
         * @param tagName Describe what the parameter does
         * @param text Describe what the parameter does
  -      * @param doc Describe what the parameter does
         * @return Describe the return value
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for method parameter
  @@ -56,8 +55,8 @@
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for return value
         */
  -     public XTag createTag(String tagName, String text, XDoc doc) {
  -             return new DefaultXTag(tagName, text, doc);
  +     public XTag createTag(String tagName, String text) {
  +             return new DefaultXTag(tagName, text);
        }
   }
   
  
  
  
  1.5       +111 -195  xjavadoc/src/xjavadoc/DefaultXTag.java
  
  Index: DefaultXTag.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/DefaultXTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- DefaultXTag.java  1 Mar 2002 10:44:40 -0000       1.4
  +++ DefaultXTag.java  10 Mar 2002 17:56:00 -0000      1.5
  @@ -39,6 +39,7 @@
   
   import java.util.ArrayList;
   import java.util.HashMap;
  +import java.util.Set;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
  @@ -58,17 +59,15 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     private final HashMap _tagParameterMap = new HashMap();
  +     private final HashMap _attributes = new HashMap();
        /**
         * @todo-javadoc Describe the field
         */
  -     private final ArrayList _tagParameterList = new ArrayList();
  -
  +     private boolean _isParsed = false;
        /**
         * @todo-javadoc Describe the field
         */
  -     private final XDoc _doc;
  -
  +     public static int instanceCount = 0;
        /**
         * Get static reference to Log4J Logger
         */
  @@ -82,16 +81,30 @@
         *      should be thrown if the value is not XML attribute-like.
         * @param name Describe what the parameter does
         * @param value Describe what the parameter does
  -      * @param doc Describe what the parameter does
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public DefaultXTag(String name, String value, XDoc doc) {
  +     public DefaultXTag(String name, String value) {
  +             instanceCount++;
                _name = name;
                _value = value;
  -             _doc = doc;
  -             parse(value);
  +     }
  +
  +
  +     /**
  +      * Adds a parameter
  +      *
  +      * @param attributeName The new Attribute value
  +      * @param attributeValue The new Attribute value
  +      * @todo-javadoc Write javadocs for return value
  +      * @todo-javadoc Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      * @todo-javadoc Describe the method parameter
  +      */
  +     public void setAttribute(String attributeName, String attributeValue) {
  +             parse();
  +             _attributes.put(attributeName, attributeValue);
        }
   
   
  @@ -99,20 +112,16 @@
         * Returns the first tag parameter with the given name, or null if none exist;
         *
         * @todo don't throw exception
  -      * @param parameterName Describe what the parameter does
  +      * @param attributeName Describe what the parameter does
         * @return The Parameter value
         * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for exception
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public XTagParameter getParameter(String parameterName) {
  -             XTagParameter[] params = getParameters(parameterName);
  -             if (params.length > 0) {
  -                     return params[0];
  -             }
  -             else {
  -                     return null;
  -             }
  +     public String getAttribute(String attributeName) {
  +             parse();
  +             return (String)_attributes.get(attributeName);
        }
   
   
  @@ -120,30 +129,15 @@
         * Returns all tag parameters with the given name, or an empty array if none
         * exist;
         *
  -      * @param parameterName Describe what the parameter does
         * @return The Parameters value
         * @todo-javadoc Write javadocs for exception
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public XTagParameter[] getParameters(String parameterName) {
  -             ArrayList tagParameters = 
(ArrayList)_tagParameterMap.get(parameterName);
  -             if (tagParameters == null) {
  -                     return new XTagParameter[0];
  -             }
  -             else {
  -                     return (XTagParameter[])tagParameters.toArray(new 
XTagParameter[tagParameters.size()]);
  -             }
  -     }
  -
  -
  -     /**
  -      * Returns all tag parameters
  -      *
  -      * @return all tag parameters
  -      * @todo-javadoc Write javadocs for exception
  -      */
  -     public XTagParameter[] getParameters() {
  -             return (XTagParameter[])_tagParameterList.toArray(new 
XTagParameter[_tagParameterList.size()]);
  +     public String[] getAttributeNames() {
  +             parse();
  +             Set names = _attributes.keySet();
  +             String[] result = (String[])names.toArray(new String[names.size()]);
  +             return result;
        }
   
   
  @@ -161,6 +155,7 @@
        /**
         * Returns the full value of the tag.
         *
  +      * @todo update this value when attributes are removed or added
         * @return Describe the return value
         * @todo-javadoc Write javadocs for return value
         */
  @@ -170,98 +165,16 @@
   
   
        /**
  -      * Removes a parameter
  +      * Removes an attribute
         *
  -      * @param tagParameter Describe what the parameter does
  -      * @return true if this tag contained the specified tagParameter
  +      * @param attributeName Describe what the parameter does
  +      * @return the removed attribute value or null if it didn't exist
         * @todo-javadoc Write javadocs for method parameter
  -      */
  -     public boolean removeTagParameter(XTagParameter tagParameter) {
  -             ArrayList tagParameters = 
(ArrayList)_tagParameterMap.get(tagParameter.name());
  -             if (tagParameters == null) {
  -                     return false;
  -             }
  -             else {
  -                     _tagParameterList.remove(tagParameter);
  -                     return tagParameters.remove(tagParameter);
  -             }
  -     }
  -
  -
  -     /**
  -      * Describe what the method does
  -      *
  -      * @param o Describe what the parameter does
  -      * @return Describe the return value
  -      * @todo-javadoc Write javadocs for method
  -      * @todo-javadoc Write javadocs for method parameter
  -      * @todo-javadoc Write javadocs for return value
  -      */
  -     public boolean equals(Object o) {
  -             return toString().equals(o.toString()) && 
getClass().equals(o.getClass());
  -     }
  -
  -
  -     /**
  -      * Describe what the method does
  -      *
  -      * @return Describe the return value
  -      * @todo-javadoc Write javadocs for method
  -      * @todo-javadoc Write javadocs for return value
  -      */
  -     public int hashCode() {
  -             return toString().hashCode();
  -     }
  -
  -
  -     /**
  -      * Describe what the method does
  -      *
  -      * @param o Describe what the parameter does
  -      * @return Describe the return value
  -      * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for method parameter
  -      * @todo-javadoc Write javadocs for return value
         */
  -     public int compareTo(Object o) {
  -             return toString().compareTo(o.toString());
  -     }
  -
  -
  -     /**
  -      * Adds a parameter
  -      *
  -      * @param attr_name Describe the method parameter
  -      * @param attr_value Describe the method parameter
  -      * @return Describe the return value
  -      * @todo-javadoc Write javadocs for return value
  -      * @todo-javadoc Describe the method parameter
  -      * @todo-javadoc Describe the method parameter
  -      * @todo-javadoc Describe the method parameter
  -      */
  -     public XTagParameter addTagParameter(String attr_name, String attr_value) {
  -             XTagParameter tagParameter = new XTagParameter(attr_name, attr_value, 
this);
  -             ArrayList tagParameters = 
(ArrayList)_tagParameterMap.get(tagParameter.name());
  -             if (tagParameters == null) {
  -                     tagParameters = new ArrayList();
  -                     _tagParameterMap.put(tagParameter.name(), tagParameters);
  -             }
  -             tagParameters.add(tagParameter);
  -             _tagParameterList.add(tagParameter);
  -             formatDoc();
  -             return tagParameter;
  -     }
  -
  -
  -     /**
  -      * Describe what the method does
  -      *
  -      * @todo-javadoc Write javadocs for method
  -      */
  -     public void formatDoc() {
  -             if (_doc != null) {
  -                     _doc.format();
  -             }
  +     public String removeAttribute(String attributeName) {
  +             parse();
  +             return (String)_attributes.remove(attributeName);
        }
   
   
  @@ -270,11 +183,10 @@
         * and sets the parameter. If anything is malformed (not (foo="xxx")+), then
         * nothing is set.
         *
  -      * @param value
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for exception
         */
  -     private void parse(String value) {
  +     private void parse() {
                Category cat = Category.getInstance(XTag.class);
   
                // Todo: use StringBuffer, or do some substring stuff using i.
  @@ -283,38 +195,40 @@
                int i = 0;
   //           int params_parsed = 0;
   
  -             while (i < value.length()) {
  -                     i = skipWhitespace(value, i);
  +             if (!_isParsed) {
  +
  +                     while (i < _value.length()) {
  +                             i = skipWhitespace(_value, i);
   
                        //explicitly to handle the tailing white spaces
   
  -                     if (i >= value.length()) {
  +                             if (i >= _value.length()) {
                                break;
                        }
   
                        //read attribute name
   
  -                     while (i < value.length() && value.charAt(i) != '=' && 
(!Character.isWhitespace(value.charAt(i)))) {
  -                             attr_name += value.charAt(i);
  +                             while (i < _value.length() && _value.charAt(i) != '=' 
&& (!Character.isWhitespace(_value.charAt(i)))) {
  +                                     attr_name += _value.charAt(i);
                                i++;
                        }
   
  -                     i = skipWhitespace(value, i);
  +                             i = skipWhitespace(_value, i);
   
                        //skip = sign
   
  -                     if (i < value.length() && value.charAt(i) == '=') {
  +                             if (i < _value.length() && _value.charAt(i) == '=') {
                                i++;
                        }
   
                        /*
                         *  removed single valued
                         */
  -                     i = skipWhitespace(value, i);
  +                             i = skipWhitespace(_value, i);
   
                        //skip " sign
   
  -                     if (i < value.length() && value.charAt(i) == '"') {
  +                             if (i < _value.length() && _value.charAt(i) == '"') {
                                i++;
                        }
                        else {
  @@ -324,20 +238,20 @@
   
                        //read attribute value
   
  -                     while (i < value.length()) {
  -                             if (value.charAt(i) == '"') {
  +                             while (i < _value.length()) {
  +                                     if (_value.charAt(i) == '"') {
                                        //if not escaped \" char
   
  -                                     if (value.charAt(i - 1) != '\\') {
  +                                             if (_value.charAt(i - 1) != '\\') {
                                                //if last " (last parameter) in whole 
value string
   
  -                                             if (i + 1 >= value.length()) {
  +                                                     if (i + 1 >= _value.length()) {
                                                        break;
                                                }
                                                else {
                                                        //if tailing " with whitespace 
after it
   
  -                                                     if 
(Character.isWhitespace(value.charAt(i + 1))) {
  +                                                             if 
(Character.isWhitespace(_value.charAt(i + 1))) {
                                                                break;
                                                        }
                                                        else {
  @@ -361,25 +275,27 @@
                                        }
                                }
   
  -                             attr_value += value.charAt(i);
  +                                     attr_value += _value.charAt(i);
                                i++;
                        }
   
                        //skip " sign
   
  -                     if (i < value.length() && value.charAt(i) == '"') {
  +                             if (i < _value.length() && _value.charAt(i) == '"') {
                                i++;
                        }
                        else {
                                //_log.warn("Error in @tag: tailing \" sign expected 
but not found, @tags=" + value);
                                return;
                        }
  -
  -                     addTagParameter(attr_name, attr_value);
  +                             System.out.println("add param:" + attr_name + "," + 
attr_value);
  +                             _attributes.put(attr_name, attr_value);
                        attr_name = "";
                        attr_value = "";
                }
        }
  +             _isParsed = true;
  +     }
   
   
        /**
  @@ -393,7 +309,7 @@
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for return value
         */
  -     private int skipWhitespace(String s, int i) {
  +     private static int skipWhitespace(String s, int i) {
                while (i < s.length() && Character.isWhitespace(s.charAt(i))) {
                        i++;
                }
  
  
  
  1.7       +16 -1     xjavadoc/src/xjavadoc/BinaryClass.java
  
  Index: BinaryClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/BinaryClass.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- BinaryClass.java  24 Feb 2002 20:33:50 -0000      1.6
  +++ BinaryClass.java  10 Mar 2002 17:56:00 -0000      1.7
  @@ -50,7 +50,6 @@
    * @todo lazy instantiate members
    */
   class BinaryClass extends AbstractClass {
  -
        /**
         * @todo-javadoc Describe the field
         */
  @@ -61,6 +60,11 @@
         */
        private boolean _isMembersAssigned = false;
   
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     public static int instanceCount = 0;
  +
   
        /**
         * Describe what the BinaryClass constructor does
  @@ -93,6 +97,17 @@
                }
   
                setInterfaces(clazz);
  +             instanceCount++;
  +     }
  +
  +
  +     /**
  +      * Gets the Writeable attribute of the BinaryClass object
  +      *
  +      * @return The Writeable value
  +      */
  +     public boolean isWriteable() {
  +             return false;
        }
   
   
  
  
  
  1.6       +21 -8     xjavadoc/src/xjavadoc/AbstractProgramElement.java
  
  Index: AbstractProgramElement.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/AbstractProgramElement.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- AbstractProgramElement.java       1 Mar 2002 10:44:40 -0000       1.5
  +++ AbstractProgramElement.java       10 Mar 2002 17:56:00 -0000      1.6
  @@ -76,6 +76,10 @@
         * @todo-javadoc Describe the field
         */
        private Token _token;
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
  +     private Token _javadocToken;
   
   
        /**
  @@ -122,6 +126,9 @@
         * @param qualifiedName The new QualifiedName value
         */
        public void setQualifiedName(String qualifiedName) {
  +             if (_qualifiedName != null) {
  +                     throw new IllegalStateException("Setting qualified name 2nd 
time!");
  +             }
                _qualifiedName = qualifiedName;
        }
   
  @@ -245,17 +252,24 @@
         * @return the class level doc
         */
        public final XDoc doc() {
  -             if (_doc == null) {
  +             if (_doc != null) {
  +                     return _doc;
  +             }
  +
  +             if (_javadocToken != null) {
  +                     _doc = new XDoc(_javadocToken);
  +             }
  +             else {
                        // there was no doc in the original source. Create 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);
  +                     Token preJavadocToken = 
Token.newToken(NodeParserConstants.DEFAULT);
                        preJavadocToken.image = "\n\n";
   
  -                     Token javadocToken = 
Token.newToken(JavaParserConstants.FORMAL_COMMENT);
  +                     Token javadocToken = 
Token.newToken(NodeParserConstants.FORMAL_COMMENT);
                        javadocToken.image = "";
   
  -                     Token postJavadocToken = 
Token.newToken(JavaParserConstants.DEFAULT);
  +                     Token postJavadocToken = 
Token.newToken(NodeParserConstants.DEFAULT);
                        postJavadocToken.image = "\n";
   
                        // Link the new tokens properly
  @@ -263,7 +277,6 @@
                        javadocToken.next = postJavadocToken;
   
                        _token.specialToken = preJavadocToken;
  -//                   _doc = new XDoc(javadocToken, firstParentToken);
                        _doc = new XDoc(javadocToken);
                }
                return _doc;
  @@ -333,11 +346,11 @@
                                tt = tt.specialToken;
                        }
                        while (tt != null) {
  -                             if (tt.kind == JavaParserConstants.FORMAL_COMMENT) {
  +                             if (tt.kind == NodeParserConstants.FORMAL_COMMENT) {
                                        // it's JavaDoc
                                        javadoc = tt;
                                }
  -                             else if (tt.kind == 
JavaParserConstants.SINGLE_LINE_COMMENT || tt.kind == 
JavaParserConstants.MULTI_LINE_COMMENT) {
  +                             else if (tt.kind == 
NodeParserConstants.SINGLE_LINE_COMMENT || tt.kind == 
NodeParserConstants.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;
  @@ -351,7 +364,7 @@
                                throw new IllegalStateException("Doc has already been 
set!!");
                        }
                        else {
  -                             _doc = new XDoc(javadoc);
  +                             _javadocToken = javadoc;
                        }
                }
        }
  
  
  
  1.11      +12 -6     xjavadoc/src/xjavadoc/AbstractClass.java
  
  Index: AbstractClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/AbstractClass.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -r1.10 -r1.11
  --- AbstractClass.java        1 Mar 2002 10:44:40 -0000       1.10
  +++ AbstractClass.java        10 Mar 2002 17:56:00 -0000      1.11
  @@ -382,7 +382,6 @@
                                String imported_class = 
(String)_importedClasses.get(i);
                                _ximportedClasses[i] = qualify(imported_class);
                        }
  -                     Arrays.sort(_ximportedClasses);
                }
   
                return _ximportedClasses;
  @@ -408,7 +407,6 @@
                        for (int i = 0; i < _innerClasses.size(); i++) {
                                _xinnerClasses[i] = (XClass)_innerClasses.get(i);
                        }
  -                     //Arrays.sort(_xinnerClasses);
                }
   
                return _xinnerClasses;
  @@ -435,7 +433,6 @@
                                String imported_package = 
(String)_importedPackages.get(i);
                                _ximportedPackages[i] = 
XJavaDoc.getInstance().addPackageMaybe(imported_package);
                        }
  -                     //Arrays.sort(_ximportedPackages);
                }
   
                return _ximportedPackages;
  @@ -457,7 +454,6 @@
                if (_xmethods == null) {
                        _xmethods = new XMethod[_methods.size()];
                        _xmethods = (XMethod[])_methods.toArray(_xmethods);
  -                     Arrays.sort(_xmethods);
                }
                return _xmethods;
        }
  @@ -478,7 +474,6 @@
                if (_xfields == null) {
                        _xfields = new XField[_fields.size()];
                        _xfields = (XField[])_fields.toArray(_xfields);
  -                     Arrays.sort(_xfields);
                }
   
                return _xfields;
  @@ -516,7 +511,6 @@
   
                        _xconstructors = new XConstructor[_constructors.size()];
                        _xconstructors = 
(XConstructor[])_constructors.toArray(_xconstructors);
  -                     Arrays.sort(_xconstructors);
                }
   
                return _xconstructors;
  @@ -771,6 +765,18 @@
         */
        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 hasInnerClasses() {
  +             return _innerClasses != null;
        }
   
   
  
  
  

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

Reply via email to