Methods Summary |
---|
private boolean | add(java.util.Map map, com.sun.javadoc.ClassDoc superclass, com.sun.javadoc.ClassDoc cd)Adjust the Class Tree. Add the class interface in to it's super-class'
or super-interface's sub-interface list.
List list = (List)map.get(superclass);
if (list == null) {
list = new ArrayList();
map.put(superclass, list);
}
if (list.contains(cd)) {
return false;
} else {
list.add(cd);
}
return true;
|
public java.util.List | allSubs(com.sun.javadoc.ClassDoc cd)Return a list of all direct or indirect, sub-classes and subinterfaces
of the ClassDoc argument.
List list = get(cd.isInterface()? subinterfaces: subclasses, cd);
for (int i = 0; i < list.size(); i++) {
cd = (ClassDoc)list.get(i);
List tlist = get(cd.isInterface()? subinterfaces: subclasses, cd);
for (int j = 0; j < tlist.size(); j++) {
ClassDoc tcd = (ClassDoc)tlist.get(j);
if (!list.contains(tcd)) {
list.add(tcd);
}
}
}
Collections.sort(list);
return list;
|
public java.util.List | baseclasses()Return the base-classes list. This will have only one element namely
thw classdoc for java.lang.Object, since this is the base class for all
classes.
return baseclasses;
|
public java.util.List | baseinterfaces()Return the list of base interfaces. This is the list of interfaces
which do not have super-interface.
return baseinterfaces;
|
private void | buildTree(com.sun.javadoc.ClassDoc[] classes, boolean noDeprecated)Generate mapping for the sub-classes for every class in this run.
Return the sub-class list for java.lang.Object which will be having
sub-class listing for itself and also for each sub-class itself will
have their own sub-class lists.
for (int i = 0; i < classes.length; i++) {
if (noDeprecated && classes[i].tags("deprecated").length > 0) {
continue;
}
if (classes[i].isClass()) {
processClass(classes[i]);
} else { // this is an interface.
processInterface(classes[i]);
List list = (List)implementingclasses.get(classes[i]);
if (list != null) {
Collections.sort(list);
}
}
}
Collections.sort(baseinterfaces);
for (Iterator it = subinterfaces.values().iterator(); it.hasNext(); ) {
Collections.sort((List)it.next());
}
for (Iterator it = subclasses.values().iterator(); it.hasNext(); ) {
Collections.sort((List)it.next());
}
|
private java.util.List | get(java.util.Map map, com.sun.javadoc.ClassDoc cd)From the map return the list of sub-classes or sub-interfaces. If list
is null create a new one and return it.
List list = (List)map.get(cd);
if (list == null) {
return new ArrayList();
}
return list;
|
public java.util.List | implementingclasses(com.sun.javadoc.ClassDoc cd)Return the list of classes which implement the interface passed.
return get(implementingclasses, cd);
|
private void | processClass(com.sun.javadoc.ClassDoc cd)For the class passed map it to it's own sub-class listing.
For the Class passed, get the super class,
if superclass is non null, (it is not "java.lang.Object")
get the "value" from the hashmap for this key Class
if entry not found create one and get that.
add this Class as a sub class in the list
Recurse till hits java.lang.Object Null SuperClass.
ClassDoc superclass = cd.superclass();
if (superclass != null) {
if (!add(subclasses, superclass, cd)) {
return;
} else {
processClass(superclass); // Recurse
}
} else { // cd is java.lang.Object, add it once to the list
if (!baseclasses.contains(cd)) {
baseclasses.add(cd);
}
}
ClassDoc[] intfacs = cd.interfaces();
for (int i = 0; i < intfacs.length; i++) {
add(implementingclasses, intfacs[i], cd);
}
|
private void | processInterface(com.sun.javadoc.ClassDoc cd)For the interface passed get the interfaces which it extends, and then
put this interface in the sub-interface list of those interfaces. Do it
recursively. If a interface doesn't have super-interface just attach
that interface in the list of all the baseinterfaces.
ClassDoc[] intfacs = cd.interfaces();
if (intfacs.length > 0) {
for (int i = 0; i < intfacs.length; i++) {
if (!add(subinterfaces, intfacs[i], cd)) {
return;
} else {
processInterface(intfacs[i]); // Recurse
}
}
} else {
// we need to add all the interfaces who do not have
// super-interfaces to baseinterfaces list to traverse them
if (!baseinterfaces.contains(cd)) {
baseinterfaces.add(cd);
}
}
|
public java.util.List | subclasses(com.sun.javadoc.ClassDoc cd)Return the sub-class list for the class passed.
return get(subclasses, cd);
|
public java.util.List | subinterfaces(com.sun.javadoc.ClassDoc cd)Return the sub-interface list for the interface passed.
return get(subinterfaces, cd);
|
public java.util.List | subs(com.sun.javadoc.ClassDoc cd)Return the sub-class/interface list for the class/interface passed.
return get(cd.isInterface()? subinterfaces: subclasses, cd);
|