langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java
author jjg
Fri, 27 May 2016 13:06:58 -0700
changeset 38617 d93a7f64e231
parent 25874 83c19f00452c
permissions -rw-r--r--
8157606: deprecate com.sun.javadoc API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22163
diff changeset
     2
 * Copyright (c) 1998, 2014, 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: 5520
diff changeset
    28
import java.util.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 5520
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: 5520
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
 * Process and manage grouping of packages, as specified by "-group" option on
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * the command line.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * For example, if user has used -group option as
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * -group "Core Packages" "java.*" -group "CORBA Packages" "org.omg.*", then
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * the packages specified on the command line will be grouped according to their
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * names starting with either "java." or "org.omg.". All the other packages
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * which do not fall in the user given groups, are grouped in default group,
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * named as either "Other Packages" or "Packages" depending upon if "-group"
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * option used or not at all used respectively.
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * </p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * Also the packages are grouped according to the longest possible match of
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * their names with the grouping information provided. For example, if there
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * are two groups, like -group "Lang" "java.lang" and -group "Core" "java.*",
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * will put the package java.lang in the group "Lang" and not in group "Core".
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * </p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    52
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    53
 *  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
    54
 *  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
    55
 *  deletion without notice.</b>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 25874
diff changeset
    59
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
public class Group {
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     * Map of regular expressions with the corresponding group name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
    65
    private Map<String,String> regExpGroupMap = new HashMap<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     * List of regular expressions sorted according to the length. Regular
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     * expression with longest length will be first in the sorted order.
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
    71
    private List<String> sortedRegExpList = new ArrayList<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     * List of group names in the same order as given on the command line.
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
    76
    private List<String> groupList = new ArrayList<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     * Map of non-regular expressions(possible package names) with the
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * corresponding group name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
    82
    private Map<String,String> pkgNameGroupMap = new HashMap<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * The global configuration information for this run.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    private final Configuration configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * Since we need to sort the keys in the reverse order(longest key first),
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * the compare method in the implementing class is doing the reverse
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     * comparison.
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    94
    private static class MapKeyComparator implements Comparator<String> {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    95
        public int compare(String key1, String key2) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    96
            return key2.length() - key1.length();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   100
    public Group(Configuration configuration) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * Depending upon the format of the package name provided in the "-group"
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     * option, generate two separate maps. There will be a map for mapping
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * regular expression(only meta character allowed is '*' and that is at the
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * end of the regular expression) on to the group name. And another map
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * for mapping (possible) package names(if the name format doesen't contain
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * meta character '*', then it is assumed to be a package name) on to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * group name. This will also sort all the regular expressions found in the
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     * reverse order of their lengths, i.e. longest regular expression will be
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * first in the sorted list.
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * @param groupname       The name of the group from -group option.
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * @param pkgNameFormList List of the package name formats.
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    public boolean checkPackageGroups(String groupname,
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
            String pkgNameFormList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        StringTokenizer strtok = new StringTokenizer(pkgNameFormList, ":");
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        if (groupList.contains(groupname)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
            configuration.message.warning("doclet.Groupname_already_used", groupname);
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        groupList.add(groupname);
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        while (strtok.hasMoreTokens()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
            String id = strtok.nextToken();
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
            if (id.length() == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
                configuration.message.warning("doclet.Error_in_packagelist", groupname, pkgNameFormList);
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
                return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
            if (id.endsWith("*")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
                id = id.substring(0, id.length() - 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
                if (foundGroupFormat(regExpGroupMap, id)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
                regExpGroupMap.put(id, groupname);
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
                sortedRegExpList.add(id);
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
                if (foundGroupFormat(pkgNameGroupMap, id)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
                pkgNameGroupMap.put(id, groupname);
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        Collections.sort(sortedRegExpList, new MapKeyComparator());
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * Search if the given map has given the package format.
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * @param map Map to be searched.
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * @param pkgFormat The pacakge format to search.
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     * @return true if package name format found in the map, else false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1475
diff changeset
   158
    boolean foundGroupFormat(Map<String,?> map, String pkgFormat) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        if (map.containsKey(pkgFormat)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            configuration.message.error("doclet.Same_package_name_used", pkgFormat);
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
            return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
        return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * Group the packages according the grouping information provided on the
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * command line. Given a list of packages, search each package name in
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     * regular expression map as well as package name map to get the
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     * corresponding group name. Create another map with mapping of group name
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     * to the package list, which will fall under the specified group. If any
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     * package doesen't belong to any specified group on the comamnd line, then
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * a new group named "Other Packages" will be created for it. If there are
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     * no groups found, in other words if "-group" option is not at all used,
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
     * then all the packages will be grouped under group "Packages".
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * @param packages Packages specified on the command line.
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     */
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22163
diff changeset
   179
    public Map<String, List<PackageDoc>> groupPackages(Set<PackageDoc> packages) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   180
        Map<String,List<PackageDoc>> groupPackageMap = new HashMap<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
        String defaultGroupName =
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
            (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
                configuration.message.getText("doclet.Packages") :
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
                configuration.message.getText("doclet.Other_Packages");
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
        // if the user has not used the default group name, add it
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
        if (!groupList.contains(defaultGroupName)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
            groupList.add(defaultGroupName);
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
        }
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 14260
diff changeset
   189
        for (PackageDoc pkg : packages) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
            String pkgName = pkg.name();
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   191
            String groupName = pkgNameGroupMap.get(pkgName);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
            // if this package is not explicitly assigned to a group,
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
            // try matching it to group specified by regular expression
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
            if (groupName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
                groupName = regExpGroupName(pkgName);
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
            // if it is in neither group map, put it in the default
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
            // group
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
            if (groupName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
                groupName = defaultGroupName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
            getPkgList(groupPackageMap, groupName).add(pkg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        return groupPackageMap;
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     * Search for package name in the sorted regular expression
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     * list, if found return the group name.  If not, return null.
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * @param pkgName Name of package to be found in the regular
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     * expression list.
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
    String regExpGroupName(String pkgName) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 14260
diff changeset
   215
        for (String regexp : sortedRegExpList) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
            if (pkgName.startsWith(regexp)) {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   217
                return regExpGroupMap.get(regexp);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
     * For the given group name, return the package list, on which it is mapped.
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
     * Create a new list, if not found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     * @param map Map to be searched for gorup name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     * @param groupname Group name to search.
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   230
    List<PackageDoc> getPkgList(Map<String,List<PackageDoc>> map, String groupname) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   231
        List<PackageDoc> list = map.get(groupname);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        if (list == null) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   233
            list = new ArrayList<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
            map.put(groupname, list);
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
        return list;
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
     * Return the list of groups, in the same order as specified
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
     * on the command line.
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1475
diff changeset
   243
    public List<String> getGroupList() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
        return groupList;
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
}