Map<CapitalizationContextUsage,boolean[]> capitalization = null;
/**
- * Returns era strings. For example: "AD" and "BC".
+ * Returns abbreviated era strings. For example: "AD" and "BC".
* @return the era strings.
* @stable ICU 2.0
*/
}
/**
- * Sets era strings. For example: "AD" and "BC".
+ * Sets abbreviated era strings. For example: "AD" and "BC".
* @param newEras the new era strings.
* @stable ICU 2.0
*/
}
/**
- * {@icu} Returns era name strings. For example: "Anno Domini" and "Before Christ".
+ * {@icu} Returns full era name strings. For example: "Anno Domini" and "Before Christ".
* @return the era strings.
* @stable ICU 3.4
*/
}
/**
- * {@icu} Sets era name strings. For example: "Anno Domini" and "Before Christ".
+ * {@icu} Sets full era name strings. For example: "Anno Domini" and "Before Christ".
* @param newEraNames the new era strings.
* @stable ICU 3.8
*/
eraNames = duplicate(newEraNames);
}
+ /**
+ * {@icu} Returns narrow era name strings. For example: "A" and "B".
+ * @return the narrow era strings.
+ * @draft ICU 64
+ * @provisional This API might change or be removed in a future release.
+ */
+ public String[] getNarrowEras() {
+ return duplicate(narrowEras);
+ }
+
+ /**
+ * {@icu} Sets narrow era name strings. For example: "A" and "B".
+ * @param newNarrowEras the new narrow era strings.
+ * @draft ICU 64
+ * @provisional This API might change or be removed in a future release.
+ */
+ public void setNarrowEras(String[] newNarrowEras) {
+ narrowEras = duplicate(newNarrowEras);
+ }
+
/**
* Returns month strings. For example: "January", "February", etc.
* @return the month strings.
DateFormatSymbols that = (DateFormatSymbols) obj;
return (Utility.arrayEquals(eras, that.eras)
&& Utility.arrayEquals(eraNames, that.eraNames)
+ && Utility.arrayEquals(narrowEras, that.narrowEras)
&& Utility.arrayEquals(months, that.months)
&& Utility.arrayEquals(shortMonths, that.shortMonths)
&& Utility.arrayEquals(narrowMonths, that.narrowMonths)
// just do some VERY basic tests to make sure that get/set work
long count;
- final String[] eras = en.getEras();
- fr.setEras(eras);
- final String[] eras1 = fr.getEras();
- count = eras.length;
- if( count != eras1.length) {
+ final String[] erasEn = en.getEras();
+ final String[] eraNamesEn = en.getEraNames();
+ final String[] erasNarrowEn = en.getNarrowEras();
+ fr.setEras(erasEn);
+ fr.setNarrowEras(erasNarrowEn);
+ final String[] erasFr = fr.getEras();
+ final String[] erasNarrowFr = fr.getNarrowEras();
+ count = erasEn.length;
+ if( count != erasFr.length || count != erasNarrowFr.length) {
errln("ERROR: setEras() failed (different size array)");
}
- else {
+ else { // like the C++ tests
for(int i = 0; i < count; i++) {
- if(! eras[i].equals(eras1[i])) {
+ if(! erasEn[i].equals(erasFr[i])) {
errln("ERROR: setEras() failed (different string values)");
}
+ if(! erasNarrowEn[i].equals(erasNarrowFr[i])) {
+ errln("ERROR: setNarrowEras() failed (different string values)");
+ }
+ if( eraNamesEn[i].length() <= erasEn[i].length() ) {
+ // At least for English we know a wide eraName should be longer than an abbrev era
+ errln("ERROR: english eraNames[i] not longer than eras[i]");
+ }
+ if( erasNarrowEn[i].length() >= erasEn[i].length() ) {
+ // At least for English we know a narrowEra should be shorter than an abbrev era
+ errln("ERROR: english erasNarrow[i] not shorter than eras[i]");
+ }
}
}