| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
package com.ibm.icu.impl; |
| 12 |
|
|
| 13 |
|
import java.lang.ref.SoftReference; |
| 14 |
|
import java.text.ParsePosition; |
| 15 |
|
import java.util.Enumeration; |
| 16 |
|
import java.util.HashMap; |
| 17 |
|
import java.util.HashSet; |
| 18 |
|
import java.util.LinkedList; |
| 19 |
|
import java.util.List; |
| 20 |
|
import java.util.Map; |
| 21 |
|
import java.util.MissingResourceException; |
| 22 |
|
import java.util.Set; |
| 23 |
|
import java.util.Vector; |
| 24 |
|
|
| 25 |
|
import com.ibm.icu.text.MessageFormat; |
| 26 |
|
import com.ibm.icu.text.NumberFormat; |
| 27 |
|
import com.ibm.icu.util.SimpleTimeZone; |
| 28 |
|
import com.ibm.icu.util.TimeZone; |
| 29 |
|
import com.ibm.icu.util.ULocale; |
| 30 |
|
import com.ibm.icu.util.UResourceBundle; |
| 31 |
|
import com.ibm.icu.util.UResourceBundleIterator; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
@author |
| 45 |
|
@since |
| 46 |
|
|
|
|
|
| 85% |
Uncovered Elements: 109 (729) |
Complexity: 198 |
Complexity Density: 0.42 |
|
| 47 |
|
public final class ZoneMeta { |
| 48 |
|
private static final boolean ASSERT = false; |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
@param |
| 56 |
|
|
| 57 |
|
@return |
| 58 |
|
|
| 59 |
|
|
|
|
|
| 76% |
Uncovered Elements: 6 (25) |
Complexity: 6 |
Complexity Density: 0.35 |
|
| 60 |
9
|
public static synchronized String[] getAvailableIDs(String country) {... |
| 61 |
9
|
if(!getOlsonMeta()){ |
| 62 |
0
|
return EMPTY; |
| 63 |
|
} |
| 64 |
9
|
try{ |
| 65 |
9
|
UResourceBundle top = (ICUResourceBundle)ICUResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "zoneinfo", ICUResourceBundle.ICU_DATA_CLASS_LOADER); |
| 66 |
9
|
UResourceBundle regions = top.get(kREGIONS); |
| 67 |
9
|
UResourceBundle names = top.get(kNAMES); |
| 68 |
9
|
UResourceBundle temp = regions.get(country); |
| 69 |
8
|
int[] vector = temp.getIntVector(); |
| 70 |
0
|
if (ASSERT) Assert.assrt("vector.length>0", vector.length>0); |
| 71 |
8
|
String[] ret = new String[vector.length]; |
| 72 |
136
|
for (int i=0; i<vector.length; ++i) { |
| 73 |
0
|
if (ASSERT) Assert.assrt("vector[i] >= 0 && vector[i] < OLSON_ZONE_COUNT", |
| 74 |
|
vector[i] >= 0 && vector[i] < OLSON_ZONE_COUNT); |
| 75 |
128
|
ret[i] = names.getString(vector[i]); |
| 76 |
|
} |
| 77 |
8
|
return ret; |
| 78 |
|
}catch(MissingResourceException ex){ |
| 79 |
|
|
| 80 |
|
} |
| 81 |
1
|
return EMPTY; |
| 82 |
|
} |
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 83 |
234
|
public static synchronized String[] getAvailableIDs() {... |
| 84 |
234
|
if(!getOlsonMeta()){ |
| 85 |
0
|
return EMPTY; |
| 86 |
|
} |
| 87 |
234
|
try{ |
| 88 |
234
|
UResourceBundle top = (ICUResourceBundle)ICUResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "zoneinfo", ICUResourceBundle.ICU_DATA_CLASS_LOADER); |
| 89 |
234
|
UResourceBundle names = top.get(kNAMES); |
| 90 |
234
|
return names.getStringArray(); |
| 91 |
|
}catch(MissingResourceException ex){ |
| 92 |
|
|
| 93 |
|
} |
| 94 |
0
|
return EMPTY; |
| 95 |
|
} |
|
|
|
| 89.5% |
Uncovered Elements: 2 (19) |
Complexity: 7 |
Complexity Density: 0.64 |
|
| 96 |
61
|
public static synchronized String[] getAvailableIDs(int offset){... |
| 97 |
61
|
Vector vector = new Vector(); |
| 98 |
36783
|
for (int i=0; i<OLSON_ZONE_COUNT; ++i) { |
| 99 |
36722
|
String unistr; |
| 100 |
?
|
if ((unistr=getID(i))!=null) { |
| 101 |
|
|
| 102 |
36722
|
TimeZone z = TimeZone.getTimeZone(unistr); |
| 103 |
|
|
| 104 |
|
|
| 105 |
36722
|
if (z != null && z.getID().equals(unistr) && |
| 106 |
|
z.getRawOffset() == offset) { |
| 107 |
656
|
vector.add(unistr); |
| 108 |
|
} |
| 109 |
|
} |
| 110 |
|
} |
| 111 |
61
|
if(!vector.isEmpty()){ |
| 112 |
39
|
String[] strings = new String[vector.size()]; |
| 113 |
39
|
return (String[])vector.toArray(strings); |
| 114 |
|
} |
| 115 |
22
|
return EMPTY; |
| 116 |
|
} |
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 117 |
36722
|
private static String getID(int i) {... |
| 118 |
36722
|
try{ |
| 119 |
36722
|
UResourceBundle top = (ICUResourceBundle)ICUResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "zoneinfo", ICUResourceBundle.ICU_DATA_CLASS_LOADER); |
| 120 |
36722
|
UResourceBundle names = top.get(kNAMES); |
| 121 |
36722
|
return names.getString(i); |
| 122 |
|
}catch(MissingResourceException ex){ |
| 123 |
|
|
| 124 |
|
} |
| 125 |
0
|
return null; |
| 126 |
|
} |
| 127 |
|
|