From: Markus Scherer Date: Thu, 2 Feb 2017 19:38:50 +0000 (+0000) Subject: ICU-12410 switch CaseMap from ULocale to Locale (only) X-Git-Tag: release-59-rc~145^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f735836e1e73c0c5b0616a0db281f429b0790cd5;p=icu ICU-12410 switch CaseMap from ULocale to Locale (only) X-SVN-Rev: 39634 --- diff --git a/icu4j/main/classes/core/src/com/ibm/icu/lang/UCharacter.java b/icu4j/main/classes/core/src/com/ibm/icu/lang/UCharacter.java index c2385f84ff8..0029df2c080 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/lang/UCharacter.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/lang/UCharacter.java @@ -4949,18 +4949,6 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection */ public static String toLowerCase(Locale locale, String str) { - return toLowerCase(ULocale.forLocale(locale), str); - } - - /** - * Returns the lowercase version of the argument string. - * Casing is dependent on the argument locale and context-sensitive - * @param locale which string is to be converted in - * @param str source string to be performed on - * @return lowercase version of the argument string - * @stable ICU 3.2 - */ - public static String toLowerCase(ULocale locale, String str) { // TODO: remove package path if (str.length() <= 100) { if (str.isEmpty()) { @@ -4979,6 +4967,18 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection } } + /** + * Returns the lowercase version of the argument string. + * Casing is dependent on the argument locale and context-sensitive + * @param locale which string is to be converted in + * @param str source string to be performed on + * @return lowercase version of the argument string + * @stable ICU 3.2 + */ + public static String toLowerCase(ULocale locale, String str) { + return toLowerCase(locale.toLocale(), str); + } + private static String applyEdits(String str, StringBuilder replacementChars, Edits edits) { if (!edits.hasChanges()) { return str; diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/CaseMap.java b/icu4j/main/classes/core/src/com/ibm/icu/text/CaseMap.java index 6eb64d62ff6..6d2c6dd2ca5 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/CaseMap.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/CaseMap.java @@ -2,12 +2,12 @@ // License & terms of use: http://www.unicode.org/copyright.html#License package com.ibm.icu.text; +import java.util.Locale; + import com.ibm.icu.impl.UCaseProps; import com.ibm.icu.lang.UCharacter; -import com.ibm.icu.util.ULocale; // TODO: issues/questions -// - add java.util.Locale overloads when signatures are settled // - optimizing strategies for unstyled text: stop after number of changes or length of replacement? /** @@ -39,14 +39,14 @@ public final class CaseMap { * This function calls edits.reset() first. edits can be null. * @return dest with the result string (or only changes) appended. * - * @see UCharacter#toLowerCase(ULocale, String) + * @see UCharacter#toLowerCase(Locale, String) * @draft ICU 59 * @provisional This API might change or be removed in a future release. */ public static A toLower( - ULocale locale, int options, CharSequence src, A dest, Edits edits) { + Locale locale, int options, CharSequence src, A dest, Edits edits) { if (locale == null) { - locale = ULocale.getDefault(); + locale = Locale.getDefault(); } int caseLocale = UCaseProps.getCaseLocale(locale); // TODO: remove package path @@ -67,12 +67,12 @@ public final class CaseMap { * This function calls edits.reset() first. edits can be null. * @return dest with the result string (or only changes) appended. * - * @see UCharacter#toUpperCase(ULocale, String) + * @see UCharacter#toUpperCase(Locale, String) * @draft ICU 59 * @provisional This API might change or be removed in a future release. */ public static A toUpper( - ULocale locale, int options, CharSequence src, A dest, Edits edits) { + Locale locale, int options, CharSequence src, A dest, Edits edits) { return null; } @@ -101,12 +101,12 @@ public final class CaseMap { * This function calls edits.reset() first. edits can be null. * @return dest with the result string (or only changes) appended. * - * @see UCharacter#toTitleCase(ULocale, String, BreakIterator, int) + * @see UCharacter#toTitleCase(Locale, String, BreakIterator, int) * @draft ICU 59 * @provisional This API might change or be removed in a future release. */ public static A toTitle( - ULocale locale, int options, BreakIterator iter, + Locale locale, int options, BreakIterator iter, CharSequence src, A dest, Edits edits) { return null; }