From 11a0f792f7b0419c77e82d2358596e54509b35c5 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Thu, 7 Jun 2012 21:00:41 +0000 Subject: [PATCH] ICU-9369 rename ListFormat to ListFormatter, and make other agreed changes X-SVN-Rev: 31921 --- .../src/com/ibm/icu/util/ListFormatData.java | 84 ------------------- .../{ListFormat.java => ListFormatter.java} | 48 +++++------ .../com/ibm/icu/util/ListFormatterData.java | 84 +++++++++++++++++++ ...FormatTest.java => ListFormatterTest.java} | 20 ++--- .../com/ibm/icu/dev/test/util/TestAll.java | 2 +- 5 files changed, 117 insertions(+), 121 deletions(-) delete mode 100644 icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatData.java rename icu4j/main/classes/core/src/com/ibm/icu/util/{ListFormat.java => ListFormatter.java} (78%) create mode 100644 icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatterData.java rename icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/{ListFormatTest.java => ListFormatterTest.java} (72%) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatData.java b/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatData.java deleted file mode 100644 index 0ad766ef9d9..00000000000 --- a/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatData.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - ******************************************************************************* - * Copyright (C) 2012-2012, Google, International Business Machines Corporation and * - * others. All Rights Reserved. * - ******************************************************************************* - */ -package com.ibm.icu.util; - -class ListFormatData { - static void load() { - ListFormat.add("af", "{0} en {1}", "{0}, {1}", "{0}, {1}", "{0} en {1}"); - ListFormat.add("am", "{0} እና {1}", "{0}, {1}", "{0}, {1}", "{0}, እና {1}"); - ListFormat.add("ar", "{0} و {1}", "{0}، {1}", "{0}، {1}", "{0}، و {1}"); - ListFormat.add("bg", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); - ListFormat.add("bn", "{0} এবং {1}", "{0}, {1}", "{0}, {1}", "{0}, এবং {1}"); - ListFormat.add("bs", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); - ListFormat.add("ca", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); - ListFormat.add("cs", "{0} a {1}", "{0}, {1}", "{0}, {1}", "{0} a {1}"); - ListFormat.add("da", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); - ListFormat.add("de", "{0} und {1}", "{0}, {1}", "{0}, {1}", "{0} und {1}"); - ListFormat.add("ee", "{0} kple {1}", "{0}, {1}", "{0}, {1}", "{0}, kple {1}"); - ListFormat.add("el", "{0} και {1}", "{0}, {1}", "{0}, {1}", "{0} και {1}"); - ListFormat.add("en", "{0} and {1}", "{0}, {1}", "{0}, {1}", "{0}, and {1}"); - ListFormat.add("es", "{0} y {1}", "{0}, {1}", "{0}, {1}", "{0} y {1}"); - ListFormat.add("et", "{0} ja {1}", "{0}, {1}", "{0}, {1}", "{0} ja {1}"); - ListFormat.add("eu", "{0} eta {1}", "{0}, {1}", "{0}, {1}", "{0} eta {1}"); - ListFormat.add("fa", "{0} و {1}", "{0}،‏ {1}", "{0}،‏ {1}", "{0}، و {1}"); - ListFormat.add("fi", "{0} ja {1}", "{0}, {1}", "{0}, {1}", "{0} ja {1}"); - ListFormat.add("fil", "{0} at {1}", "{0}, {1}", "{0}, {1}", "{0} at {1}"); - ListFormat.add("fo", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); - ListFormat.add("fr", "{0} et {1}", "{0}, {1}", "{0}, {1}", "{0} et {1}"); - ListFormat.add("fur", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0} e {1}"); - ListFormat.add("gd", "{0} agus {1}", "{0}, {1}", "{0}, {1}", "{0}, agus {1}"); - ListFormat.add("gl", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0} e {1}"); - ListFormat.add("gsw", "{0} und {1}", "{0}, {1}", "{0}, {1}", "{0} und {1}"); - ListFormat.add("gu", "{0} અને {1}", "{0}, {1}", "{0}, {1}", "{0} અને {1}"); - ListFormat.add("he", "{0} ו-{1}", "{0}, {1}", "{0}, {1}", "{0} ו-{1}"); - ListFormat.add("hi", "{0} और {1}", "{0}, {1}", "{0}, {1}", "{0}, और {1}"); - ListFormat.add("hr", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); - ListFormat.add("hu", "{0} és {1}", "{0}, {1}", "{0}, {1}", "{0} és {1}"); - ListFormat.add("id", "{0} dan {1}", "{0}, {1}", "{0}, {1}", "{0}, dan {1}"); - ListFormat.add("is", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); - ListFormat.add("it", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0}, e {1}"); - ListFormat.add("ja", "{0}、{1}", "{0}、{1}", "{0}、{1}", "{0}、{1}"); - ListFormat.add("ka", "{0} და {1}", "{0}, {1}", "{0}, {1}", "{0} და {1}"); - ListFormat.add("kea", "{0} y {1}", "{0}, {1}", "{0}, {1}", "{0} y {1}"); - ListFormat.add("kl", "{0} aamma {1}", "{0} aamma {1}", "{0}, {1}", "{0}, {1}"); - ListFormat.add("kn", "{0} ಮತ್ತು {1}", "{0}, {1}", "{0}, {1}", "{0}, ಮತ್ತು {1}"); - ListFormat.add("ko", "{0} 및 {1}", "{0}, {1}", "{0}, {1}", "{0} 및 {1}"); - ListFormat.add("ksh", "{0} un {1}", "{0}, {1}", "{0}, {1}", "{0} un {1}"); - ListFormat.add("lt", "{0} ir {1}", "{0}, {1}", "{0}, {1}", "{0} ir {1}"); - ListFormat.add("lv", "{0} un {1}", "{0}, {1}", "{0}, {1}", "{0} un {1}"); - ListFormat.add("ml", "{0} കൂടാതെ {1}", "{0}, {1}", "{0}, {1}", "{0}, {1} എന്നിവ"); - ListFormat.add("mr", "{0} आणि {1}", "{0}, {1}", "{0}, {1}", "{0} आणि {1}"); - ListFormat.add("ms", "{0} dan {1}", "{0}, {1}", "{0}, {1}", "{0}, dan {1}"); - ListFormat.add("nb", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); - ListFormat.add("nl", "{0} en {1}", "{0}, {1}", "{0}, {1}", "{0} en {1}"); - ListFormat.add("nn", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); - ListFormat.add("pl", "{0} i {1}", "{0}; {1}", "{0}; {1}", "{0} i {1}"); - ListFormat.add("pt", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0} e {1}"); - ListFormat.add("ro", "{0} şi {1}", "{0}, {1}", "{0}, {1}", "{0} şi {1}"); - ListFormat.add("", "{0}, {1}", "{0}, {1}", "{0}, {1}", "{0}, {1}"); // root - ListFormat.add("ru", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); - ListFormat.add("se", "{0} ja {1}", "{0}, {1}", "{0}, {1}", "{0} ja {1}"); - ListFormat.add("sk", "{0} a {1}", "{0}, {1}", "{0}, {1}", "{0} a {1}"); - ListFormat.add("sl", "{0} in {1}", "{0}, {1}", "{0}, {1}", "{0} in {1}"); - ListFormat.add("sr", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); - ListFormat.add("sr_Cyrl", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); - ListFormat.add("sr_Latn", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); - ListFormat.add("sv", "{0} och {1}", "{0}, {1}", "{0}, {1}", "{0} och {1}"); - ListFormat.add("sw", "{0} na {1}", "{0}, {1}", "{0}, {1}", "{0}, na {1}"); - ListFormat.add("ta", "{0} மற்றும் {1}", "{0}, {1}", "{0}, {1}", "{0} மற்றும் {1}"); - ListFormat.add("te", "{0} మరియు {1}", "{0}, {1}", "{0}, {1}", "{0} మరియు {1}"); - ListFormat.add("th", "{0}และ{1}", "{0} {1}", "{0} {1}", "{0} และ{1}"); - ListFormat.add("tr", "{0} ve {1}", "{0}, {1}", "{0}, {1}", "{0} ve {1}"); - ListFormat.add("uk", "{0} та {1}", "{0}, {1}", "{0}, {1}", "{0} та {1}"); - ListFormat.add("ur", "{0} اور {1}", "{0}، {1}", "{0}، {1}", "{0}، اور {1}"); - ListFormat.add("vi", "{0} và {1}", "{0}, {1}", "{0}, {1}", "{0} và {1}"); - ListFormat.add("wae", "{0} und {1}", "{0}, {1}", "{0}, {1}", "{0} und {1}"); - ListFormat.add("zh", "{0}和{1}", "{0}、{1}", "{0}、{1}", "{0}和{1}"); - ListFormat.add("zh", "{0}和{1}", "{0}、{1}", "{0}、{1}", "{0}和{1}"); - ListFormat.add("zu", "I-{0} ne-{1}", "{0}, {1}", "{0}, {1}", "{0}, no-{1}"); - } -} diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatter.java similarity index 78% rename from icu4j/main/classes/core/src/com/ibm/icu/util/ListFormat.java rename to icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatter.java index f65dfe501d7..9f822ca9883 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatter.java @@ -1,7 +1,7 @@ /* ******************************************************************************* * Copyright (C) 2012-2012, Google, International Business Machines Corporation and - * others. All Rights Reserved. * + * others. All Rights Reserved. ******************************************************************************* */ package com.ibm.icu.util; @@ -13,24 +13,23 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; -import com.ibm.icu.text.Transform; - /** * Immutable class for formatting a list, using data from CLDR (or supplied * separately). The class is not subclassable. * * @author markdavis - * @internal + * @draft ICU 50 + * @provisional This API might change or be removed in a future release. */ -final public class ListFormat implements Transform, String> { +final public class ListFormatter { private final String two; private final String start; private final String middle; private final String end; /** - * Create a ListFormatter from component strings, with definitions as in - * LDML. + * Internal: Create a ListFormatter from component strings, + * with definitions as in LDML. * * @param two * string for two items, containing {0} for the first, and {1} @@ -46,7 +45,7 @@ final public class ListFormat implements Transform, String> { * first part of the list, and {1} for the last item. * @internal */ - public ListFormat(String two, String start, String middle, String end) { + public ListFormatter(String two, String start, String middle, String end) { this.two = two; this.start = start; this.middle = middle; @@ -59,13 +58,14 @@ final public class ListFormat implements Transform, String> { * @param locale * the locale in question. * @return ListFormatter - * @internal + * @draft ICU 50 + * @provisional This API might change or be removed in a future release. */ - public static ListFormat getInstance(ULocale locale) { + public static ListFormatter getInstance(ULocale locale) { // These can be cached, since they are read-only // poor-man's locale lookup, for hardcoded data while (true) { - ListFormat data = localeToData.get(locale); + ListFormatter data = localeToData.get(locale); if (data != null) { return data; } @@ -81,9 +81,10 @@ final public class ListFormat implements Transform, String> { * @param locale * the locale in question. * @return ListFormatter - * @internal + * @draft ICU 50 + * @provisional This API might change or be removed in a future release. */ - public static ListFormat getInstance(Locale locale) { + public static ListFormatter getInstance(Locale locale) { return getInstance(ULocale.forLocale(locale)); } @@ -93,19 +94,21 @@ final public class ListFormat implements Transform, String> { * @param items * items to format. The toString() method is called on each. * @return items formatted into a string - * @internal + * @draft ICU 50 + * @provisional This API might change or be removed in a future release. */ public String format(Object... items) { return format(Arrays.asList(items)); } /** - * Format a collation of objects. The toString() method is called on each. + * Format a collection of objects. The toString() method is called on each. * * @param items * items to format. The toString() method is called on each. * @return items formatted into a string - * @internal + * @draft ICU 50 + * @provisional This API might change or be removed in a future release. */ public String format(Collection items) { // TODO optimize this for the common case that the patterns are all of the @@ -140,23 +143,16 @@ final public class ListFormat implements Transform, String> { : pattern.substring(0, i1) + a + pattern.substring(i1+3, i0) + b + pattern.substring(i0+3); } - /** - * @internal - */ - public String transform(Collection source) { - return format(source); - } - /** JUST FOR DEVELOPMENT */ // For use with the hard-coded data // TODO Replace by use of RB // Verify in building that all of the patterns contain {0}, {1}. - static Map localeToData = new HashMap(); + static Map localeToData = new HashMap(); static void add(String locale, String...data) { - localeToData.put(new ULocale(locale), new ListFormat(data[0], data[1], data[2], data[3])); + localeToData.put(new ULocale(locale), new ListFormatter(data[0], data[1], data[2], data[3])); } static { - ListFormatData.load(); + ListFormatterData.load(); } } diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatterData.java b/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatterData.java new file mode 100644 index 00000000000..77caa9e2e53 --- /dev/null +++ b/icu4j/main/classes/core/src/com/ibm/icu/util/ListFormatterData.java @@ -0,0 +1,84 @@ +/* + ******************************************************************************* + * Copyright (C) 2012-2012, Google, International Business Machines Corporation and + * others. All Rights Reserved. + ******************************************************************************* + */ +package com.ibm.icu.util; + +class ListFormatterData { + static void load() { + ListFormatter.add("af", "{0} en {1}", "{0}, {1}", "{0}, {1}", "{0} en {1}"); + ListFormatter.add("am", "{0} እና {1}", "{0}, {1}", "{0}, {1}", "{0}, እና {1}"); + ListFormatter.add("ar", "{0} و {1}", "{0}، {1}", "{0}، {1}", "{0}، و {1}"); + ListFormatter.add("bg", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); + ListFormatter.add("bn", "{0} এবং {1}", "{0}, {1}", "{0}, {1}", "{0}, এবং {1}"); + ListFormatter.add("bs", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); + ListFormatter.add("ca", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); + ListFormatter.add("cs", "{0} a {1}", "{0}, {1}", "{0}, {1}", "{0} a {1}"); + ListFormatter.add("da", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); + ListFormatter.add("de", "{0} und {1}", "{0}, {1}", "{0}, {1}", "{0} und {1}"); + ListFormatter.add("ee", "{0} kple {1}", "{0}, {1}", "{0}, {1}", "{0}, kple {1}"); + ListFormatter.add("el", "{0} και {1}", "{0}, {1}", "{0}, {1}", "{0} και {1}"); + ListFormatter.add("en", "{0} and {1}", "{0}, {1}", "{0}, {1}", "{0}, and {1}"); + ListFormatter.add("es", "{0} y {1}", "{0}, {1}", "{0}, {1}", "{0} y {1}"); + ListFormatter.add("et", "{0} ja {1}", "{0}, {1}", "{0}, {1}", "{0} ja {1}"); + ListFormatter.add("eu", "{0} eta {1}", "{0}, {1}", "{0}, {1}", "{0} eta {1}"); + ListFormatter.add("fa", "{0} و {1}", "{0}،‏ {1}", "{0}،‏ {1}", "{0}، و {1}"); + ListFormatter.add("fi", "{0} ja {1}", "{0}, {1}", "{0}, {1}", "{0} ja {1}"); + ListFormatter.add("fil", "{0} at {1}", "{0}, {1}", "{0}, {1}", "{0} at {1}"); + ListFormatter.add("fo", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); + ListFormatter.add("fr", "{0} et {1}", "{0}, {1}", "{0}, {1}", "{0} et {1}"); + ListFormatter.add("fur", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0} e {1}"); + ListFormatter.add("gd", "{0} agus {1}", "{0}, {1}", "{0}, {1}", "{0}, agus {1}"); + ListFormatter.add("gl", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0} e {1}"); + ListFormatter.add("gsw", "{0} und {1}", "{0}, {1}", "{0}, {1}", "{0} und {1}"); + ListFormatter.add("gu", "{0} અને {1}", "{0}, {1}", "{0}, {1}", "{0} અને {1}"); + ListFormatter.add("he", "{0} ו-{1}", "{0}, {1}", "{0}, {1}", "{0} ו-{1}"); + ListFormatter.add("hi", "{0} और {1}", "{0}, {1}", "{0}, {1}", "{0}, और {1}"); + ListFormatter.add("hr", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); + ListFormatter.add("hu", "{0} és {1}", "{0}, {1}", "{0}, {1}", "{0} és {1}"); + ListFormatter.add("id", "{0} dan {1}", "{0}, {1}", "{0}, {1}", "{0}, dan {1}"); + ListFormatter.add("is", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); + ListFormatter.add("it", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0}, e {1}"); + ListFormatter.add("ja", "{0}、{1}", "{0}、{1}", "{0}、{1}", "{0}、{1}"); + ListFormatter.add("ka", "{0} და {1}", "{0}, {1}", "{0}, {1}", "{0} და {1}"); + ListFormatter.add("kea", "{0} y {1}", "{0}, {1}", "{0}, {1}", "{0} y {1}"); + ListFormatter.add("kl", "{0} aamma {1}", "{0} aamma {1}", "{0}, {1}", "{0}, {1}"); + ListFormatter.add("kn", "{0} ಮತ್ತು {1}", "{0}, {1}", "{0}, {1}", "{0}, ಮತ್ತು {1}"); + ListFormatter.add("ko", "{0} 및 {1}", "{0}, {1}", "{0}, {1}", "{0} 및 {1}"); + ListFormatter.add("ksh", "{0} un {1}", "{0}, {1}", "{0}, {1}", "{0} un {1}"); + ListFormatter.add("lt", "{0} ir {1}", "{0}, {1}", "{0}, {1}", "{0} ir {1}"); + ListFormatter.add("lv", "{0} un {1}", "{0}, {1}", "{0}, {1}", "{0} un {1}"); + ListFormatter.add("ml", "{0} കൂടാതെ {1}", "{0}, {1}", "{0}, {1}", "{0}, {1} എന്നിവ"); + ListFormatter.add("mr", "{0} आणि {1}", "{0}, {1}", "{0}, {1}", "{0} आणि {1}"); + ListFormatter.add("ms", "{0} dan {1}", "{0}, {1}", "{0}, {1}", "{0}, dan {1}"); + ListFormatter.add("nb", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); + ListFormatter.add("nl", "{0} en {1}", "{0}, {1}", "{0}, {1}", "{0} en {1}"); + ListFormatter.add("nn", "{0} og {1}", "{0}, {1}", "{0}, {1}", "{0} og {1}"); + ListFormatter.add("pl", "{0} i {1}", "{0}; {1}", "{0}; {1}", "{0} i {1}"); + ListFormatter.add("pt", "{0} e {1}", "{0}, {1}", "{0}, {1}", "{0} e {1}"); + ListFormatter.add("ro", "{0} şi {1}", "{0}, {1}", "{0}, {1}", "{0} şi {1}"); + ListFormatter.add("", "{0}, {1}", "{0}, {1}", "{0}, {1}", "{0}, {1}"); // root + ListFormatter.add("ru", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); + ListFormatter.add("se", "{0} ja {1}", "{0}, {1}", "{0}, {1}", "{0} ja {1}"); + ListFormatter.add("sk", "{0} a {1}", "{0}, {1}", "{0}, {1}", "{0} a {1}"); + ListFormatter.add("sl", "{0} in {1}", "{0}, {1}", "{0}, {1}", "{0} in {1}"); + ListFormatter.add("sr", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); + ListFormatter.add("sr_Cyrl", "{0} и {1}", "{0}, {1}", "{0}, {1}", "{0} и {1}"); + ListFormatter.add("sr_Latn", "{0} i {1}", "{0}, {1}", "{0}, {1}", "{0} i {1}"); + ListFormatter.add("sv", "{0} och {1}", "{0}, {1}", "{0}, {1}", "{0} och {1}"); + ListFormatter.add("sw", "{0} na {1}", "{0}, {1}", "{0}, {1}", "{0}, na {1}"); + ListFormatter.add("ta", "{0} மற்றும் {1}", "{0}, {1}", "{0}, {1}", "{0} மற்றும் {1}"); + ListFormatter.add("te", "{0} మరియు {1}", "{0}, {1}", "{0}, {1}", "{0} మరియు {1}"); + ListFormatter.add("th", "{0}และ{1}", "{0} {1}", "{0} {1}", "{0} และ{1}"); + ListFormatter.add("tr", "{0} ve {1}", "{0}, {1}", "{0}, {1}", "{0} ve {1}"); + ListFormatter.add("uk", "{0} та {1}", "{0}, {1}", "{0}, {1}", "{0} та {1}"); + ListFormatter.add("ur", "{0} اور {1}", "{0}، {1}", "{0}، {1}", "{0}، اور {1}"); + ListFormatter.add("vi", "{0} và {1}", "{0}, {1}", "{0}, {1}", "{0} và {1}"); + ListFormatter.add("wae", "{0} und {1}", "{0}, {1}", "{0}, {1}", "{0} und {1}"); + ListFormatter.add("zh", "{0}和{1}", "{0}、{1}", "{0}、{1}", "{0}和{1}"); + ListFormatter.add("zh", "{0}和{1}", "{0}、{1}", "{0}、{1}", "{0}和{1}"); + ListFormatter.add("zu", "I-{0} ne-{1}", "{0}, {1}", "{0}, {1}", "{0}, no-{1}"); + } +} diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ListFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ListFormatterTest.java similarity index 72% rename from icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ListFormatTest.java rename to icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ListFormatterTest.java index f1d9c103eef..16b4a42ace2 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ListFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ListFormatterTest.java @@ -7,12 +7,12 @@ package com.ibm.icu.dev.test.util; import com.ibm.icu.dev.test.TestFmwk; -import com.ibm.icu.util.ListFormat; +import com.ibm.icu.util.ListFormatter; import com.ibm.icu.util.ULocale; -public class ListFormatTest extends TestFmwk { +public class ListFormatterTest extends TestFmwk { public static void main(String[] args) { - new ListFormatTest().run(args); + new ListFormatterTest().run(args); } String[] HardcodedTestData = { @@ -25,7 +25,7 @@ public class ListFormatTest extends TestFmwk { }; public void TestBasic() { - ListFormat formatter = new ListFormat("{0} and {1}", "{0}; {1}", "{0}, {1}", "{0}, and {1}"); + ListFormatter formatter = new ListFormatter("{0} and {1}", "{0}; {1}", "{0}, {1}", "{0}, and {1}"); checkData(formatter, HardcodedTestData); } @@ -39,8 +39,8 @@ public class ListFormatTest extends TestFmwk { }; public void TestEnglish() { - checkData(ListFormat.getInstance(ULocale.ENGLISH), EnglishTestData); - checkData(ListFormat.getInstance(ULocale.US), EnglishTestData); + checkData(ListFormatter.getInstance(ULocale.ENGLISH), EnglishTestData); + checkData(ListFormatter.getInstance(ULocale.US), EnglishTestData); } String[] JapaneseTestData = { @@ -53,7 +53,7 @@ public class ListFormatTest extends TestFmwk { }; public void TestJapanese() { - checkData(ListFormat.getInstance(ULocale.JAPANESE), JapaneseTestData); + checkData(ListFormatter.getInstance(ULocale.JAPANESE), JapaneseTestData); } String[] RootTestData = { @@ -66,12 +66,12 @@ public class ListFormatTest extends TestFmwk { }; public void TestSpecial() { - checkData(ListFormat.getInstance(ULocale.ROOT), RootTestData); - checkData(ListFormat.getInstance(new ULocale("xxx")), RootTestData); + checkData(ListFormatter.getInstance(ULocale.ROOT), RootTestData); + checkData(ListFormatter.getInstance(new ULocale("xxx")), RootTestData); } - public void checkData(ListFormat listFormat, String[] strings) { + public void checkData(ListFormatter listFormat, String[] strings) { assertEquals("0", strings[0], listFormat.format()); assertEquals("1", strings[1], listFormat.format("A")); assertEquals("2", strings[2], listFormat.format("A", "B")); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/TestAll.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/TestAll.java index a222144a787..b3d20f801ba 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/TestAll.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/TestAll.java @@ -31,7 +31,7 @@ public class TestAll extends TestGroup { "Trie2Test", "LocaleDataTest", "GenderInfoTest", - "ListFormatTest", + "ListFormatterTest", "ULocaleTest", "LocaleAliasTest", "DebugUtilitiesTest", -- 2.50.1