Top Description Inners Fields Constructors Methods
com.ibm.icu.impl

public Class TZDBTimeZoneNames

extends TimeZoneNames
Class Inheritance
Imports
java.util.Collection, .Collections, .EnumSet, .Iterator, .LinkedList, .MissingResourceException, .Set, java.util.concurrent.ConcurrentHashMap, com.ibm.icu.impl.TextTrieMap.ResultHandler, com.ibm.icu.text.TimeZoneNames, com.ibm.icu.util.ULocale, .UResourceBundle

Yet another TimeZoneNames implementation based on the tz database. This implementation contains only tz abbreviations (short standard and daylight names) for each metazone. The data file $ICU4C_ROOT/source/data/zone/tzdbNames.txt contains the metazone - abbreviations mapping data (manually edited).

Note

The abbreviations in the tz database are not necessarily unique. For example, parsing abbreviation "IST" is ambiguous (can be parsed as India Standard Time or Israel Standard Time). The data file (tzdbNames.txt) contains regional mapping, and the locale in the constructor is used as a hint for resolving these ambiguous names.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private ULocale
private transient volatile String
private static final long
private static final ConcurrentHashMap<String, TZDBTimeZoneNames.TZDBNames>
private static volatile TextTrieMap<TZDBTimeZoneNames.TZDBNameInfo>
private static final ICUResourceBundle

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Collection<TimeZoneNames.MatchInfo>
find(CharSequence
the text.
text
,
int
the starting offset within the text.
start
,
EnumSet<TimeZoneNames.NameType>
the set of name types, or null for all name types.
nameTypes
)

Overrides com.ibm.icu.text.TimeZoneNames.find.

Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.
public Set<String>
getAvailableMetaZoneIDs()

Implements abstract com.ibm.icu.text.TimeZoneNames.getAvailableMetaZoneIDs.

Returns an immutable set of all available meta zone IDs.
public Set<String>
getAvailableMetaZoneIDs(String
The canonical time zone ID.
tzID
)

Implements abstract com.ibm.icu.text.TimeZoneNames.getAvailableMetaZoneIDs.

Returns an immutable set of all available meta zone IDs used by the given time zone.
public String
getMetaZoneDisplayName(String
The meta zone ID.
mzID
,
TimeZoneNames.NameType
The display name type. See TimeZoneNames.NameType.
type
)

Implements abstract com.ibm.icu.text.TimeZoneNames.getMetaZoneDisplayName.

Returns the display name of the meta zone.
public String
getMetaZoneID(String
The canonical time zone ID.
tzID
,
long
The date.
date
)

Implements abstract com.ibm.icu.text.TimeZoneNames.getMetaZoneID.

Returns the meta zone ID for the given canonical time zone ID at the given date.
private static TZDBTimeZoneNames.TZDBNames
public String
getReferenceZoneID(String
The meta zone ID.
mzID
,
String
The region.
region
)

Implements abstract com.ibm.icu.text.TimeZoneNames.getReferenceZoneID.

Returns the reference zone ID for the given meta zone ID for the region.
private String
public String
getTimeZoneDisplayName(String
The canonical time zone ID.
tzID
,
TimeZoneNames.NameType
The display name type. See TimeZoneNames.NameType.
type
)

Implements abstract com.ibm.icu.text.TimeZoneNames.getTimeZoneDisplayName.

Returns the display name of the time zone.
private static void
Inherited from com.ibm.icu.text.TimeZoneNames:
getDisplayNamegetDisplayNamesgetExemplarLocationNamegetInstancegetInstancegetTZDBInstanceloadAllDisplayNames

Field Detail

_localeback to summary
private ULocale _locale
_regionback to summary
private transient volatile String _region
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.ibm.icu.text.TimeZoneNames.serialVersionUID.

TZDB_NAMES_MAPback to summary
private static final ConcurrentHashMap<String, TZDBTimeZoneNames.TZDBNames> TZDB_NAMES_MAP
TZDB_NAMES_TRIEback to summary
private static volatile TextTrieMap<TZDBTimeZoneNames.TZDBNameInfo> TZDB_NAMES_TRIE
ZONESTRINGSback to summary
private static final ICUResourceBundle ZONESTRINGS

Constructor Detail

TZDBTimeZoneNamesback to summary
public TZDBTimeZoneNames(ULocale loc)

Method Detail

