From: Scott Russell Date: Wed, 16 Sep 2015 02:36:11 +0000 (+0000) Subject: ICU-11572 API proposal updates for approved constants X-Git-Tag: milestone-59-0-1~862 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d671fbb0c49622781bfc8a26a113f00a7f5490ad;p=icu ICU-11572 API proposal updates for approved constants X-SVN-Rev: 37962 --- diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java index 88432bcc2d8..de45b85f903 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java @@ -491,16 +491,17 @@ public abstract class DateFormat extends UFormat { /** * indicates tolerance of pattern mismatch between input data and specified format pattern. * e.g. accepting "September" for a month pattern of MMM ("Sep") - * @draft ICU 53 + * @draft ICU 56 * @provisional This API might change or be removed in a future release. */ PARSE_MULTIPLE_PATTERNS_FOR_MATCH, /** * indicates tolerance of a partial literal match - * @draft ICU 53 + * e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy" + * @draft ICU 56 * @provisional This API might change or be removed in a future release. */ - PARSE_PARTIAL_MATCH + PARSE_PARTIAL_LITERAL_MATCH }; /** diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java index 459b11ee1c7..e42b59dd214 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java @@ -2572,7 +2572,7 @@ public class SimpleDateFormat extends DateFormat { } else if ((pch == ' ' || pch == '.') && getBooleanAttribute(DateFormat.BooleanAttribute.PARSE_ALLOW_WHITESPACE)) { ++idx; continue; - } else if (pos != originalPos && getBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH)) { + } else if (pos != originalPos && getBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH)) { ++idx; continue; } @@ -3341,7 +3341,7 @@ public class SimpleDateFormat extends DateFormat { } // If lenient, add also the alternate, if different from the locale. - if (getBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH) && + if (getBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH) && !formatData.getTimeSeparatorString().equals(DateFormatSymbols.ALTERNATE_TIME_SEPARATOR)) { data.add(DateFormatSymbols.ALTERNATE_TIME_SEPARATOR); } diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java index f11138837dd..4a4669cd5d1 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java @@ -1282,7 +1282,7 @@ public class DateFormatRegressionTest extends com.ibm.icu.dev.test.TestFmwk { String text = new String("--mon-02-march-2011"); SimpleDateFormat format = new SimpleDateFormat(pattern); - format.setBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH, false); + format.setBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH, false); try { format.parse(text); errln("parse partial match did NOT fail in strict mode!"); @@ -1290,7 +1290,7 @@ public class DateFormatRegressionTest extends com.ibm.icu.dev.test.TestFmwk { // expected } - format.setBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH, true); + format.setBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH, true); try { format.parse(text); } catch (ParseException pe) { diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java index 0a2c15341df..a5b39490be2 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java @@ -4581,7 +4581,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { SimpleDateFormat sdfmt = new SimpleDateFormat(item.pattern, item.locale); sdfmt.setBooleanAttribute(BooleanAttribute.PARSE_ALLOW_WHITESPACE, item.leniency) .setBooleanAttribute(BooleanAttribute.PARSE_ALLOW_NUMERIC, item.leniency) - .setBooleanAttribute(BooleanAttribute.PARSE_PARTIAL_MATCH, item.leniency); + .setBooleanAttribute(BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH, item.leniency); ParsePosition p = new ParsePosition(0); Date d = sdfmt.parse(item.parseString, p); @@ -4745,7 +4745,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { assertTrue("isCalendarLenient default", fmt.isCalendarLenient()); assertTrue("ALLOW_WHITESPACE default", fmt.getBooleanAttribute(BooleanAttribute.PARSE_ALLOW_WHITESPACE)); assertTrue("ALLOW_NUMERIC default", fmt.getBooleanAttribute(BooleanAttribute.PARSE_ALLOW_NUMERIC)); - assertTrue("PARTIAL_MATCH default", fmt.getBooleanAttribute(BooleanAttribute.PARSE_PARTIAL_MATCH)); + assertTrue("PARTIAL_MATCH default", fmt.getBooleanAttribute(BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH)); assertTrue("MULTIPLE_PATTERNS default", fmt.getBooleanAttribute(BooleanAttribute.PARSE_MULTIPLE_PATTERNS_FOR_MATCH)); // Set calendar to strict @@ -4764,7 +4764,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { assertFalse("ALLOW_WHITESPACE after setLenient(FALSE)", fmt.getBooleanAttribute(BooleanAttribute.PARSE_ALLOW_WHITESPACE)); assertFalse("ALLOW_NUMERIC after setLenient(FALSE)", fmt.getBooleanAttribute(BooleanAttribute.PARSE_ALLOW_NUMERIC)); // These two boolean attributes are NOT affected according to the API specification - assertTrue("PARTIAL_MATCH after setLenient(FALSE)", fmt.getBooleanAttribute(BooleanAttribute.PARSE_PARTIAL_MATCH)); + assertTrue("PARTIAL_MATCH after setLenient(FALSE)", fmt.getBooleanAttribute(BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH)); assertTrue("MULTIPLE_PATTERNS after setLenient(FALSE)", fmt.getBooleanAttribute(BooleanAttribute.PARSE_MULTIPLE_PATTERNS_FOR_MATCH)); // Allow white space leniency