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

Changeset 9561


Ignore:
Timestamp:
12/16/13 14:24:11 (5 years ago)
Author:
jali01
Message:

cldrbug 6717: code cleanup

Location:
trunk/tools
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/cldr-apps/src/org/unicode/cldr/web/DataSection.java

    r9557 r9561  
    28312831        CLDRFile oldFile = stf.getOldFile(locale); 
    28322832        diskFile = stf.getDiskFile(locale); 
    2833         List<?> examplesResult = new ArrayList<Object>(); 
     2833        List<CheckStatus> examplesResult = new ArrayList<CheckStatus>(); 
    28342834        long lastTime = -1; 
    28352835        String workPrefix = xpathPrefix; 
     
    32613261                    myItem.examples = new Vector<ExampleEntry>(); 
    32623262                } 
    3263                 for (Iterator<?> it3 = examplesResult.iterator(); it3.hasNext();) { 
    3264                     CheckCLDR.CheckStatus status = (CheckCLDR.CheckStatus) it3.next(); 
     3263                for (Iterator<CheckStatus> it3 = examplesResult.iterator(); it3.hasNext();) { 
     3264                    CheckCLDR.CheckStatus status = it3.next(); 
    32653265                    myItem.examples.add(addExampleEntry(new ExampleEntry(this, p, myItem, status))); 
    32663266                } 
  • trunk/tools/java/org/unicode/cldr/test/QuickCheck.java

    r9548 r9561  
    99import java.util.HashSet; 
    1010import java.util.Iterator; 
    11 import java.util.Locale; 
    1211import java.util.Objects; 
    1312import java.util.Set; 
     
    3736 
    3837import com.ibm.icu.dev.util.Relation; 
    39 import com.ibm.icu.text.DateFormat; 
    4038import com.ibm.icu.text.DateFormatSymbols; 
    4139import com.ibm.icu.text.SimpleDateFormat; 
     
    5957    private static String mainDirectory; 
    6058 
    61     private static boolean showForceZoom; 
    62  
    6359    private static boolean resolved; 
    6460 
     
    8379        // System.out.println("Main Source Directory: " + commonDirectory + 
    8480        // "\t\t(to change, use -DSOURCE=xxx, eg -DSOURCE=C:/cvsdata/unicode/cldr/incoming/proposed/main)"); 
    85  
    86         showForceZoom = CldrUtility.getProperty("forcezoom", "false", "true").matches("(?i)T|TRUE"); 
    8781 
    8882        resolved = CldrUtility.getProperty("resolved", "false", "true").matches("(?i)T|TRUE"); 
     
    325319    } 
    326320 
    327     private static final String[] STOCK = { "short", "medium", "long", "full" }; 
    328  
    329321    static void checkStock() { 
    330322        TestInfo testInfo = TestInfo.getInstance(); 
  • trunk/tools/java/org/unicode/cldr/test/TestCLDRTests.java

    r9480 r9561  
    333333        static final boolean DEBUG = false; 
    334334        StringBuffer lastChars = new StringBuffer(); 
    335         boolean justPopped = false; 
    336335        Handler handler; 
    337336 
     
    357356                } 
    358357                // if (DEBUG) System.out.println("startElement:\t" + contextStack); 
    359                 justPopped = false; 
    360358            } catch (RuntimeException e) { 
    361359                e.printStackTrace(); 
     
    374372                } 
    375373                lastChars.setLength(0); 
    376                 justPopped = true; 
    377374            } catch (RuntimeException e) { 
    378375                e.printStackTrace(); 
     
    388385                if (DEBUG) System.out.println("characters:\t" + value); 
    389386                lastChars.append(value); 
    390                 justPopped = false; 
    391387            } catch (RuntimeException e) { 
    392388                e.printStackTrace(); 
  • trunk/tools/java/org/unicode/cldr/test/TestCache.java

    r9409 r9561  
    4242        } 
    4343 
    44         public void getExamples(String path, String value, List result) { 
     44        public void getExamples(String path, String value, List<CheckStatus> result) { 
    4545            cc.getExamples(path, file.getFullXPath(path), value, options, result); 
    4646        } 
  • trunk/tools/java/org/unicode/cldr/test/TestSegments.java

    r9480 r9561  
    106106            System.out.println("Testing"); 
    107107            Segmenter rl = rb.make(); 
    108             Collection values = rl.getSamples().getAvailableValues(); 
     108            Collection<Object> values = rl.getSamples().getAvailableValues(); 
    109109            System.out.println("Value Partition: " + values); 
    110110 
  • trunk/tools/java/org/unicode/cldr/tool/CLDRFormat.java

    r9480 r9561  
    1414import org.unicode.cldr.util.Factory; 
    1515import org.unicode.cldr.util.SimpleFactory; 
    16 import org.unicode.cldr.util.XPathParts.Comments; 
     16//import org.unicode.cldr.util.XPathParts.Comments; 
    1717 
    1818import com.ibm.icu.dev.util.BagFormatter; 
     
    105105            } 
    106106        } 
    107         Comments comments1 = cldrFile.getXpath_comments(); 
    108         Comments comments2 = regenFile.getXpath_comments(); 
     107//        Comments comments1 = cldrFile.getXpath_comments(); 
     108//        Comments comments2 = regenFile.getXpath_comments(); 
    109109        // TODO fix later 
    110110        return null; 
  • trunk/tools/java/org/unicode/cldr/tool/CheckEnglishCurrencyNames.java

    r9480 r9561  
    2929        Date now = new Date(); 
    3030        Set<String> currencyCodes = sc.getGoodAvailableCodes("currency"); 
    31         Relation<String, String> currencyCodesWithDates = new Relation(new TreeMap(), TreeSet.class); 
    32         Relation<String, String> modernCurrencyCodes2territory = new Relation(new TreeMap(), TreeSet.class); 
     31        Relation<String, String> currencyCodesWithDates = Relation.of(new TreeMap<String, Set<String>>(), TreeSet.class); 
     32        Relation<String, String> modernCurrencyCodes2territory = Relation.of(new TreeMap<String, Set<String>>(), TreeSet.class); 
    3333        Set<String> territoriesWithoutModernCurrencies = new TreeSet<String>(sc.getGoodAvailableCodes("territory")); 
    3434 
  • trunk/tools/java/org/unicode/cldr/tool/CheckHtmlFiles.java

    r9517 r9561  
    7171//        } 
    7272//        Data source = new Data().getSentences(MyOptions.old.option.getValue()); 
    73         String file = MyOptions.target.option.getValue(); 
     73//        String file = MyOptions.target.option.getValue(); 
    7474         
    75         Data target = new Data().getSentences(file); 
     75//        Data target = new Data().getSentences(file); 
    7676 
    7777//        int missingCount = 0, extraCount = 0; 
     
    311311        Levels lastBuildLevel; 
    312312        private Set<String> errors = new LinkedHashSet<String>(); 
    313         private Set<String> warnings = new LinkedHashSet<String>(); 
    314313        Output<Boolean> missingLevel = new Output<Boolean>(false); 
    315314 
     
    580579        private String normalizeWhitespace(CharSequence input) { 
    581580            Matcher m = WHITESPACE.matcher(input); 
    582             int pos = input.toString().indexOf('\n'); 
    583581            StringBuilder buffer = new StringBuilder(); 
    584582            int last = 0; 
  • trunk/tools/java/org/unicode/cldr/tool/CheckLangTagBNF.java

    r9480 r9561  
    1111import java.util.Map; 
    1212import java.util.Random; 
    13 import java.util.Set; 
     13//import java.util.Set; 
    1414import java.util.regex.Matcher; 
    1515import java.util.regex.Pattern; 
     
    1717import org.unicode.cldr.util.CldrUtility; 
    1818import org.unicode.cldr.util.LanguageTagParser; 
    19 import org.unicode.cldr.util.StandardCodes; 
     19//import org.unicode.cldr.util.StandardCodes; 
    2020 
    2121import com.ibm.icu.dev.util.BNF; 
     
    218218        // System.out.println(langTagPattern); 
    219219        // System.out.println(cleanedLangTagPattern); 
    220         StandardCodes sc = StandardCodes.make(); 
    221         Set<String> grandfathered = sc.getAvailableCodes("grandfathered"); 
     220//        StandardCodes sc = StandardCodes.make(); 
     221//        Set<String> grandfathered = sc.getAvailableCodes("grandfathered"); 
    222222        // for (Iterator it = grandfathered.iterator(); it.hasNext();) { 
    223223        // System.out.print(it.next() + " | "); 
     
    231231        BufferedReader in = BagFormatter.openUTF8Reader("", LANGUAGE_TAG_TEST_FILE); 
    232232 
    233         for (int i = 0;; ++i) { 
     233        while (true) { 
    234234            String test = in.readLine(); 
    235235            if (test == null) break; 
  • trunk/tools/java/org/unicode/cldr/tool/CompareStockDatetime.java

    r9480 r9561  
    5353                Relation<String, String> skeletonToLocales = lengthToSkeletonToLocales.get(key); 
    5454                if (skeletonToLocales == null) { 
    55                     lengthToSkeletonToLocales.put(key, skeletonToLocales = new Relation(new TreeMap(), TreeSet.class)); 
     55                    lengthToSkeletonToLocales.put(key, skeletonToLocales = Relation.of(new TreeMap<String, Set<String>>(), TreeSet.class)); 
    5656                } 
    5757                skeletonToLocales.put(skeleton, locale); 
  • trunk/tools/java/org/unicode/cldr/tool/ConvertLanguageData.java

    r9480 r9561  
    1111import java.util.Comparator; 
    1212import java.util.EnumMap; 
    13 import java.util.EnumSet; 
    1413import java.util.HashMap; 
    1514import java.util.HashSet; 
     
    276275            Relation<BasicLanguageData.Type, String> status_territories = language_status_territories.get(languageCode); 
    277276            if (status_territories == null) { 
    278                 language_status_territories.put(languageCode, status_territories = new Relation( 
    279                     new TreeMap(), 
     277                language_status_territories.put(languageCode, status_territories = Relation.of( 
     278                    new TreeMap<BasicLanguageData.Type, Set<String>>(), 
    280279                    TreeSet.class)); 
    281280            } 
     
    395394    private static void checkBasicData(Map<String, RowData> localeToRowData) { 
    396395        // find languages with multiple scripts 
    397         Relation<String, String> languageToScripts = new Relation(new TreeMap(), TreeSet.class); 
     396        Relation<String, String> languageToScripts = Relation.of(new TreeMap<String, Set<String>>(), TreeSet.class); 
    398397        for (String languageSubtag : language2BasicLanguageData.keySet()) { 
    399398            for (BasicLanguageData item : language2BasicLanguageData.getAll(languageSubtag)) { 
    400                 Set<String> scripts = new TreeSet<String>(); 
    401399                languageToScripts.putAll(StandardCodes.fixLanguageTag(languageSubtag), item.getScripts()); 
    402400            } 
     
    600598 
    601599            double countryPopulation1 = parseDecimal(row.get(COUNTRY_POPULATION)); 
    602             double countryGdp1 = parseDecimal(row.get(COUNTRY_GDP)); 
    603600            double countryLiteracy1 = parsePercent(row.get(COUNTRY_LITERACY), countryPopulation1); 
    604601 
     
    14711468        } 
    14721469        // walk through the locales, getting the ones we care about. 
    1473         Map<String, Double> scriptLocaleToLanguageLiteratePopulation = new TreeMap(); 
     1470        Map<String, Double> scriptLocaleToLanguageLiteratePopulation = new TreeMap<String, Double>(); 
    14741471 
    14751472        for (String locale : new TreeSet<String>(needsADoin)) { 
     
    15121509 
    15131510        // walk through the data 
    1514         Set<String> skippingSingletons = new TreeSet(); 
    1515  
    1516         Set<String> missingData = new TreeSet(); 
     1511        Set<String> skippingSingletons = new TreeSet<String>(); 
     1512 
     1513        Set<String> missingData = new TreeSet<String>(); 
    15171514        for (Set<String> siblingSet : siblingSets) { 
    15181515            if (SHOW_OLD_DEFAULT_CONTENTS) System.out.println("** From siblings: " + siblingSet); 
     
    17571754    } 
    17581755 
    1759     static Relation<String, BasicLanguageData> language2BasicLanguageData = new Relation(new TreeMap(), TreeSet.class); 
     1756    static Relation<String, BasicLanguageData> language2BasicLanguageData = Relation.of(new TreeMap<String, Set<BasicLanguageData>>(), TreeSet.class); 
    17601757 
    17611758    static Map<String, Relation<BasicLanguageData.Type, String>> language_status_scripts; 
     
    19011898 
    19021899        // check that every living language in the row data has a script 
    1903         Set<String> livingLanguagesWithTerritories = new TreeSet(); 
     1900        Set<String> livingLanguagesWithTerritories = new TreeSet<String>(); 
    19041901        for (RowData rowData : sortedInput) { 
    19051902            String language = rowData.languageCode; 
     
    19551952        Relation<BasicLanguageData.Type, String> status_scripts = language_status_scripts.get(language); 
    19561953        if (status_scripts == null) 
    1957             language_status_scripts.put(language, status_scripts = new Relation(new TreeMap(), TreeSet.class)); 
     1954            language_status_scripts.put(language, status_scripts = Relation.of(new TreeMap<BasicLanguageData.Type, Set<String>>(), TreeSet.class)); 
    19581955        status_scripts.put(type, script); 
    19591956    } 
     
    21152112        Set<String> suppressEmptyScripts, BasicLanguageData.Type type) { 
    21162113        Set<String> scriptsWithSameTerritories = new TreeSet<String>(); 
    2117         Set<String> lastTerritories = Collections.EMPTY_SET; 
     2114        Set<String> lastTerritories = Collections.emptySet(); 
    21182115        for (String script : primaryCombos.keySet()) { 
    21192116            Set<String> territories = primaryCombos.getAll(script); 
  • trunk/tools/java/org/unicode/cldr/tool/CountItems.java

    r9480 r9561  
    147147        UnicodeSet unassigned = new UnicodeSet("[:unassigned:]"); 
    148148        UnicodeSet punassigned = new UnicodeSet(patterns).retainAll(unassigned); 
    149         UnicodeMap blocks = ICUPropertyFactory.make().getProperty("block") 
     149        UnicodeMap<String> blocks = ICUPropertyFactory.make().getProperty("block") 
    150150            .getUnicodeMap(); 
    151151        blocks.setMissing("<Reserved-Block>"); 
     
    161161        // return a.toString() + " " + b.toString(); 
    162162        // }}); 
    163         for (UnicodeMapIterator it = new UnicodeMapIterator(blocks); it 
     163        for (UnicodeMapIterator<String> it = new UnicodeMapIterator<String>(blocks); it 
    164164            .nextRange();) { 
    165165            UnicodeSet range = new UnicodeSet(it.codepoint, it.codepointEnd); 
     
    175175            System.out.println(prefix + "\t" + range + "\t" + it.value); 
    176176            if (show) { 
    177                 System.out.println(new UnicodeMap().putAll(unassigned, "<reserved>") 
     177                System.out.println(new UnicodeMap<String>().putAll(unassigned, "<reserved>") 
    178178                    .putAll(punassigned, "<reserved-for-syntax>").setMissing( 
    179179                        "<assigned>").putAll(range.complement(), null)); 
     
    203203                Collator col = Collator.getInstance(new ULocale(locale)); 
    204204                Collator spaceCol = Collator.getInstance(new ULocale(locale)); 
    205                 spaceCol.setStrength(col.PRIMARY); 
     205                spaceCol.setStrength(Collator.PRIMARY); 
    206206                out.println(locale + ":\t\u200E" + v + '\u200E'); 
    207207                // String fixedFull = CollectionUtilities.prettyPrint(exemplars, col, false); 
     
    412412 
    413413    private static Map<String, String> getCountryToContinent(SupplementalDataInfo supplementalDataInfo, CLDRFile english) { 
    414         Relation<String, String> countryToContinent = new Relation(new TreeMap(), TreeSet.class); 
     414        Relation<String, String> countryToContinent = Relation.of(new TreeMap<String, Set<String>>(), TreeSet.class); 
    415415        Set<String> continents = new HashSet<String>(Arrays.asList("002", "019", "142", "150", "009")); 
    416416        // note: we don't need more than 3 levels 
     
    859859        StringBuffer result = new StringBuffer(); 
    860860        boolean first = true; 
    861         for (Iterator it = aliases.iterator(); it.hasNext();) { 
     861        for (Iterator<Object> it = aliases.iterator(); it.hasNext();) { 
    862862            Object item = it.next(); 
    863863            if (first) 
  • trunk/tools/java/org/unicode/cldr/tool/DiffWithParent.java

    r9480 r9561  
    44import java.io.PrintWriter; 
    55import java.util.Iterator; 
    6 import java.util.Map; 
    76import java.util.Set; 
    87import java.util.TreeSet; 
     
    9594        Set<Pair<String,String>> s = new TreeSet<Pair<String,String>>(); 
    9695        for (int i = 0; i < fullParts.size(); ++i) { 
    97             Map<String, String> fullAttributes = fullParts.getAttributes(i); 
    98             Map<String, String> attributes = parts.getAttributes(i); 
    9996            for (String key : fullParts.getAttributeKeys(i)) { 
    10097                s.add(new Pair<String,String>(key, fullParts.getAttributeValue(i, key))); 
  • trunk/tools/java/org/unicode/cldr/tool/ExtractMessages.java

    r9480 r9561  
    335335 
    336336        // changes with each locale, must call reset 
    337         private Relation<String, String> id_to_value = new Relation(new TreeMap<String, String>(), TreeSet.class); 
     337        private Relation<String, String> id_to_value = Relation.of(new TreeMap<String, Set<String>>(), TreeSet.class); 
    338338        private Map<String, String> id_to_cldrValue = new TreeMap<String, String>(); 
    339339        private CasingAction forceCasing = CasingAction.NONE; 
  • trunk/tools/java/org/unicode/cldr/tool/FallbackIteratorDataGenerator.java

    r7898 r9561  
    1313    static TestInfo testInfo = TestInfo.getInstance(); 
    1414 
    15     @SuppressWarnings("unchecked") 
    1615    public static void main(String[] args) { 
    1716        final StandardCodes sc = testInfo.getStandardCodes(); 
  • trunk/tools/java/org/unicode/cldr/tool/GenerateAttributeList.java

    r9520 r9561  
    150150        try { 
    151151            XMLReader xmlReader = CLDRFile.createXMLReader(true); 
    152             MyDeclHandler me = new MyDeclHandler(); 
    153152            xmlReader.setContentHandler(new MyContentHandler()); 
    154153            InputSource is = new InputSource(fis); 
Note: See TracChangeset for help on using the changeset viewer.