findback to summary
public Collection<TimeZoneNames.MatchInfo> find(CharSequence text, int start, EnumSet<TimeZoneNames.NameType> nameTypes)

Overrides com.ibm.icu.text.TimeZoneNames.find.

Doc from com.ibm.icu.text.TimeZoneNames.find.

Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.

Parameters
text:CharSequence

the text.

start:int

the starting offset within the text.

nameTypes:EnumSet<TimeZoneNames.NameType>

the set of name types, or null for all name types.

Returns:Collection<TimeZoneNames.MatchInfo>

A collection of matches.

Annotations
@Override
getAvailableMetaZoneIDsback to summary
public Set<String> getAvailableMetaZoneIDs()

Implements abstract com.ibm.icu.text.TimeZoneNames.getAvailableMetaZoneIDs.

Doc from com.ibm.icu.text.TimeZoneNames.getAvailableMetaZoneIDs.

Returns an immutable set of all available meta zone IDs.

Returns:Set<String>

An immutable set of all available meta zone IDs.

Annotations
@Override
getAvailableMetaZoneIDsback to summary
public Set<String> getAvailableMetaZoneIDs(String tzID)

Implements abstract com.ibm.icu.text.TimeZoneNames.getAvailableMetaZoneIDs.

Doc from com.ibm.icu.text.TimeZoneNames.getAvailableMetaZoneIDs.

Returns an immutable set of all available meta zone IDs used by the given time zone.

Parameters
tzID:String

The canonical time zone ID.

Returns:Set<String>

An immutable set of all available meta zone IDs used by the given time zone.

Annotations
@Override
getMetaZoneDisplayNameback to summary
public String getMetaZoneDisplayName(String mzID, TimeZoneNames.NameType type)

Implements abstract com.ibm.icu.text.TimeZoneNames.getMetaZoneDisplayName.

Doc from com.ibm.icu.text.TimeZoneNames.getMetaZoneDisplayName.

Returns the display name of the meta zone.

Parameters
mzID:String

The meta zone ID.

type:TimeZoneNames.NameType

The display name type. See TimeZoneNames.NameType.

Returns:String

The display name of the meta zone. When this object does not have a localized display name for the given meta zone with the specified type or the implementation does not provide any display names associated with meta zones, null is returned.

Annotations
@Override
getMetaZoneIDback to summary
public String getMetaZoneID(String tzID, long date)

Implements abstract com.ibm.icu.text.TimeZoneNames.getMetaZoneID.

Doc from com.ibm.icu.text.TimeZoneNames.getMetaZoneID.

Returns the meta zone ID for the given canonical time zone ID at the given date.

Parameters
tzID:String

The canonical time zone ID.

date:long

The date.

Returns:String

The meta zone ID for the given time zone ID at the given date. If the time zone does not have a corresponding meta zone at the given date or the implementation does not support meta zones, null is returned.

Annotations
@Override
getMetaZoneNamesback to summary
private static TZDBTimeZoneNames.TZDBNames getMetaZoneNames(String mzID)
getReferenceZoneIDback to summary
public String getReferenceZoneID(String mzID, String region)

Implements abstract com.ibm.icu.text.TimeZoneNames.getReferenceZoneID.

Doc from com.ibm.icu.text.TimeZoneNames.getReferenceZoneID.

Returns the reference zone ID for the given meta zone ID for the region.

Note

Each meta zone must have a reference zone associated with a special region "001" (world). Some meta zones may have region specific reference zone IDs other than the special region "001". When a meta zone does not have any region specific reference zone IDs, this method return the reference zone ID for the special region "001" (world).

Parameters
mzID:String

The meta zone ID.

region:String

The region.

Returns:String

The reference zone ID ("golden zone" in the LDML specification) for the given time zone ID for the region. If the meta zone is unknown or the implementation does not support meta zones, null is returned.

Annotations
@Override
getTargetRegionback to summary
private String getTargetRegion()
getTimeZoneDisplayNameback to summary
public String getTimeZoneDisplayName(String tzID, TimeZoneNames.NameType type)

Implements abstract com.ibm.icu.text.TimeZoneNames.getTimeZoneDisplayName.

Doc from com.ibm.icu.text.TimeZoneNames.getTimeZoneDisplayName.

Returns the display name of the time zone. Unlike getDisplayName(String, NameType, long), this method does not get a name from a meta zone used by the time zone.

Parameters
tzID:String

The canonical time zone ID.

type:TimeZoneNames.NameType

The display name type. See TimeZoneNames.NameType.

Returns:String

The display name for the time zone. When this object does not have a localized display name for the given time zone with the specified type, null is returned.

Annotations
@Override
prepareFindback to summary
private static void prepareFind()
com.ibm.icu.impl back to summary

private Class TZDBTimeZoneNames.TZDBNameInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final boolean
pack-priv final String
pack-priv final String[]
pack-priv final TimeZoneNames.NameType

Constructor Summary

AccessConstructor and Description
pack-priv
TZDBNameInfo(String mzID, TimeZoneNames.NameType type, boolean ambiguousType, String[] parseRegions)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ambiguousTypeback to summary
pack-priv final boolean ambiguousType
mzIDback to summary
pack-priv final String mzID
parseRegionsback to summary
pack-priv final String[] parseRegions
typeback to summary
pack-priv final TimeZoneNames.NameType type

Constructor Detail

TZDBNameInfoback to summary
pack-priv TZDBNameInfo(String mzID, TimeZoneNames.NameType type, boolean ambiguousType, String[] parseRegions)
com.ibm.icu.impl back to summary

private Class TZDBTimeZoneNames.TZDBNames

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private String[]
private String[]
public static final TZDBTimeZoneNames.TZDBNames
private static final String[]

Constructor Summary

AccessConstructor and Description
private
TZDBNames(String[] names, String[] parseRegions)

Method Summary

Modifier and TypeMethod and Description
pack-priv static TZDBTimeZoneNames.TZDBNames
pack-priv String
pack-priv String[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_namesback to summary
private String[] _names
_parseRegionsback to summary
private String[] _parseRegions
EMPTY_TZDBNAMESback to summary
public static final TZDBTimeZoneNames.TZDBNames EMPTY_TZDBNAMES
KEYSback to summary
private static final String[] KEYS

Constructor Detail

TZDBNamesback to summary
private TZDBNames(String[] names, String[] parseRegions)

Method Detail

getInstanceback to summary
pack-priv static TZDBTimeZoneNames.TZDBNames getInstance(ICUResourceBundle zoneStrings, String key)
getNameback to summary
pack-priv String getName(TimeZoneNames.NameType type)
getParseRegionsback to summary
pack-priv String[] getParseRegions()
com.ibm.icu.impl back to summary

private Class TZDBTimeZoneNames.TZDBNameSearchHandler

extends Object
implements TextTrieMap.ResultHandler<TZDBTimeZoneNames.TZDBNameInfo>
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.TextTrieMap.ResultHandler

Field Summary

Modifier and TypeField and Description
private Collection<TimeZoneNames.MatchInfo>
private EnumSet<TimeZoneNames.NameType>
private String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Collection<TimeZoneNames.MatchInfo>

Returns:

the match results
getMatches
()

Returns the match results

public boolean
handlePrefixMatch(int
Matched key's length
matchLength
,
Iterator<TZDBTimeZoneNames.TZDBNameInfo>
An iterator of the objects associated with the matched key
values
)

Implements com.ibm.icu.impl.TextTrieMap.ResultHandler.handlePrefixMatch.

Handles a prefix key match
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_matchesback to summary
private Collection<TimeZoneNames.MatchInfo> _matches
_nameTypesback to summary
private EnumSet<TimeZoneNames.NameType> _nameTypes
_regionback to summary
private String _region

Constructor Detail

TZDBNameSearchHandlerback to summary
pack-priv TZDBNameSearchHandler(EnumSet<TimeZoneNames.NameType> nameTypes, String region)

Method Detail

getMatchesback to summary
public Collection<TimeZoneNames.MatchInfo> getMatches()

Returns the match results

Returns:Collection<TimeZoneNames.MatchInfo>

the match results

handlePrefixMatchback to summary
public boolean handlePrefixMatch(int matchLength, Iterator<TZDBTimeZoneNames.TZDBNameInfo> values)

Implements com.ibm.icu.impl.TextTrieMap.ResultHandler.handlePrefixMatch.

Doc from com.ibm.icu.impl.TextTrieMap.ResultHandler.handlePrefixMatch.

Handles a prefix key match

Parameters
matchLength:int

Matched key's length

values:Iterator<TZDBTimeZoneNames.TZDBNameInfo>

An iterator of the objects associated with the matched key

Returns:boolean

Return true to continue the search in the trie, false to quit.

Annotations
@Override