APIdia Launch Partner
Top Description Constructors Methods
sun.util.locale

public final Class LocaleMatcher

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collection, .HashMap, .List, .Locale, .Locale.FilteringMode, .Locale.LanguageRange, .Map, .Objects

Implementation for BCP47 Locale matching

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
caseInsensitiveMatch(List<String> list, String tag)

Returns true if the given list contains an element which matches with the given tag ignoring case considerations.

public static List<Locale>
private static List<String>
private static List<String>
public static List<String>
private static String
private static String[]
private static int
public static Locale
lookup(List<Locale.LanguageRange> priorityList, Collection<Locale> locales)

public static String
public static List<Locale.LanguageRange>
private static int
matchFilterExtendedSubtags(String[] rangeSubtags, String[] tagSubtags)

public static List<Locale.LanguageRange>
parse(String ranges)

private static String
replaceFirstSubStringMatch(String range, String substr, String replacement)

A faster alternative approach to String.replaceFirst(), if the given string is a literal String, not a regex.

private static boolean
shouldIgnoreFilterBasicMatch(List<Locale.LanguageRange> zeroRange, String tag)

The tag which is falling in the basic exclusion range(s) should not be considered as the matching tag.

private static boolean
shouldIgnoreFilterExtendedMatch(List<Locale.LanguageRange> zeroRange, String tag)

The tag which is falling in the extended exclusion range(s) should not be considered as the matching tag.

private static boolean
shouldIgnoreLookupMatch(List<Locale.LanguageRange> zeroRange, String tag)

The tag which is falling in the exclusion range(s) should not be considered as the matching tag.

private static int
private static String
truncateRange(String rangeForRegex)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LocaleMatcherback to summary
private LocaleMatcher()

Method Detail

caseInsensitiveMatchback to summary
private static boolean caseInsensitiveMatch(List<String> list, String tag)

Returns true if the given list contains an element which matches with the given tag ignoring case considerations.

filterback to summary
public static List<Locale> filter(List<Locale.LanguageRange> priorityList, Collection<Locale> locales, Locale.FilteringMode mode)
filterBasicback to summary
private static List<String> filterBasic(List<Locale.LanguageRange> priorityList, Collection<String> tags)
filterExtendedback to summary
private static List<String> filterExtended(List<Locale.LanguageRange> priorityList, Collection<String> tags)
filterTagsback to summary
public static List<String> filterTags(List<Locale.LanguageRange> priorityList, Collection<String> tags, Locale.FilteringMode mode)
getEquivalentForRegionAndVariantback to summary
private static String getEquivalentForRegionAndVariant(String range)
getEquivalentsForLanguageback to summary
private static String[] getEquivalentsForLanguage(String range)
getExtentionKeyIndexback to summary
private static int getExtentionKeyIndex(String s)
lookupback to summary
public static Locale lookup(List<Locale.LanguageRange> priorityList, Collection<Locale> locales)
lookupTagback to summary
public static String lookupTag(List<Locale.LanguageRange> priorityList, Collection<String> tags)
mapEquivalentsback to summary
public static List<Locale.LanguageRange> mapEquivalents(List<Locale.LanguageRange> priorityList, Map<String, List<String>> map)
matchFilterExtendedSubtagsback to summary
private static int matchFilterExtendedSubtags(String[] rangeSubtags, String[] tagSubtags)
parseback to summary
public static List<Locale.LanguageRange> parse(String ranges)
replaceFirstSubStringMatchback to summary
private static String replaceFirstSubStringMatch(String range, String substr, String replacement)

A faster alternative approach to String.replaceFirst(), if the given string is a literal String, not a regex.

shouldIgnoreFilterBasicMatchback to summary
private static boolean shouldIgnoreFilterBasicMatch(List<Locale.LanguageRange> zeroRange, String tag)

The tag which is falling in the basic exclusion range(s) should not be considered as the matching tag. Ignores the tag matching with the non-zero ranges, if the tag also matches with one of the basic exclusion ranges i.e. range(s) having quality weight q=0

shouldIgnoreFilterExtendedMatchback to summary
private static boolean shouldIgnoreFilterExtendedMatch(List<Locale.LanguageRange> zeroRange, String tag)

The tag which is falling in the extended exclusion range(s) should not be considered as the matching tag. Ignores the tag matching with the non zero range(s), if the tag also matches with one of the extended exclusion range(s) i.e. range(s) having quality weight q=0

shouldIgnoreLookupMatchback to summary
private static boolean shouldIgnoreLookupMatch(List<Locale.LanguageRange> zeroRange, String tag)

The tag which is falling in the exclusion range(s) should not be considered as the matching tag. Ignores the tag matching with the non zero range(s), if the tag also matches with one of the exclusion range(s) i.e. range(s) having quality weight q=0.

splitRangesback to summary
private static int splitRanges(List<Locale.LanguageRange> priorityList)
truncateRangeback to summary
private static String truncateRange(String rangeForRegex)