langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
changeset 1789 7ac8c0815000
parent 1264 076a3cde30d5
child 5520 86e4b9a9da40
equal deleted inserted replaced
1788:ced0a1a7ec80 1789:7ac8c0815000
   175         } else {     // cd is java.lang.Object, add it once to the list
   175         } else {     // cd is java.lang.Object, add it once to the list
   176             if (!bases.contains(cd)) {
   176             if (!bases.contains(cd)) {
   177                 bases.add(cd);
   177                 bases.add(cd);
   178             }
   178             }
   179         }
   179         }
   180         List intfacs = Util.getAllInterfaces(cd, configuration);
   180         List<Type> intfacs = Util.getAllInterfaces(cd, configuration);
   181         for (Iterator iter = intfacs.iterator(); iter.hasNext();) {
   181         for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext();) {
   182             add(implementingclasses, ((Type) iter.next()).asClassDoc(), cd);
   182             add(implementingclasses, iter.next().asClassDoc(), cd);
   183         }
   183         }
   184     }
   184     }
   185 
   185 
   186     /**
   186     /**
   187      * For the interface passed get the interfaces which it extends, and then
   187      * For the interface passed get the interfaces which it extends, and then
   276         List<ClassDoc> result = get(implementingclasses, cd);
   276         List<ClassDoc> result = get(implementingclasses, cd);
   277         List<ClassDoc> subinterfaces = allSubs(cd, false);
   277         List<ClassDoc> subinterfaces = allSubs(cd, false);
   278 
   278 
   279         //If class x implements a subinterface of cd, then it follows
   279         //If class x implements a subinterface of cd, then it follows
   280         //that class x implements cd.
   280         //that class x implements cd.
   281         Iterator implementingClassesIter, subInterfacesIter = subinterfaces.listIterator();
   281         Iterator<ClassDoc> implementingClassesIter, subInterfacesIter = subinterfaces.listIterator();
   282         ClassDoc c;
   282         ClassDoc c;
   283         while(subInterfacesIter.hasNext()){
   283         while(subInterfacesIter.hasNext()){
   284             implementingClassesIter = implementingclasses((ClassDoc)
   284             implementingClassesIter = implementingclasses(
   285                     subInterfacesIter.next()).listIterator();
   285                     subInterfacesIter.next()).listIterator();
   286             while(implementingClassesIter.hasNext()){
   286             while(implementingClassesIter.hasNext()){
   287                 c = (ClassDoc)implementingClassesIter.next();
   287                 c = implementingClassesIter.next();
   288                 if(! result.contains(c)){
   288                 if(! result.contains(c)){
   289                     result.add(c);
   289                     result.add(c);
   290                 }
   290                 }
   291             }
   291             }
   292         }
   292         }
   326      */
   326      */
   327     public List<ClassDoc> allSubs(ClassDoc cd, boolean isEnum) {
   327     public List<ClassDoc> allSubs(ClassDoc cd, boolean isEnum) {
   328         List<ClassDoc> list = subs(cd, isEnum);
   328         List<ClassDoc> list = subs(cd, isEnum);
   329         for (int i = 0; i < list.size(); i++) {
   329         for (int i = 0; i < list.size(); i++) {
   330             cd = list.get(i);
   330             cd = list.get(i);
   331             List tlist = subs(cd, isEnum);
   331             List<ClassDoc> tlist = subs(cd, isEnum);
   332             for (int j = 0; j < tlist.size(); j++) {
   332             for (int j = 0; j < tlist.size(); j++) {
   333                 ClassDoc tcd = (ClassDoc)tlist.get(j);
   333                 ClassDoc tcd = tlist.get(j);
   334                 if (!list.contains(tcd)) {
   334                 if (!list.contains(tcd)) {
   335                     list.add(tcd);
   335                     list.add(tcd);
   336                 }
   336                 }
   337             }
   337             }
   338         }
   338         }
   343     /**
   343     /**
   344      *  Return the base-classes list. This will have only one element namely
   344      *  Return the base-classes list. This will have only one element namely
   345      *  thw classdoc for java.lang.Object, since this is the base class for all
   345      *  thw classdoc for java.lang.Object, since this is the base class for all
   346      *  classes.
   346      *  classes.
   347      */
   347      */
   348     public List baseclasses() {
   348     public List<ClassDoc> baseclasses() {
   349         return baseclasses;
   349         return baseclasses;
   350     }
   350     }
   351 
   351 
   352     /**
   352     /**
   353      *  Return the list of base interfaces. This is the list of interfaces
   353      *  Return the list of base interfaces. This is the list of interfaces
   354      *  which do not have super-interface.
   354      *  which do not have super-interface.
   355      */
   355      */
   356     public List baseinterfaces() {
   356     public List<ClassDoc> baseinterfaces() {
   357         return baseinterfaces;
   357         return baseinterfaces;
   358     }
   358     }
   359 
   359 
   360     /**
   360     /**
   361      *  Return the list of base enums. This is the list of enums
   361      *  Return the list of base enums. This is the list of enums
   362      *  which do not have super-enums.
   362      *  which do not have super-enums.
   363      */
   363      */
   364     public List baseEnums() {
   364     public List<ClassDoc> baseEnums() {
   365         return baseEnums;
   365         return baseEnums;
   366     }
   366     }
   367 
   367 
   368     /**
   368     /**
   369      *  Return the list of base annotation types. This is the list of
   369      *  Return the list of base annotation types. This is the list of
   370      *  annotation types which do not have super-annotation types.
   370      *  annotation types which do not have super-annotation types.
   371      */
   371      */
   372     public List baseAnnotationTypes() {
   372     public List<ClassDoc> baseAnnotationTypes() {
   373         return baseAnnotationTypes;
   373         return baseAnnotationTypes;
   374     }
   374     }
   375 }
   375 }