diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/SupplementalDataInfo.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/SupplementalDataInfo.java index 882a3b74db0..be41ef23436 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/SupplementalDataInfo.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/SupplementalDataInfo.java @@ -59,7 +59,6 @@ import java.util.Map.Entry; import java.util.Objects; import java.util.Set; -import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; @@ -837,7 +836,7 @@ public static String formatDate(Date date) { } } - public static class CoverageLevelInfo implements Comparable { + public static class CoverageLevelInfo { public final String match; public final Level value; public final Pattern inLanguage; @@ -870,15 +869,6 @@ private Set toSet(String source) { return Collections.unmodifiableSet(result); } - @Override - public int compareTo(CoverageLevelInfo o) { - if (value == o.value) { - return match.compareTo(o.match); - } else { - return value.compareTo(o.value); - } - } - public static void fixEU(Collection targets, SupplementalDataInfo info) { Set euCountries = info.getContained("EU"); for (CoverageLevelInfo item : targets) { @@ -1313,7 +1303,7 @@ private void makeStuffSafe() { bcp47KeyToAliasToSubtype = CldrUtility.protectCollection(bcp47KeyToAliasToSubtype); CoverageLevelInfo.fixEU(coverageLevels, this); - coverageLevels = Collections.unmodifiableSortedSet(coverageLevels); + coverageLevels = CldrUtility.protectCollection(coverageLevels); measurementData = CldrUtility.protectCollection(measurementData); @@ -2486,7 +2476,7 @@ public int parseIntegerOrNull(String attributeValue) { private Map likelySubtags = new TreeMap<>(); private Map likelyOrigins = new TreeMap<>(); // make public temporarily until we resolve. - private SortedSet coverageLevels = new TreeSet<>(); + private Set coverageLevels = new LinkedHashSet<>(); private Map> parentLocales = new HashMap<>(); { // Prefill, since we know we will need these @@ -2776,7 +2766,7 @@ public NumberingSystemType getNumberingSystemType(String numberingSystem) { return numberingSystems.get(numberingSystem).type; } - public SortedSet getCoverageLevelInfo() { + public Set getCoverageLevelInfo() { return coverageLevels; } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java index 250ec4df791..8ecd3b1ec84 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCLDRFile.java @@ -225,6 +225,9 @@ public void testExtraPaths() { final CLDRFile cldrFile = fullCldrFactory.make(locale, true); Set sorted2 = new TreeSet<>(cldrFile.getExtraPaths()); for (String path : sorted2) { + if (path.contains("speed-beaufort")) { + continue; // special case + } if (path.contains("/gender") || path.contains("@gender") || path.contains("@case")) { diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java index 28395b35a9f..c30648df5bb 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestCoverage.java @@ -156,4 +156,28 @@ public void showDiff(String title, Set all, Set coreCovera errln("\t" + title + ": " + diff); } } + + public void testBeaufort() { + // locale, path, expected coverage + String[][] tests = { + { + "am", + "//ldml/units/unitLength[@type=\"long\"]/unit[@type=\"speed-beaufort\"]/displayName", + "comprehensive" + }, + { + "de", + "//ldml/units/unitLength[@type=\"long\"]/unit[@type=\"speed-beaufort\"]/displayName", + "modern" + }, + }; + for (String[] test : tests) { + String locale = test[0]; + String path = test[1]; + Level expected = Level.fromString(test[2]); + CoverageLevel2 coverageLevel = CoverageLevel2.getInstance(sdi, locale); + Level actual = coverageLevel.getLevel(path); + assertEquals(String.format("locale:%s, path:%s", locale, path), expected, actual); + } + } }