private ClassDoc[] getArray(Map<String, Set<ClassDoc>> m, String key) { Set<ClassDoc> s = m.get(key); if (s == null) { return new ClassDoc[] {}; } else { return s.toArray(new ClassDoc[] {}); } }
/** * Add the given class to the given map. * * @param classdoc the ClassDoc to add to the catelog. * @param map the Map to add the ClassDoc to. */ private void addClass(ClassDoc classdoc, Map<String, Set<ClassDoc>> map) { PackageDoc pkg = classdoc.containingPackage(); if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) { // No need to catalog this class if it's package is // included on the command line or if -nodeprecated option is set // and the containing package is marked as deprecated. return; } String key = Util.getPackageName(pkg); Set<ClassDoc> s = map.get(key); if (s == null) { packageSet.add(key); s = new HashSet<ClassDoc>(); } s.add(classdoc); map.put(key, s); }
/** * Return true if the given package is known to this catalog. * * @param packageName the name to check. * @return true if this catalog has any information about classes in the given package. */ public boolean isKnownPackage(String packageName) { return packageSet.contains(packageName); }
/** Return the array of package names that this catalog stores ClassDocs for. */ public String[] packageNames() { return packageSet.toArray(new String[] {}); }