private void addAll(Map map, ClassDoc cd, Collection refs) {
        if (refs == null) {
            return;
        }
        // add to specified map
        refList(map, cd).addAll(refs);

        Set pkgSet = packageSet(cd);
        Set clsSet = classSet(cd);
        // add ref's package to package map and class map
        for (Iterator it = refs.iterator(); it.hasNext();) {
            ProgramElementDoc pedoc = (ProgramElementDoc)it.next();
            pkgSet.add(pedoc.containingPackage());
            clsSet.add(pedoc instanceof MemberDoc?
                    ((MemberDoc)pedoc).containingClass() :
                        pedoc);

        }
    }