mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-11572 API proposal updates for approved constants
X-SVN-Rev: 37962
This commit is contained in:
parent
c179cf974c
commit
d671fbb0c4
4 changed files with 11 additions and 10 deletions
|
@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue