Package com.ibm.icu.impl
Class TZDBTimeZoneNames
- java.lang.Object
-
- com.ibm.icu.text.TimeZoneNames
-
- com.ibm.icu.impl.TZDBTimeZoneNames
-
- All Implemented Interfaces:
java.io.Serializable
public class TZDBTimeZoneNames extends TimeZoneNames
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.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
TZDBTimeZoneNames.TZDBNameInfo
private static class
TZDBTimeZoneNames.TZDBNames
private static class
TZDBTimeZoneNames.TZDBNameSearchHandler
-
Nested classes/interfaces inherited from class com.ibm.icu.text.TimeZoneNames
TimeZoneNames.Factory, TimeZoneNames.MatchInfo, TimeZoneNames.NameType
-
-
Field Summary
Fields Modifier and Type Field Description private ULocale
_locale
private java.lang.String
_region
private static long
serialVersionUID
private static java.util.concurrent.ConcurrentHashMap<java.lang.String,TZDBTimeZoneNames.TZDBNames>
TZDB_NAMES_MAP
private static TextTrieMap<TZDBTimeZoneNames.TZDBNameInfo>
TZDB_NAMES_TRIE
private static ICUResourceBundle
ZONESTRINGS
-
Constructor Summary
Constructors Constructor Description TZDBTimeZoneNames(ULocale loc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<TimeZoneNames.MatchInfo>
find(java.lang.CharSequence text, int start, java.util.EnumSet<TimeZoneNames.NameType> nameTypes)
Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.java.util.Set<java.lang.String>
getAvailableMetaZoneIDs()
Returns an immutable set of all available meta zone IDs.java.util.Set<java.lang.String>
getAvailableMetaZoneIDs(java.lang.String tzID)
Returns an immutable set of all available meta zone IDs used by the given time zone.java.lang.String
getMetaZoneDisplayName(java.lang.String mzID, TimeZoneNames.NameType type)
Returns the display name of the meta zone.java.lang.String
getMetaZoneID(java.lang.String tzID, long date)
Returns the meta zone ID for the given canonical time zone ID at the given date.private static TZDBTimeZoneNames.TZDBNames
getMetaZoneNames(java.lang.String mzID)
java.lang.String
getReferenceZoneID(java.lang.String mzID, java.lang.String region)
Returns the reference zone ID for the given meta zone ID for the region.private java.lang.String
getTargetRegion()
java.lang.String
getTimeZoneDisplayName(java.lang.String tzID, TimeZoneNames.NameType type)
Returns the display name of the time zone.private static void
prepareFind()
-
Methods inherited from class com.ibm.icu.text.TimeZoneNames
getDisplayName, getDisplayNames, getExemplarLocationName, getInstance, getInstance, getTZDBInstance, loadAllDisplayNames
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
TZDB_NAMES_MAP
private static final java.util.concurrent.ConcurrentHashMap<java.lang.String,TZDBTimeZoneNames.TZDBNames> TZDB_NAMES_MAP
-
TZDB_NAMES_TRIE
private static volatile TextTrieMap<TZDBTimeZoneNames.TZDBNameInfo> TZDB_NAMES_TRIE
-
ZONESTRINGS
private static final ICUResourceBundle ZONESTRINGS
-
_locale
private ULocale _locale
-
_region
private transient volatile java.lang.String _region
-
-
Constructor Detail
-
TZDBTimeZoneNames
public TZDBTimeZoneNames(ULocale loc)
-
-
Method Detail
-
getAvailableMetaZoneIDs
public java.util.Set<java.lang.String> getAvailableMetaZoneIDs()
Description copied from class:TimeZoneNames
Returns an immutable set of all available meta zone IDs.- Specified by:
getAvailableMetaZoneIDs
in classTimeZoneNames
- Returns:
- An immutable set of all available meta zone IDs.
-
getAvailableMetaZoneIDs
public java.util.Set<java.lang.String> getAvailableMetaZoneIDs(java.lang.String tzID)
Description copied from class:TimeZoneNames
Returns an immutable set of all available meta zone IDs used by the given time zone.- Specified by:
getAvailableMetaZoneIDs
in classTimeZoneNames
- Parameters:
tzID
- The canonical time zone ID.- Returns:
- An immutable set of all available meta zone IDs used by the given time zone.
-
getMetaZoneID
public java.lang.String getMetaZoneID(java.lang.String tzID, long date)
Description copied from class:TimeZoneNames
Returns the meta zone ID for the given canonical time zone ID at the given date.- Specified by:
getMetaZoneID
in classTimeZoneNames
- Parameters:
tzID
- The canonical time zone ID.date
- The date.- Returns:
- 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.
-
getReferenceZoneID
public java.lang.String getReferenceZoneID(java.lang.String mzID, java.lang.String region)
Description copied from class:TimeZoneNames
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).- Specified by:
getReferenceZoneID
in classTimeZoneNames
- Parameters:
mzID
- The meta zone ID.region
- The region.- Returns:
- 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.
-
getMetaZoneDisplayName
public java.lang.String getMetaZoneDisplayName(java.lang.String mzID, TimeZoneNames.NameType type)
Description copied from class:TimeZoneNames
Returns the display name of the meta zone.- Specified by:
getMetaZoneDisplayName
in classTimeZoneNames
- Parameters:
mzID
- The meta zone ID.type
- The display name type. SeeTimeZoneNames.NameType
.- Returns:
- 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.
-
getTimeZoneDisplayName
public java.lang.String getTimeZoneDisplayName(java.lang.String tzID, TimeZoneNames.NameType type)
Description copied from class:TimeZoneNames
Returns the display name of the time zone. UnlikeTimeZoneNames.getDisplayName(String, NameType, long)
, this method does not get a name from a meta zone used by the time zone.- Specified by:
getTimeZoneDisplayName
in classTimeZoneNames
- Parameters:
tzID
- The canonical time zone ID.type
- The display name type. SeeTimeZoneNames.NameType
.- Returns:
- 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.
-
find
public java.util.Collection<TimeZoneNames.MatchInfo> find(java.lang.CharSequence text, int start, java.util.EnumSet<TimeZoneNames.NameType> nameTypes)
Description copied from class:TimeZoneNames
Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.- Overrides:
find
in classTimeZoneNames
- Parameters:
text
- the text.start
- the starting offset within the text.nameTypes
- the set of name types, ornull
for all name types.- Returns:
- A collection of matches.
- See Also:
TimeZoneNames.NameType
,TimeZoneNames.MatchInfo
-
getMetaZoneNames
private static TZDBTimeZoneNames.TZDBNames getMetaZoneNames(java.lang.String mzID)
-
prepareFind
private static void prepareFind()
-
getTargetRegion
private java.lang.String getTargetRegion()
-
-