[Unicode]   Common Locale Data Repository : Bug Tracking Home | Site Map | Search
 

Changeset 9578


Ignore:
Timestamp:
12/19/13 13:02:08 (5 years ago)
Author:
jali01
Message:

cldrbug 6717: code cleanup

Location:
trunk/tools/java/org/unicode/cldr
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/java/org/unicode/cldr/tool/GenerateCldrTests.java

    r9577 r9578  
    447447     * public interface Equator { public boolean equals(Object o1, Object o2); } 
    448448     */ 
     449    @SuppressWarnings("rawtypes") 
    449450    static boolean intersects(Collection a, Collection b) { 
    450451        for (Iterator it = a.iterator(); it.hasNext();) { 
  • trunk/tools/java/org/unicode/cldr/tool/GenerateEnums.java

    r9577 r9578  
    259259    } 
    260260 
     261    @SuppressWarnings("rawtypes") 
    261262    private Object join(Collection collection, String separator) { 
    262263        if (collection == null) 
     
    533534    } 
    534535 
     536    @SuppressWarnings("rawtypes") 
    535537    private void compareSets(String name, Set availableCodes, String name2, 
    536538        Set cldrCodes) { 
     
    545547    } 
    546548 
     549    @SuppressWarnings("rawtypes") 
    547550    private void checkDuplicates(Map m) { 
    548551        Map backMap = new HashMap(); 
     
    683686        for (Iterator<String> it = reordered.iterator(); it.hasNext();) { 
    684687            String region = it.next(); 
    685             String cldrName = region.length() < 5 ? region : region.substring(2); // fix 
     688            // String cldrName = region.length() < 5 ? region : region.substring(2); // fix 
    686689            // UN 
    687690            // name 
     
    762765    } 
    763766 
    764     public final static class LengthFirstComparator implements Comparator { 
     767    public final static class LengthFirstComparator implements Comparator<Object> { 
    765768        public int compare(Object a, Object b) { 
    766769            String as = a.toString(); 
     
    774777    } 
    775778 
    776     public final class DeprecatedAndLengthFirstComparator implements Comparator { 
     779    public final class DeprecatedAndLengthFirstComparator implements Comparator<Object> { 
    777780        String type; 
    778781 
  • trunk/tools/java/org/unicode/cldr/tool/GenerateG2xG2.java

    r9577 r9578  
    125125        // show priorities 
    126126        Comparator<String> comp = new UTF16.StringComparator(); 
     127        @SuppressWarnings("unchecked") 
    127128        Set<String[]> priority_set = new TreeSet<String[]>(new ArrayComparator(new Comparator[] { comp, comp, comp })); 
    128129        for (Iterator<String> it = priorityMap.keySet().iterator(); it.hasNext();) { 
  • trunk/tools/java/org/unicode/cldr/tool/GenerateItemCounts.java

    r9577 r9578  
    201201                TreeSet<String> set1minus2 = Builder.with(new TreeSet<String>()).addAll(set1).removeAll(set2).get(); 
    202202                TreeSet<String> set2minus1 = Builder.with(new TreeSet<String>()).addAll(set2).removeAll(set1).get(); 
    203                 int diffCount = set1minus2.size() + set2minus1.size(); 
    204203                newCount.add(prefix, set2minus1.size()); 
    205204                deletedCount.add(prefix, set1minus2.size()); 
  • trunk/tools/java/org/unicode/cldr/tool/GenerateMaximalLocales.java

    r9513 r9578  
    1919import org.unicode.cldr.draft.ScriptMetadata; 
    2020import org.unicode.cldr.draft.ScriptMetadata.Info; 
    21 import org.unicode.cldr.tool.GenerateMaximalLocales.RowData; 
    2221import org.unicode.cldr.util.Builder; 
    2322import org.unicode.cldr.util.CLDRFile; 
  • trunk/tools/java/org/unicode/cldr/tool/GenerateStatistics.java

    r9577 r9578  
    174174     *            TODO 
    175175     */ 
     176    @SuppressWarnings({ "unchecked", "rawtypes" }) 
    176177    private static String showSet(Set nativeCountries, boolean transliterate, 
    177178        boolean isLanguage) { 
     
    322323    } 
    323324 
    324     private static class LanguageList implements Comparable { 
     325    private static class LanguageList implements Comparable<Object> { 
    325326        Object[] contents; 
    326327        static Collator col = Collator.getInstance(ULocale.ENGLISH); 
    327         static Comparator comp = new ArrayComparator(new Collator[] { col, col, null }); 
     328        static Comparator<Object[]> comp = new ArrayComparator(new Collator[] { col, col, null }); 
    328329 
    329330        LanguageList(String locale, String englishName, String localName) { 
  • trunk/tools/java/org/unicode/cldr/tool/GenerateTransformCharts.java

    r9577 r9578  
    918918    } 
    919919 
     920    @SuppressWarnings({ "rawtypes", "unchecked" }) 
    920921    static public class CollectionOfComparablesComparator implements Comparator { 
    921922        public int compare(Object o1, Object o2) { 
     
    946947    } 
    947948 
    948     static class ReverseComparator implements Comparator { 
     949    static class ReverseComparator implements Comparator<Object> { 
    949950        public int compare(Object o1, Object o2) { 
    950951            String a = o1.toString(); 
  • trunk/tools/java/org/unicode/cldr/tool/Misc.java

    r9577 r9578  
    706706 
    707707    void showOrderedTimezones() { 
    708         StandardCodes sc = StandardCodes.make(); 
     708        StandardCodes.make(); 
    709709    } 
    710710 
     
    744744        StandardCodes sc = StandardCodes.make(); 
    745745        System.out.println("Links: Old->New"); 
    746         Map<String, Object> m = sc.getZoneLinkold_new(); 
     746        Map<String, String> m = sc.getZoneLinkold_new(); 
    747747        int count = 0; 
    748748        for (Iterator<String> it = m.keySet().iterator(); it.hasNext();) { 
     
    769769        } 
    770770 
    771         m = sc.getZone_rules(); 
     771        Map<String, List<ZoneLine>> m2 = sc.getZone_rules(); 
    772772        System.out.println(); 
    773773        System.out.println("Zones with old IDs"); 
    774         for (Iterator<String> it = m.keySet().iterator(); it.hasNext();) { 
     774        for (Iterator<String> it = m2.keySet().iterator(); it.hasNext();) { 
    775775            String key = it.next(); 
    776776            if (oldIDs.contains(key)) System.out.println(key); 
     
    780780        System.out.println(); 
    781781        System.out.println("Zones without countries"); 
    782         TreeSet<String> temp = new TreeSet<String>(m.keySet()); 
     782        TreeSet<String> temp = new TreeSet<String>(m2.keySet()); 
    783783        temp.removeAll(modernIDs); 
    784784        System.out.println(temp); 
     
    803803        System.out.println(); 
    804804        System.out.println("Zone->RulesIDs"); 
    805         m = sc.getZone_rules(); 
    806         for (Iterator<String> it = m.keySet().iterator(); it.hasNext();) { 
     805        m2 = sc.getZone_rules(); 
     806        for (Iterator<String> it = m2.keySet().iterator(); it.hasNext();) { 
    807807            String key = it.next(); 
    808808            System.out.println(key + " => " + XPathParts.NEWLINE + "\t" 
    809                 + getSeparated((Collection) m.get(key), XPathParts.NEWLINE + "\t")); 
     809                + getSeparated(m2.get(key), XPathParts.NEWLINE + "\t")); 
    810810        } 
    811811 
    812812        System.out.println(); 
    813813        System.out.println("RulesID->Rules"); 
    814         m = sc.getZoneRuleID_rules(); 
    815         for (Iterator<String> it = m.keySet().iterator(); it.hasNext();) { 
     814        m2 = sc.getZoneRuleID_rules(); 
     815        for (Iterator<String> it = m2.keySet().iterator(); it.hasNext();) { 
    816816            String key = it.next(); 
    817817            System.out.println(key + " => " + XPathParts.NEWLINE + "\t" 
    818                 + getSeparated((Collection) m.get(key), XPathParts.NEWLINE + "\t")); 
     818                + getSeparated(m2.get(key), XPathParts.NEWLINE + "\t")); 
    819819        } 
    820820 
     
    827827        Map<String, List<RuleLine>> ruleID_Rules = sc.getZoneRuleID_rules(); 
    828828        Map<String, Set<String>> abb_zones = new TreeMap<String, Set<String>>(); 
    829         m = sc.getZone_rules(); 
    830         for (Iterator<String> it = m.keySet().iterator(); it.hasNext();) { 
     829        m2 = sc.getZone_rules(); 
     830        for (Iterator<String> it = m2.keySet().iterator(); it.hasNext();) { 
    831831            String key = it.next(); 
    832832            Set<String> abbreviations = new TreeSet<String>(); 
     
    834834            ZoneLine lastZoneLine = null; 
    835835 
    836             for (Iterator<ZoneLine> it2 = ((Collection) m.get(key)).iterator(); it2.hasNext();) { 
     836            for (Iterator<ZoneLine> it2 = m2.get(key).iterator(); it2.hasNext();) { 
    837837                ZoneLine zoneLine = it2.next(); 
    838838                //int thisYear = zoneLine.untilYear; 
    839839                String format = zoneLine.format; 
    840840                if (format.indexOf('/') >= 0) { 
    841                     Collection abb = Arrays.asList(format.split("/")); 
    842                     for (Iterator it3 = abb.iterator(); it3.hasNext();) { 
    843                         add(abbreviations, format.replaceAll("%s", it3.next().toString()), key, lastZoneLine, zoneLine); 
     841                    List<String> abb = Arrays.asList(format.split("/")); 
     842                    for (Iterator<String> it3 = abb.iterator(); it3.hasNext();) { 
     843                        add(abbreviations, format.replaceAll("%s", it3.next()), key, lastZoneLine, zoneLine); 
    844844                    } 
    845845                } else if (format.indexOf('%') >= 0) { 
     
    885885            String key = it.next(); 
    886886            System.out.println(key + " => " + XPathParts.NEWLINE + "\t" 
    887                 + getSeparated((Collection) abb_zones.get(key), XPathParts.NEWLINE + "\t")); 
     887                + getSeparated((Set<String>) abb_zones.get(key), XPathParts.NEWLINE + "\t")); 
    888888        } 
    889889 
     
    920920    } 
    921921 
     922    @SuppressWarnings("rawtypes") 
    922923    private static String getSeparated(Collection c, String separator) { 
    923924        StringBuffer result = new StringBuffer(); 
  • trunk/tools/java/org/unicode/cldr/tool/PivotData.java

    r9577 r9578  
    199199    } 
    200200 
     201    @SuppressWarnings("rawtypes") 
    201202    private int size(Iterator name) { 
    202203        int count = 0; 
    203204        while (name.hasNext()) { 
    204             Object x = name.next(); 
     205            name.next(); 
    205206            count++; 
    206207        } 
  • trunk/tools/java/org/unicode/cldr/tool/ShowData.java

    r9577 r9578  
    269269                    } 
    270270                    String value = file.getStringValue(path); 
    271                     if (value.equals("{0} meter")) { 
    272                         int debug = 0; 
    273                     } 
    274271 
    275272                    //String baileyValue = file.getBaileyValue(path, null, null); 
  • trunk/tools/java/org/unicode/cldr/tool/ShowLanguages.java

    r9577 r9578  
    500500        String languageName = english.getName(CLDRFile.LANGUAGE_NAME, language); 
    501501        if (languageName == null) languageName = "???"; 
    502         Comparable isLanguageTranslated = ""; 
     502        String isLanguageTranslated = ""; 
    503503        String nativeLanguageName = nativeLanguage == null ? null : nativeLanguage.getName(CLDRFile.LANGUAGE_NAME, 
    504504            language); 
     
    515515        // } 
    516516 
    517         Comparable isTerritoryTranslated = ""; 
     517        String isTerritoryTranslated = ""; 
    518518        String territoryName = english.getName(CLDRFile.TERRITORY_NAME, territory); 
    519519        String nativeTerritoryName = nativeLanguage == null ? null : nativeLanguage.getName(CLDRFile.TERRITORY_NAME, 
     
    524524        } 
    525525 
    526         Type t = Iso639Data.getType(language); 
     526        // Type t = Iso639Data.getType(language); 
    527527        // if ((s == Scope.Individual || s == Scope.Macrolanguage || s == Scope.Collection) && t == Type.Living) { 
    528528        // // ok 
  • trunk/tools/java/org/unicode/cldr/tool/SimpleLocaleParser.java

    r9519 r9578  
    106106        final String variantList = root.group(4); 
    107107        if (variantList == null) { 
    108             variants = (List<String>) Collections.EMPTY_LIST; 
     108            variants = Collections.emptyList(); 
    109109        } else { 
    110110            // make uppercase for compatibility with CLDR. 
  • trunk/tools/java/org/unicode/cldr/tool/TablePrinter.java

    r8278 r9578  
    173173    } 
    174174 
     175    @SuppressWarnings({ "rawtypes", "unchecked" }) 
    175176    public TablePrinter addCell(Comparable cell) { 
    176177        if (rows.size() > 0) { 
     
    198199    } 
    199200 
     201    @SuppressWarnings("unchecked") 
    200202    public TablePrinter addRow(Collection<Comparable<Object>> data) { 
    201203        addRow(data.toArray(new Comparable[data.size()])); 
     
    203205    } 
    204206 
     207    @SuppressWarnings({ "rawtypes", "unchecked" }) 
    205208    public TablePrinter addRows(Collection data) { 
    206209        for (Object row : data) { 
     
    214217    } 
    215218 
     219    @SuppressWarnings({ "rawtypes", "unchecked" }) 
    216220    public TablePrinter addRows(Comparable[][] data) { 
    217221        for (Comparable[] row : data) { 
     
    225229    } 
    226230 
     231    @SuppressWarnings("rawtypes") 
    227232    public String toTable() { 
    228233        Comparable[][] sortedFlat = (Comparable[][]) (rows.toArray(new Comparable[rows.size()][])); 
     
    230235    } 
    231236 
     237    @SuppressWarnings("rawtypes") 
    232238    static class ColumnSorter<T extends Comparable> implements Comparator<T[]> { 
    233239        private int[] sortPriorities = new int[0]; 
     
    235241        Collator englishCollator = Collator.getInstance(ULocale.ENGLISH); 
    236242 
     243        @SuppressWarnings("unchecked") 
    237244        public int compare(T[] o1, T[] o2) { 
    238245            int result; 
     
    272279    } 
    273280 
     281    @SuppressWarnings("rawtypes") 
    274282    ColumnSorter<Comparable> columnSorter = new ColumnSorter<Comparable>(); 
    275283 
     284    @SuppressWarnings("rawtypes") 
    276285    public String toTableInternal(Comparable[][] sortedFlat) { 
    277286        // TreeSet<String[]> sorted = new TreeSet(); 
     
    367376    static final char PDF = '\u202C'; 
    368377 
     378    @SuppressWarnings("rawtypes") 
    369379    private String format(Comparable comparable) { 
    370380        if (comparable == null) { 
     
    399409     * @return 
    400410     */ 
     411    @SuppressWarnings("rawtypes") 
    401412    private int findIdentical(Comparable[][] sortedFlat, int rowIndex, int colIndex) { 
    402413        if (!columnsFlat[colIndex].spanRows) return 1; 
     
    424435     * @return 
    425436     */ 
     437    @SuppressWarnings({ "rawtypes", "unchecked" }) 
    426438    private boolean breakSpans(Comparable[][] sortedFlat, int rowIndex) { 
    427439        for (int colIndex = 0; colIndex < breaksSpans.length(); ++colIndex) { 
  • trunk/tools/java/org/unicode/cldr/tool/WritePluralRulesSpreadsheets.java

    r9548 r9578  
    207207                System.out.println(oldVersion + "➞" + newVersion  
    208208                    + "\t" + TestInfo.getInstance().getEnglish().getName(locale)  
    209                     + "\t" + locale  
     209                    + "\t" + locale 
    210210                    + "\t" + type  
    211211                    //+ "\t" + oldKeywords + "\t" + newKeywords  
  • trunk/tools/java/org/unicode/cldr/util/SimpleEquivalenceClass.java

    r7859 r9578  
    4444    } 
    4545 
     46    @SuppressWarnings({"rawtypes", "unchecked"}) 
    4647    private class MyIterator implements Iterator { 
    4748        private Iterator it; 
     
    7071    } 
    7172 
    72     public Iterator getSetIterator(Comparator comp) { 
     73    public Iterator<Set<String>> getSetIterator(Comparator comp) { 
    7374        return new MyIterator(comp); 
    7475    } 
  • trunk/tools/java/org/unicode/cldr/util/StandardCodes.java

    r9546 r9578  
    3333import org.unicode.cldr.draft.ScriptMetadata.IdUsage; 
    3434import org.unicode.cldr.util.Iso639Data.Type; 
     35import org.unicode.cldr.util.ZoneParser.ZoneLine; 
    3536 
    3637import com.ibm.icu.dev.util.TransliteratorUtilities; 
     
    12051206     * @deprecated 
    12061207     */ 
    1207     public Map getZone_rules() { 
     1208    public Map<String, List<ZoneLine>> getZone_rules() { 
    12081209        return zoneParser.getZone_rules(); 
    12091210    } 
Note: See TracChangeset for help on using the changeset viewer.