LEFT | RIGHT |
(no file at all) | |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html#License | 2 // License & terms of use: http://www.unicode.org/copyright.html#License |
3 /* | 3 /* |
4 ******************************************************************************* | 4 ******************************************************************************* |
5 * Copyright (C) 2011-2016, International Business Machines Corporation and | 5 * Copyright (C) 2011-2016, International Business Machines Corporation and |
6 * others. All Rights Reserved. | 6 * others. All Rights Reserved. |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 */ | 8 */ |
9 package com.ibm.icu.text; | 9 package com.ibm.icu.text; |
10 | 10 |
(...skipping 3013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 TextTrieMap<String> trie = new TextTrieMap<String>(true); | 3024 TextTrieMap<String> trie = new TextTrieMap<String>(true); |
3025 String[] ids = TimeZone.getAvailableIDs(); | 3025 String[] ids = TimeZone.getAvailableIDs(); |
3026 for (String id : ids) { | 3026 for (String id : ids) { |
3027 trie.put(id, id); | 3027 trie.put(id, id); |
3028 } | 3028 } |
3029 ZONE_ID_TRIE = trie; | 3029 ZONE_ID_TRIE = trie; |
3030 } | 3030 } |
3031 } | 3031 } |
3032 } | 3032 } |
3033 | 3033 |
3034 int[] matchLen = new int[] {0}; | 3034 TextTrieMap.Output trieOutput = new TextTrieMap.Output(); |
3035 Iterator<String> itr = ZONE_ID_TRIE.get(text, pos.getIndex(), matchLen); | 3035 Iterator<String> itr = ZONE_ID_TRIE.get(text, pos.getIndex(), trieOutput
); |
3036 if (itr != null) { | 3036 if (itr != null) { |
3037 resolvedID = itr.next(); | 3037 resolvedID = itr.next(); |
3038 pos.setIndex(pos.getIndex() + matchLen[0]); | 3038 pos.setIndex(pos.getIndex() + trieOutput.matchLength); |
3039 } else { | 3039 } else { |
3040 // TODO | 3040 // TODO |
3041 // We many need to handle rule based custom zone ID (See ZoneMeta.pa
rseCustomID), | 3041 // We many need to handle rule based custom zone ID (See ZoneMeta.pa
rseCustomID), |
3042 // such as GM+05:00. However, the public parse method in this class
also calls | 3042 // such as GM+05:00. However, the public parse method in this class
also calls |
3043 // parseOffsetLocalizedGMT and custom zone IDs are likely supported
by the parser, | 3043 // parseOffsetLocalizedGMT and custom zone IDs are likely supported
by the parser, |
3044 // so we might not need to handle them here. | 3044 // so we might not need to handle them here. |
3045 pos.setErrorIndex(pos.getIndex()); | 3045 pos.setErrorIndex(pos.getIndex()); |
3046 } | 3046 } |
3047 return resolvedID; | 3047 return resolvedID; |
3048 } | 3048 } |
(...skipping 18 matching lines...) Expand all Loading... |
3067 trie.put(shortID, id); | 3067 trie.put(shortID, id); |
3068 } | 3068 } |
3069 } | 3069 } |
3070 // Canonical list does not contain Etc/Unknown | 3070 // Canonical list does not contain Etc/Unknown |
3071 trie.put(UNKNOWN_SHORT_ZONE_ID, UNKNOWN_ZONE_ID); | 3071 trie.put(UNKNOWN_SHORT_ZONE_ID, UNKNOWN_ZONE_ID); |
3072 SHORT_ZONE_ID_TRIE = trie; | 3072 SHORT_ZONE_ID_TRIE = trie; |
3073 } | 3073 } |
3074 } | 3074 } |
3075 } | 3075 } |
3076 | 3076 |
3077 int[] matchLen = new int[] {0}; | 3077 TextTrieMap.Output trieOutput = new TextTrieMap.Output(); |
3078 Iterator<String> itr = SHORT_ZONE_ID_TRIE.get(text, pos.getIndex(), matc
hLen); | 3078 Iterator<String> itr = SHORT_ZONE_ID_TRIE.get(text, pos.getIndex(), trie
Output); |
3079 if (itr != null) { | 3079 if (itr != null) { |
3080 resolvedID = itr.next(); | 3080 resolvedID = itr.next(); |
3081 pos.setIndex(pos.getIndex() + matchLen[0]); | 3081 pos.setIndex(pos.getIndex() + trieOutput.matchLength); |
3082 } else { | 3082 } else { |
3083 pos.setErrorIndex(pos.getIndex()); | 3083 pos.setErrorIndex(pos.getIndex()); |
3084 } | 3084 } |
3085 | 3085 |
3086 return resolvedID; | 3086 return resolvedID; |
3087 } | 3087 } |
3088 | 3088 |
3089 /** | 3089 /** |
3090 * Parse an exemplar location string. | 3090 * Parse an exemplar location string. |
3091 * @param text the text contains an exemplar location string at the position
. | 3091 * @param text the text contains an exemplar location string at the position
. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 * @stable ICU 49 | 3296 * @stable ICU 49 |
3297 */ | 3297 */ |
3298 @Override | 3298 @Override |
3299 public TimeZoneFormat cloneAsThawed() { | 3299 public TimeZoneFormat cloneAsThawed() { |
3300 TimeZoneFormat copy = (TimeZoneFormat)super.clone(); | 3300 TimeZoneFormat copy = (TimeZoneFormat)super.clone(); |
3301 copy._frozen = false; | 3301 copy._frozen = false; |
3302 return copy; | 3302 return copy; |
3303 } | 3303 } |
3304 } | 3304 } |
3305 | 3305 |
LEFT | RIGHT |