User: vharcq
Date: 02/04/03 04:30:54
Modified: src/xjavadoc XDoc.java
Log:
Improve perf when having quite a big class hirerachy
Remove bug introduce on last commit
Revision Changes Path
1.22 +79 -53 xjavadoc/src/xjavadoc/XDoc.java
Index: XDoc.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XDoc.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -r1.21 -r1.22
--- XDoc.java 3 Apr 2002 11:09:37 -0000 1.21
+++ XDoc.java 3 Apr 2002 12:30:54 -0000 1.22
@@ -167,9 +167,28 @@
* @todo-javadoc Write javadocs for return value
*/
public XTag[] tags(String tagName, boolean superclasses) {
+ if (!superclasses) {
+ return tags(tagName);
+ }
+ else {
+ return tagsInCurrentAndSuper(tagName);
+ }
+ }
+
+
+ /**
+ * Describe what the method does
+ *
+ * @param tagName 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 method parameter
+ * @todo-javadoc Write javadocs for return value
+ */
+ public XTag[] tagsInCurrentAndSuper(String tagName) {
XTag[] tags = tags(tagName);
- if (superclasses) {
ArrayList allTags = new ArrayList(Arrays.asList(tags));
XDoc superDoc = this;
while ((superDoc = superDoc.superDoc()) != null) {
@@ -191,7 +210,6 @@
}
}
tags = (XTag[])allTags.toArray(new XTag[allTags.size()]);
- }
return tags;
}
@@ -200,19 +218,13 @@
* Describe what the method does
*
* @param tagName Describe what the parameter does
- * @param superclasses 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 method parameter
* @todo-javadoc Write javadocs for return value
*/
- public boolean hasTag(String tagName, boolean superclasses) {
- XTag[] tags = tags(tagName);
- if (tags.length > 0) {
- return true;
- }
- if (superclasses) {
+ public boolean hasTagInSuper(String tagName) {
XDoc superDoc = this;
while ((superDoc = superDoc.superDoc()) != null) {
XTag[] superTags = superDoc.tags(tagName);
@@ -220,7 +232,6 @@
return true;
}
}
- }
return false;
}
@@ -235,7 +246,31 @@
* @todo-javadoc Write javadocs for return value
*/
public boolean hasTag(String tagName) {
- return hasTag(tagName, false);
+ XTag[] tags = tags(tagName);
+ if (tags.length > 0) {
+ return true;
+ }
+ return false;
+ }
+
+
+ /**
+ * Describe what the method does
+ *
+ * @param tagName Describe what the parameter does
+ * @param superclasses 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 method parameter
+ * @todo-javadoc Write javadocs for return value
+ */
+ public boolean hasTag(String tagName, boolean superclasses) {
+ boolean inCurrent = hasTag(tagName);
+ if (!inCurrent && superclasses) {
+ return hasTagInSuper(tagName);
+ }
+ return inCurrent;
}
@@ -483,14 +518,23 @@
*/
public XTag[] tags(String tagName) {
parse();
- // TODO ASLAK ??? ArrayList tags =
(ArrayList)_tagMap.get(dotted(tagName));
ArrayList tags = (ArrayList)_tagMap.get(tagName);
if (tags == null) {
+ String dottedFormatTagName = tagName.replace(':', '.');
+ tags = (ArrayList)_tagMap.get(dottedFormatTagName);
+ }
+ if (tags == null) {
+ String colonedFormatTagName = tagName.replace('.', ':');
+ tags = (ArrayList)_tagMap.get(colonedFormatTagName);
+ }
+
+ if (tags == null) {
return new XTag[0];
}
else {
- return (XTag[])tags.toArray(new XTag[tags.size()]);
+ XTag[] tagArray = new XTag[tags.size()];
+ return (XTag[])tags.toArray(tagArray);
}
}
@@ -564,12 +608,10 @@
* @todo-javadoc Describe the method parameter
*/
private XTag addTag_Impl(String tagName, String text) {
- // TODO ASLAK ??? String dottedTagName = dotted(tagName);
- String dottedTagName = tagName;
- ArrayList tags = (ArrayList)_tagMap.get(dottedTagName);
+ ArrayList tags = (ArrayList)_tagMap.get(tagName);
if (tags == null) {
tags = new ArrayList();
- _tagMap.put(dottedTagName, tags);
+ _tagMap.put(tagName, tags);
}
XTag tag = XTagFactory.getInstance().createTag(tagName, text);
tags.add(tag);
@@ -677,23 +719,7 @@
_dirty = false;
}
-
// private final static boolean isTabOrSpace(String s) {
// return (s.charAt(0) == ' ') || (s.charAt(0) == '\t');
// }
-
- /**
- * Describe what the method does
- *
- * @todo is this really needed ?
- * @param tagName 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 String dotted(String tagName) {
- return tagName.replace(':', '.');
- }
-
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel