Clover Coverage Report
Coverage timestamp: Fri Jun 27 2008 17:20:33 EDT
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
406   980   211   8.29
230   719   0.52   12.25
49     4.31  
4    
 
  ZoneStringFormat       Line # 29 350 172 91.5% 0.9149306
  ZoneStringFormat.ZoneStringInfo       Line # 108 13 11 100% 1.0
  ZoneStringFormat.ZoneStrings       Line # 692 24 17 91.7% 0.9166667
  ZoneStringFormat.ZoneStringSearchResultHandler       Line # 942 19 11 91.9% 0.9189189
 
No Tests
 
1    /*
2    *******************************************************************************
3    * Copyright (C) 2007-2008, International Business Machines Corporation and *
4    * others. All Rights Reserved. *
5    *******************************************************************************
6    */
7    package com.ibm.icu.impl;
8   
9    import java.util.ArrayList;
10    import java.util.HashMap;
11    import java.util.Iterator;
12    import java.util.List;
13    import java.util.Map;
14    import java.util.MissingResourceException;
15    import java.util.Set;
16   
17    import com.ibm.icu.text.MessageFormat;
18    import com.ibm.icu.util.BasicTimeZone;
19    import com.ibm.icu.util.Calendar;
20    import com.ibm.icu.util.TimeZone;
21    import com.ibm.icu.util.TimeZoneTransition;
22    import com.ibm.icu.util.ULocale;
23    import com.ibm.icu.util.UResourceBundle;
24   
25    /**
26    * @author yumaoka
27    *
28    */
 
29    public class ZoneStringFormat {
30    /**
31    * Constructs a ZoneStringFormat by zone strings array.
32    * The internal structure of zoneStrings is compatible with
33    * the one used by getZoneStrings/setZoneStrings in DateFormatSymbols.
34    *
35    * @param zoneStrings zone strings
36    */
 
37  2 toggle public ZoneStringFormat(String[][] zoneStrings) {
38  2 tzidToStrings = new HashMap();
39  2 zoneStringsTrie = new TextTrieMap(true);
40  872 for (int i = 0; i < zoneStrings.length; i++) {
41  870 String tzid = zoneStrings[i][0];
42  870 String[] names = new String[ZSIDX_MAX];
43  6960 for (int j = 1; j < zoneStrings[i].length; j++) {
44  6090 if (zoneStrings[i][j] != null) {
45  4042 int typeIdx = getNameTypeIndex(j);
46  4042 if (typeIdx != -1) {
47  4042 names[typeIdx] = zoneStrings[i][j];
48   
49    // Put the name into the trie
50  4042 int type = getNameType(typeIdx);
51  4042 ZoneStringInfo zsinfo = new ZoneStringInfo(tzid, zoneStrings[i][j], type);
52  4042 zoneStringsTrie.put(zoneStrings[i][j], zsinfo);
53    }
54   
55    }
56    }
57  870 ZoneStrings zstrings = new ZoneStrings(names, true, null);
58  870 tzidToStrings.put(tzid, zstrings);
59    }
60    }
61   
62    /**
63    * Gets an instance of ZoneStringFormat for the specified locale
64    * @param locale the locale
65    * @return An instance of ZoneStringFormat for the locale
66    */
 
67  2213560 toggle public static ZoneStringFormat getInstance(ULocale locale) {
68  2213560 ZoneStringFormat tzf = (ZoneStringFormat)TZFORMAT_CACHE.get(locale);