APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.javadoc.internal.doclets.toolkit.util

public Class Group

extends Object
Class Inheritance
Imports
java.util.*, javax.lang.model.element.ModuleElement, .PackageElement, jdk.javadoc.internal.doclets.toolkit.BaseConfiguration, .Messages

Process and manage grouping of elements, as specified by "-group" option on the command line.

For example, if user has used -group option as -group "Core Packages" "java.*" -group "CORBA Packages" "org.omg.*", then the packages specified on the command line will be grouped according to their names starting with either "java." or "org.omg.". All the other packages which do not fall in the user given groups, are grouped in default group, named as either "Other Packages" or "Packages" depending upon if "-group" option used or not at all used respectively.

Also the packages are grouped according to the longest possible match of their names with the grouping information provided. For example, if there are two groups, like -group "Lang" "java.lang" and -group "Core" "java.*", will put the package java.lang in the group "Lang" and not in group "Core".

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
Group.MapKeyComparator

Since we need to sort the keys in the reverse order(longest key first), the compare method in the implementing class is doing the reverse comparison.

Field Summary

Modifier and TypeField and Description
private final BaseConfiguration
configuration

The global configuration information for this run.

private Map<String, String>
elementNameGroupMap

Map of non-regular expressions(possible package or module names) with the corresponding group name.

private List<String>
groupList

List of group names in the same order as given on the command line.

private Messages
private Map<String, String>
regExpGroupMap

Map of regular expressions with the corresponding group name.

private List<String>
sortedRegExpList

List of regular expressions sorted according to the length.

Constructor Summary

AccessConstructor and Description
public
Group(BaseConfiguration configuration)

Method Summary

Modifier and TypeMethod and Description
public boolean
checkModuleGroups(String
The name of the group from -group option.
groupname
,
String
List of the module name formats.
moduleNameFormList
)

Depending upon the format of the module name provided in the "-group" option, generate two separate maps.

public boolean
checkPackageGroups(String
The name of the group from -group option.
groupname
,
String
List of the package name formats.
pkgNameFormList
)

Depending upon the format of the package name provided in the "-group" option, generate two separate maps.

pack-priv boolean

Returns:

true if element name format found in the map, else false.
foundGroupFormat
(Map<String, ?>
Map to be searched.
map
,
String
The format to search.
elementFormat
)

Search if the given map has the given element format.

public List<String>
getGroupList()

Return the list of groups, in the same order as specified on the command line.

pack-priv SortedSet<ModuleElement>
getModuleList(Map<String, SortedSet<ModuleElement>>
Map to be searched for group name.
map
,
String
Group name to search.
groupname
)

For the given group name, return the module list, on which it is mapped.

pack-priv SortedSet<PackageElement>
getPkgList(Map<String, SortedSet<PackageElement>>
Map to be searched for group name.
map
,
String
Group name to search.
groupname
)

For the given group name, return the package list, on which it is mapped.

public Map<String, SortedSet<ModuleElement>>

Returns:

map of group names and set of module elements.
groupModules
(Set<ModuleElement>
Specified modules.
modules
)

Group the modules according the grouping information provided on the command line.

public Map<String, SortedSet<PackageElement>>

Returns:

map of group names and set of package elements
groupPackages
(Set<PackageElement>
Packages specified on the command line.
packages
)

Group the packages according the grouping information provided on the command line.

private void
pack-priv String
regExpGroupName(String
Name of element to be found in the regular expression list.
elementName
)

Search for element name in the sorted regular expression list, if found return the group name.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
private final BaseConfiguration configuration

The global configuration information for this run.

elementNameGroupMapback to summary
private Map<String, String> elementNameGroupMap

Map of non-regular expressions(possible package or module names) with the corresponding group name.

groupListback to summary
private List<String> groupList

List of group names in the same order as given on the command line.

messagesback to summary
private Messages messages
regExpGroupMapback to summary
private Map<String, String> regExpGroupMap

Map of regular expressions with the corresponding group name.

sortedRegExpListback to summary
private List<String> sortedRegExpList

List of regular expressions sorted according to the length. Regular expression with longest length will be first in the sorted order.

Constructor Detail

Groupback to summary
public Group(BaseConfiguration configuration)

Method Detail

checkModuleGroupsback to summary
public boolean checkModuleGroups(String groupname, String moduleNameFormList)

