/**
* 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
};
/**
} 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;
}
}
// 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);
}
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!");
// 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) {
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);
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
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