FileDocCategorySizeDatePackage
VisibleMemberMap.javaAPI DocExample10547Wed Apr 19 11:17:18 BST 2000com.sun.tools.doclets

VisibleMemberMap

public class VisibleMemberMap extends Object
Algorithm:
author
Atul M Dambalkar

Fields Summary
public static final int
INNERCLASSES
public static final int
FIELDS
public static final int
CONSTRUCTORS
public static final int
METHODS
public static final String
STARTLEVEL
private final List
visibleClasses
List of ClassDoc objects for which ClassMembers objects are built.
private final Map
memberNameMap
Map for each member name on to a map which contains members with same name-signature. The mapped map will contain mapping for each MemberDoc onto it's respecive level string.
private final Map
classMap
Map of class and it's ClassMembers object.
private final ClassDoc
classdoc
Class whose visible members are requested.
private final int
kind
Member kind: InnerClasses/Fields/Methods?
private final boolean
nodepr
Deprected members should be excluded or not?
Constructors Summary
public VisibleMemberMap(ClassDoc classdoc, int kind, boolean nodepr)


           
        this.classdoc = classdoc;
        this.nodepr = nodepr;
        this.kind = kind;
        new ClassMembers(classdoc, STARTLEVEL).build();
    
Methods Summary
private voidfillMemberLevelMap(java.util.List list, java.lang.String level)

	for (int i = 0; i < list.size(); i++) {
            ProgramElementDoc member = ((ProgramElementDoc)list.get(i));
            String membername = getDocName(member);
            Map memberLevelMap = (Map)(memberNameMap.get(membername));
            if (memberLevelMap == null) {
                memberLevelMap = new HashMap();
                memberNameMap.put(membername, memberLevelMap);
            } 
            memberLevelMap.put(member, level);
        }
    
protected static java.lang.StringgetDocName(com.sun.javadoc.ProgramElementDoc doc)
Return the name for each doc item. For example, if the doc item is of type PackageDoc for "java.lang" return string "java.lang", if the doc item is ClassDoc for "java.lang.Object" return string "java.lang.Object", if the doc item is MethodDoc for method "wait()" in java.lang.Object class, then return string wait()".

param
doc Doc Item for which name to be returned.
return
String name string as described above.

        if (doc.isMethod() || doc.isConstructor()) {
            return doc.name() + ((ExecutableMemberDoc)doc).signature();
        } else if (doc.isField()) {
            return doc.name();
        } else { // it's a class or interface
            return "clint" + doc.name();
        }
    
public java.util.ListgetMembersFor(com.sun.javadoc.ClassDoc cd)

        ClassMembers clmembers = (ClassMembers)(classMap.get(cd));
        if (clmembers == null) {
            return new ArrayList();
        }
        return clmembers.getMembers();
    
public java.util.ListgetVisibleClassesList()

        sort(visibleClasses);
        return visibleClasses;
    
private voidsort(java.util.List list)
Sort the given mixed list of classes and interfaces to a list of classes followed by interfaces traversed. Don't sort alphabetically.

               
        List classes = new ArrayList();
        List interfaces = new ArrayList();
  	for (int i = 0; i < list.size(); i++) {
            ClassDoc cd = (ClassDoc)list.get(i);
  	    if (cd.isClass()) {
                classes.add(cd);
	    } else {
                interfaces.add(cd);
            }
        }
        list.clear();
        list.addAll(classes);
        list.addAll(interfaces);