Depending upon the format of the module name provided in the "-group" option, generate two separate maps. There will be a map for mapping regular expression(only meta character allowed is '*' and that is at the end of the regular expression) on to the group name. And another map for mapping (possible) module names(if the name format doesn't contain meta character '*', then it is assumed to be a module name) on to the group name. This will also sort all the regular expressions found in the reverse order of their lengths, i.e. longest regular expression will be first in the sorted list.

Parameters
groupname:String

The name of the group from -group option.

moduleNameFormList:String

List of the module name formats.

checkPackageGroupsback to summary
public boolean checkPackageGroups(String groupname, String pkgNameFormList)

Depending upon the format of the package name provided in the "-group" option, generate two separate maps. There will be a map for mapping regular expression(only meta character allowed is '*' and that is at the end of the regular expression) on to the group name. And another map for mapping (possible) package names(if the name format doesn't contain meta character '*', then it is assumed to be a package name) on to the group name. This will also sort all the regular expressions found in the reverse order of their lengths, i.e. longest regular expression will be first in the sorted list.

Parameters
groupname:String

The name of the group from -group option.

pkgNameFormList:String

List of the package name formats.

foundGroupFormatback to summary
pack-priv boolean foundGroupFormat(Map<String, ?> map, String elementFormat)

Search if the given map has the given element format.

Parameters
map:Map<String, ?>

Map to be searched.

elementFormat:String

The format to search.

Returns:boolean

true if element name format found in the map, else false.

getGroupListback to summary
public List<String> getGroupList()

Return the list of groups, in the same order as specified on the command line.

getModuleListback to summary
pack-priv SortedSet<ModuleElement> getModuleList(Map<String, SortedSet<ModuleElement>> map, String groupname)

For the given group name, return the module list, on which it is mapped. Create a new list, if not found.

Parameters
map:Map<String, SortedSet<ModuleElement>>

Map to be searched for group name.

groupname:String

Group name to search.

getPkgListback to summary
pack-priv SortedSet<PackageElement> getPkgList(Map<String, SortedSet<PackageElement>> map, String groupname)

For the given group name, return the package list, on which it is mapped. Create a new list, if not found.

Parameters
map:Map<String, SortedSet<PackageElement>>

Map to be searched for group name.

groupname:String

Group name to search.

groupModulesback to summary
public Map<String, SortedSet<ModuleElement>> groupModules(Set<ModuleElement> modules)

Group the modules according the grouping information provided on the command line. Given a list of modules, search each module name in regular expression map as well as module name map to get the corresponding group name. Create another map with mapping of group name to the module list, which will fall under the specified group. If any module doesn't belong to any specified group on the command line, then a new group named "Other Modules" will be created for it. If there are no groups found, in other words if "-group" option is not at all used, then all the modules will be grouped under group "Modules".

Parameters
modules:Set<ModuleElement>

Specified modules.

Returns:Map<String, SortedSet<ModuleElement>>

map of group names and set of module elements.

groupPackagesback to summary
public Map<String, SortedSet<PackageElement>> groupPackages(Set<PackageElement> packages)

Group the packages according the grouping information provided on the command line. Given a list of packages, search each package name in regular expression map as well as package name map to get the corresponding group name. Create another map with mapping of group name to the package list, which will fall under the specified group. If any package doesn't belong to any specified group on the command line, then a new group named "Other Packages" will be created for it. If there are no groups found, in other words if "-group" option is not at all used, then all the packages will be grouped under group "Packages".

Parameters
packages:Set<PackageElement>

Packages specified on the command line.

Returns:Map<String, SortedSet<PackageElement>>

map of group names and set of package elements

initMessagesback to summary
private void initMessages()
regExpGroupNameback to summary
pack-priv String regExpGroupName(String elementName)

Search for element name in the sorted regular expression list, if found return the group name. If not, return null.

Parameters
elementName:String

Name of element to be found in the regular expression list.

jdk.javadoc.internal.doclets.toolkit.util back to summary

private Class Group.MapKeyComparator

extends Object
implements Comparator<String>
Class Inheritance
  • java.lang.Object
  • jdk.javadoc.internal.doclets.toolkit.util.Group.MapKeyComparator
All Implemented Interfaces
java.util.Comparator

Since we need to sort the keys in the reverse order(longest key first), the compare method in the implementing class is doing the reverse comparison.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compare(String key1, String key2)

Implements java.util.Comparator.compare.

Compares its two arguments for order.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MapKeyComparatorback to summary
private MapKeyComparator()

Method Detail

compareback to summary
public int compare(String key1, String key2)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Annotations
@Override