diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java index 0a5aa5e657a..68a9a790fe4 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/PathHeader.java @@ -18,7 +18,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; -import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.Map; @@ -241,10 +240,10 @@ public enum PageId { Weather(SectionId.Units), Digital(SectionId.Units), Coordinates(SectionId.Units), - OtherUnits(SectionId.Units, "Other Units"), - OtherUnitsPer(SectionId.Units, "Other Units Per"), + OtherUnitsMetric(SectionId.Units, "Other Unitsj Metric"), + OtherUnitsMetricPer(SectionId.Units, "Other Units Metric Per"), OtherUnitsUS(SectionId.Units, "Other Units US"), - OtherUnitsMisc(SectionId.Units, "Other Units Misc"), + OtherUnits(SectionId.Units, "Other Units"), CompoundUnits(SectionId.Units, "Compound Units"), Displaying_Lists(SectionId.Misc, "Displaying Lists"), @@ -864,28 +863,7 @@ public static Relation getSectionIdsToPageIds() { return SectionIdToPageIds; } - /** - * Return the names for Sections and Pages that are defined, for display in menus. Both are - * ordered. - * - * @deprecated Use getSectionIdsToPageIds - */ - @Deprecated - public static LinkedHashMap> getSectionsToPages() { - LinkedHashMap> sectionsToPages = new LinkedHashMap<>(); - for (PageId pageId : PageId.values()) { - String sectionId2 = pageId.getSectionId().toString(); - Set pages = - sectionsToPages.computeIfAbsent(sectionId2, k -> new LinkedHashSet<>()); - pages.add(pageId.toString()); - } - return sectionsToPages; - } - - /** - * @deprecated, use the filterCldr with the section/page ids. - */ - public Iterable filterCldr(String section, String page, CLDRFile file) { + public Iterable filterCldr(SectionId section, PageId page, CLDRFile file) { return new FilteredIterable(section, page, file); } @@ -2286,11 +2264,13 @@ private static PageId getVolumePageId(String path) { private static PageId getOtherUnitsPageId(String path) { String shortUnitId = getShortUnitId(path); if (isSystemUnit(shortUnitId, METRIC_UNITS)) { - return shortUnitId.contains("per") ? PageId.OtherUnitsPer : PageId.OtherUnits; + return shortUnitId.contains("per") + ? PageId.OtherUnitsMetricPer + : PageId.OtherUnitsMetric; } else { return isSystemUnit(shortUnitId, US_UNITS) ? PageId.OtherUnitsUS - : PageId.OtherUnitsMisc; + : PageId.OtherUnits; } } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java index b1d627e9084..f2167c022da 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java @@ -1090,12 +1090,11 @@ public void TestZ() { for (String item : threeLevel) { logln(item); } - LinkedHashMap> sectionsToPages = - org.unicode.cldr.util.PathHeader.Factory.getSectionsToPages(); - logln("\nMenus:\t" + sectionsToPages.size()); - for (Entry> item : sectionsToPages.entrySet()) { - final String section = item.getKey(); - for (String page : item.getValue()) { + Relation s2p = PathHeader.Factory.getSectionIdsToPageIds(); + logln("\nMenus:\t" + s2p.size()); + for (Entry> sectionAndPages : s2p.keyValuesSet()) { + final SectionId section = sectionAndPages.getKey(); + for (PageId page : sectionAndPages.getValue()) { logln("\t" + section + "\t" + page); int count = 0; for (String path : pathHeaderFactory.filterCldr(section, page, english)) {