langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java
author briangoetz
Wed, 18 Dec 2013 16:05:18 -0500
changeset 22163 3651128c74eb
parent 22159 682da512ec17
child 24220 eb213562268d
permissions -rw-r--r--
8030244: Update langtools to use Diamond Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
     2
 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.internal.toolkit.util;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    28
import java.util.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    29
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.javadoc.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    31
import com.sun.tools.doclets.internal.toolkit.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * Build the mapping of each Unicode character with it's member lists
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * containing members names starting with it. Also build a list for all the
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * Unicode characters which start a member name. Member name is
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * classkind or field or method or constructor name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    39
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    40
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    41
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    42
 *  deletion without notice.</b>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * @see java.lang.Character
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
public class IndexBuilder {
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * Mapping of each Unicode Character with the member list containing
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     * members with names starting with it.
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
    54
    private Map<Character,List<Doc>> indexmap = new HashMap<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * Don't generate deprecated information if true.
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    private boolean noDeprecated;
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
     * Build this Index only for classes?
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    private boolean classesOnly;
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
    66
    /**
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
    67
     * Indicates javafx mode.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
    68
     */
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
    69
    private boolean javafx;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
    70
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    // make ProgramElementDoc[] when new toArray is available
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    protected final Object[] elements;
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * A comparator used to sort classes and members.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * Note:  Maybe this compare code belongs in the tool?
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    78
    private class DocComparator implements Comparator<Doc> {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    79
        public int compare(Doc d1, Doc d2) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    80
            String doc1 = d1.name();
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    81
            String doc2 = d2.name();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
            int compareResult;
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
            if ((compareResult = doc1.compareToIgnoreCase(doc2)) != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
                return compareResult;
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
            } else if (d1 instanceof ProgramElementDoc && d2 instanceof ProgramElementDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
                 doc1 = (((ProgramElementDoc) d1).qualifiedName());
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
                 doc2 = (((ProgramElementDoc) d2).qualifiedName());
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
                 return doc1.compareToIgnoreCase(doc2);
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
                return 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * Constructor. Build the index map.
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * @param configuration the current configuration of the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     * @param noDeprecated  true if -nodeprecated option is used,
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     *                      false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    public IndexBuilder(Configuration configuration, boolean noDeprecated) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        this(configuration, noDeprecated, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * Constructor. Build the index map.
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * @param configuration the current configuration of the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * @param noDeprecated  true if -nodeprecated option is used,
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     *                      false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     * @param classesOnly   Include only classes in index.
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    public IndexBuilder(Configuration configuration, boolean noDeprecated,
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
                        boolean classesOnly) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
        if (classesOnly) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
            configuration.message.notice("doclet.Building_Index_For_All_Classes");
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
            configuration.message.notice("doclet.Building_Index");
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        this.noDeprecated = noDeprecated;
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        this.classesOnly = classesOnly;
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   123
        this.javafx = configuration.javafx;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        buildIndexMap(configuration.root);
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   125
        Set<Character> set = indexmap.keySet();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        elements =  set.toArray();
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
        Arrays.sort(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * Sort the index map. Traverse the index map for all it's elements and
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * sort each element which is a list.
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    protected void sortIndexMap() {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   135
        for (List<Doc> docs : indexmap.values()) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   136
            Collections.sort(docs, new DocComparator());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * Get all the members in all the Packages and all the Classes
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * given on the command line. Form separate list of those members depending
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     * upon their names.
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * @param root Root of the documemt.
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    protected void buildIndexMap(RootDoc root)  {
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
        PackageDoc[] packages = root.specifiedPackages();
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        ClassDoc[] classes = root.classes();
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        if (!classesOnly) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
            if (packages.length == 0) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   152
                Set<PackageDoc> set = new HashSet<>();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   153
                for (ClassDoc aClass : classes) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   154
                    PackageDoc pd = aClass.containingPackage();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
                    if (pd != null && pd.name().length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
                        set.add(pd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
                }
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   159
                adjustIndexMap(set.toArray(packages));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
                adjustIndexMap(packages);
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
        adjustIndexMap(classes);
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        if (!classesOnly) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   166
            for (ClassDoc aClass : classes) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   167
                if (shouldAddToIndexMap(aClass)) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   168
                    putMembersInIndexMap(aClass);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
        sortIndexMap();
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     * Put all the members(fields, methods and constructors) in the classdoc
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * to the indexmap.
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     * @param classdoc ClassDoc whose members will be added to the indexmap.
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    protected void putMembersInIndexMap(ClassDoc classdoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        adjustIndexMap(classdoc.fields());
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        adjustIndexMap(classdoc.methods());
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
        adjustIndexMap(classdoc.constructors());
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * Adjust list of members according to their names. Check the first
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * character in a member name, and then add the member to a list of members
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * for that particular unicode character.
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * @param elements Array of members.
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    protected void adjustIndexMap(Doc[] elements) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   196
        for (Doc element : elements) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   197
            if (shouldAddToIndexMap(element)) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   198
                String name = element.name();
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   199
                char ch = (name.length() == 0) ?
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   200
                          '*' :
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   201
                          Character.toUpperCase(name.charAt(0));
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   202
                Character unicode = ch;
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   203
                List<Doc> list = indexmap.get(unicode);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
                if (list == null) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   205
                    list = new ArrayList<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
                    indexmap.put(unicode, list);
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
                }
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 16319
diff changeset
   208
                list.add(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     * Should this doc element be added to the index map?
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    protected boolean shouldAddToIndexMap(Doc element) {
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   217
        if (javafx) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   218
            if (element.tags("treatAsPrivate").length > 0) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   219
                return false;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   220
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   221
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   222
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   223
        if (element instanceof PackageDoc)
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   224
            // Do not add to index map if -nodeprecated option is set and the
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   225
            // package is marked as deprecated.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   226
            return !(noDeprecated && Util.isDeprecated(element));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   227
        else
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   228
            // Do not add to index map if -nodeprecated option is set and if the
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   229
            // Doc is marked as deprecated or the containing package is marked as
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   230
            // deprecated.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   231
            return !(noDeprecated &&
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   232
                    (Util.isDeprecated(element) ||
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 5520
diff changeset
   233
                    Util.isDeprecated(((ProgramElementDoc)element).containingPackage())));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
     * Return a map of all the individual member lists with Unicode character.
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
     * @return Map index map.
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   241
    public Map<Character,List<Doc>> getIndexMap() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
        return indexmap;
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
     * Return the sorted list of members, for passed Unicode Character.
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     * @param index index Unicode character.
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     * @return List member list for specific Unicode character.
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   251
    public List<Doc> getMemberList(Character index) {
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   252
        return indexmap.get(index);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     * Array of IndexMap keys, Unicode characters.
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
    public Object[] elements() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
        return elements;
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
}