<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>ICU4J API Comparison: ICU4J 52.1 with ICU4J 53.0.1</title>
+<title>ICU4J API Comparison: ICU4J 52.1 with ICU4J 53.1.0</title>
<!-- Copyright 2014, IBM, All Rights Reserved. -->
</head>
<body>
-<h1>ICU4J API Comparison: ICU4J 52.1 with ICU4J 53.0.1</h1>
+<h1>ICU4J API Comparison: ICU4J 52.1 with ICU4J 53.1.0</h1>
<hr/>
<h2>Removed from ICU4J 52.1</h2>
<li><span style='color:orange'>(draft)</span> public static final int WORD_NUMBER</li>
<li><span style='color:orange'>(draft)</span> public static final int WORD_NUMBER_LIMIT</li>
</ul>
+RuleBasedCollator
+<ul>
+<li><span style='color:green'>(stable)</span> public static int[] <i>getEquivalentReorderCodes</i>(int)</li>
+</ul>
SimpleDateFormat
<ul>
<li><span style='color:orange'>(draft)</span> public DisplayContext <i>getContext</i>(DisplayContext.Type)</li>
-<li><span style='color:orange'>(draft)</span> public void <i>setContext</i>(DisplayContext)</li>
</ul>
</ul>
<hr/>
-<h2>Deprecated or Obsoleted in ICU4J 53.0.1</h2>
-<p>(no API obsoleted)</p>
+<h2>Deprecated or Obsoleted in ICU4J 53.1.0</h2>
+
+<h3>Package com.ibm.icu.text</h3>
+<ul>
+<li><span style='color:gray'>(deprecated)</span> public class <i>TimeUnitFormat</i></li>
+Collator
+<ul>
+<li><span style='color:gray'>(deprecated)</span> public abstract int <i>setVariableTop</i>(java.lang.String)</li>
+<li><span style='color:gray'>(deprecated)</span> public abstract void <i>setVariableTop</i>(int)</li>
+</ul>
+RuleBasedCollator
+<ul>
+<li><span style='color:gray'>(deprecated)</span> public int <i>setVariableTop</i>(java.lang.String)</li>
+<li><span style='color:gray'>(deprecated)</span> public void <i>setVariableTop</i>(int)</li>
+</ul>
+SpoofChecker
+<ul>
+<li><span style='color:gray'>(deprecated)</span> public static final int SINGLE_SCRIPT</li>
+</ul>
+</ul>
+
<hr/>
-<h2>Changed in ICU4J 53.0.1 (old, new)</h2>
+<h2>Changed in ICU4J 53.1.0 (old, new)</h2>
<h3>Package com.ibm.icu.text</h3>
<ul>
+<li> <span style='color:green'>(stable)</span> public abstract class <i>Collator</i> extends java.lang.Object implements java.util.Comparator, com.ibm.icu.util.Freezable</br>
+<span style='color:green'>(stable)</span> public abstract class <i>Collator</i> extends java.lang.Object implements java.util.Comparator, com.ibm.icu.util.Freezable, java.lang.Cloneable</li>
TimeUnitFormat
<ul>
<li> <span style='color:green'>(stable)</span> public java.lang.Object <i>parseObject</i>(java.lang.String, java.text.ParsePosition)</br>
-<span style='color:green'>(stable)</span> public com.ibm.icu.util.TimeUnitAmount <i>parseObject</i>(java.lang.String, java.text.ParsePosition)</li>
+<span style='color:gray'>(deprecated)</span> public com.ibm.icu.util.TimeUnitAmount <i>parseObject</i>(java.lang.String, java.text.ParsePosition)</li>
</ul>
</ul>
<ul>
<li> <span style='color:green'>(stable)</span> public class <i>Currency</i> extends com.ibm.icu.util.MeasureUnit implements java.io.Serializable</br>
<span style='color:green'>(stable)</span> public class <i>Currency</i> extends com.ibm.icu.util.MeasureUnit</li>
+LocalePriorityList
+<ul>
+<li> <span style='color:green'>(stable)</span> public static com.ibm.icu.util.LocalePriorityList.Builder <i>add</i>(com.ibm.icu.util.ULocale)</br>
+<span style='color:green'>(stable)</span> public static com.ibm.icu.util.LocalePriorityList.Builder <i>add</i>(com.ibm.icu.util.ULocale...)</li>
<li> <span style='color:green'>(stable)</span> public class <i>MeasureUnit</i> extends java.lang.Object implements java.lang.Comparable, java.io.Serializable</br>
<span style='color:green'>(stable)</span> public class <i>MeasureUnit</i> extends java.lang.Object implements java.io.Serializable</li>
<li> <span style='color:green'>(stable)</span> public final class <i>ULocale</i> extends java.lang.Object implements java.io.Serializable</br>
<span style='color:green'>(stable)</span> public final class <i>ULocale</i> extends java.lang.Object implements java.io.Serializable, java.lang.Comparable</li>
</ul>
+</ul>
<hr/>
-<h2>Promoted to stable in ICU4J 53.0.1</h2>
+<h2>Promoted to stable in ICU4J 53.1.0</h2>
+
+<h3>Package com.ibm.icu.lang</h3>
+<ul>
+<li><span style='color:green'>(stable)</span> public static enum <i>UScript.ScriptUsage</i></li>
+UScript
+<ul>
+<li><span style='color:green'>(stable)</span> public static final boolean <i>breaksBetweenLetters</i>(int)</li>
+<li><span style='color:green'>(stable)</span> public static final java.lang.String <i>getSampleString</i>(int)</li>
+<li><span style='color:green'>(stable)</span> public static final UScript.ScriptUsage <i>getUsage</i>(int)</li>
+<li><span style='color:green'>(stable)</span> public static final boolean <i>isCased</i>(int)</li>
+<li><span style='color:green'>(stable)</span> public static final boolean <i>isRightToLeft</i>(int)</li>
+</ul>
+UScript.ScriptUsage
+<ul>
+<li><span style='color:green'>(stable)</span> public static final UScript.ScriptUsage ASPIRATIONAL</li>
+<li><span style='color:green'>(stable)</span> public static final UScript.ScriptUsage EXCLUDED</li>
+<li><span style='color:green'>(stable)</span> public static final UScript.ScriptUsage LIMITED_USE</li>
+<li><span style='color:green'>(stable)</span> public static final UScript.ScriptUsage NOT_ENCODED</li>
+<li><span style='color:green'>(stable)</span> public static final UScript.ScriptUsage RECOMMENDED</li>
+<li><span style='color:green'>(stable)</span> public static final UScript.ScriptUsage UNKNOWN</li>
+</ul>
+</ul>
<h3>Package com.ibm.icu.text</h3>
<ul>
+<li><span style='color:green'>(stable)</span> public static final class <i>AlphabeticIndex.ImmutableIndex</i></li>
+<li><span style='color:green'>(stable)</span> public final class <i>ListFormatter</i></li>
+<li><span style='color:green'>(stable)</span> public static enum <i>CompactDecimalFormat.CompactStyle</i></li>
+<li><span style='color:green'>(stable)</span> public enum <i>DisplayContext</i></li>
+<li><span style='color:green'>(stable)</span> public static enum <i>DisplayContext.Type</i></li>
+AlphabeticIndex
+<ul>
+<li><span style='color:green'>(stable)</span> public <i>AlphabeticIndex</i>(RuleBasedCollator)</li>
+<li><span style='color:green'>(stable)</span> public AlphabeticIndex.ImmutableIndex<V> <i>buildImmutableIndex</i>()</li>
+</ul>
AlphabeticIndex.Bucket.LabelType
<ul>
<li><span style='color:green'>(stable)</span> public static final AlphabeticIndex.Bucket.LabelType INFLOW</li>
<li><span style='color:green'>(stable)</span> public static final AlphabeticIndex.Bucket.LabelType OVERFLOW</li>
<li><span style='color:green'>(stable)</span> public static final AlphabeticIndex.Bucket.LabelType UNDERFLOW</li>
</ul>
+CompactDecimalFormat.CompactStyle
+<ul>
+<li><span style='color:green'>(stable)</span> public static final CompactDecimalFormat.CompactStyle LONG</li>
+<li><span style='color:green'>(stable)</span> public static final CompactDecimalFormat.CompactStyle SHORT</li>
+</ul>
+CurrencyMetaInfo.CurrencyFilter
+<ul>
+<li><span style='color:green'>(stable)</span> public static CurrencyMetaInfo.CurrencyFilter <i>onDate</i>(long)</li>
+<li><span style='color:green'>(stable)</span> public static CurrencyMetaInfo.CurrencyFilter <i>onDateRange</i>(long, long)</li>
+<li><span style='color:green'>(stable)</span> public static CurrencyMetaInfo.CurrencyFilter <i>onTender</i>()</li>
+<li><span style='color:green'>(stable)</span> public CurrencyMetaInfo.CurrencyFilter <i>withDate</i>(long)</li>
+<li><span style='color:green'>(stable)</span> public CurrencyMetaInfo.CurrencyFilter <i>withDateRange</i>(long, long)</li>
+<li><span style='color:green'>(stable)</span> public CurrencyMetaInfo.CurrencyFilter <i>withTender</i>()</li>
+</ul>
+CurrencyMetaInfo.CurrencyInfo
+<ul>
+<li><span style='color:green'>(stable)</span> public boolean <i>isTender</i>()</li>
+</ul>
+DateFormat
+<ul>
+<li><span style='color:green'>(stable)</span> public static final int TIMEZONE_ISO_FIELD</li>
+<li><span style='color:green'>(stable)</span> public static final int TIMEZONE_ISO_LOCAL_FIELD</li>
+<li><span style='color:green'>(stable)</span> public static final int TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD</li>
+</ul>
+DateFormatSymbols
+<ul>
+<li><span style='color:green'>(stable)</span> public static final int SHORT</li>
+</ul>
+DecimalFormat
+<ul>
+<li><span style='color:green'>(stable)</span> public int <i>getParseMaxDigits</i>()</li>
+<li><span style='color:green'>(stable)</span> public void <i>setParseMaxDigits</i>(int)</li>
+</ul>
+DisplayContext
+<ul>
+<li><span style='color:green'>(stable)</span> public DisplayContext.Type <i>type</i>()</li>
+<li><span style='color:green'>(stable)</span> public int <i>value</i>()</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext CAPITALIZATION_FOR_STANDALONE</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext CAPITALIZATION_FOR_UI_LIST_OR_MENU</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext CAPITALIZATION_NONE</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext DIALECT_NAMES</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext STANDARD_NAMES</li>
+</ul>
+DisplayContext.Type
+<ul>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext.Type CAPITALIZATION</li>
+<li><span style='color:green'>(stable)</span> public static final DisplayContext.Type DIALECT_HANDLING</li>
+</ul>
+LocaleDisplayNames
+<ul>
+<li><span style='color:green'>(stable)</span> public abstract DisplayContext <i>getContext</i>(DisplayContext.Type)</li>
+<li><span style='color:green'>(stable)</span> public static LocaleDisplayNames <i>getInstance</i>(ULocale, DisplayContext...)</li>
+</ul>
+TimeZoneFormat
+<ul>
+<li><span style='color:green'>(stable)</span> public final java.lang.String <i>formatOffsetISO8601Basic</i>(int, boolean, boolean, boolean)</li>
+<li><span style='color:green'>(stable)</span> public final java.lang.String <i>formatOffsetISO8601Extended</i>(int, boolean, boolean, boolean)</li>
+<li><span style='color:green'>(stable)</span> public java.lang.String <i>formatOffsetShortLocalizedGMT</i>(int)</li>
+<li><span style='color:green'>(stable)</span> public int <i>parseOffsetShortLocalizedGMT</i>(java.lang.String, java.text.ParsePosition)</li>
+</ul>
+TimeZoneFormat.GMTOffsetPatternType
+<ul>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.GMTOffsetPatternType NEGATIVE_H</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.GMTOffsetPatternType POSITIVE_H</li>
+</ul>
+TimeZoneFormat.Style
+<ul>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style EXEMPLAR_LOCATION</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_BASIC_FIXED</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_BASIC_FULL</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_BASIC_LOCAL_FIXED</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_BASIC_LOCAL_FULL</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_BASIC_LOCAL_SHORT</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_BASIC_SHORT</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_EXTENDED_FIXED</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_EXTENDED_FULL</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_EXTENDED_LOCAL_FIXED</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ISO_EXTENDED_LOCAL_FULL</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style LOCALIZED_GMT_SHORT</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ZONE_ID</li>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneFormat.Style ZONE_ID_SHORT</li>
+</ul>
+TimeZoneNames.NameType
+<ul>
+<li><span style='color:green'>(stable)</span> public static final TimeZoneNames.NameType EXEMPLAR_LOCATION</li>
+</ul>
</ul>
<hr/>
-<h2>Added in ICU4J 53.0.1</h2>
+<h2>Added in ICU4J 53.1.0</h2>
<h3>Package com.ibm.icu.text</h3>
<ul>
<li><span style='color:orange'>(draft)</span> public static enum <i>RelativeDateTimeFormatter.AbsoluteUnit</i></li>
<li><span style='color:orange'>(draft)</span> public static enum <i>RelativeDateTimeFormatter.Direction</i></li>
<li><span style='color:orange'>(draft)</span> public static enum <i>RelativeDateTimeFormatter.RelativeUnit</i></li>
+<li><span style='color:orange'>(draft)</span> public static enum <i>SearchIterator.ElementComparisonType</i></li>
+<li><span style='color:orange'>(draft)</span> public static enum <i>SpoofChecker.RestrictionLevel</i></li>
BreakIterator
<ul>
<li><span style='color:orange'>(draft)</span> public static final int WORD_IDEO</li>
<li><span style='color:orange'>(draft)</span> public static final int WORD_NUMBER</li>
<li><span style='color:orange'>(draft)</span> public static final int WORD_NUMBER_LIMIT</li>
</ul>
+Collator
+<ul>
+<li><span style='color:green'>(stable)</span> public boolean <i>equals</i>(java.lang.Object)</li>
+<li><span style='color:orange'>(draft)</span> public int <i>getMaxVariable</i>()</li>
+<li><span style='color:orange'>(draft)</span> public Collator <i>setMaxVariable</i>(int)</li>
+</ul>
DateFormat
<ul>
<li><span style='color:orange'>(draft)</span> public boolean <i>getBooleanAttribute</i>(DateFormat.BooleanAttribute)</li>
</ul>
DateFormat.BooleanAttribute
<ul>
+<li><span style='color:orange'>(draft)</span> public static final DateFormat.BooleanAttribute PARSE_ALLOW_NUMERIC</li>
+<li><span style='color:orange'>(draft)</span> public static final DateFormat.BooleanAttribute PARSE_ALLOW_WHITESPACE</li>
+<li><span style='color:orange'>(draft)</span> public static final DateFormat.BooleanAttribute PARSE_MULTIPLE_PATTERNS_FOR_MATCH</li>
<li><span style='color:orange'>(draft)</span> public static final DateFormat.BooleanAttribute PARSE_PARTIAL_MATCH</li>
</ul>
+DateIntervalFormat
+<ul>
+<li><span style='color:orange'>(draft)</span> public TimeZone <i>getTimeZone</i>()</li>
+<li><span style='color:orange'>(draft)</span> public void <i>setTimeZone</i>(TimeZone)</li>
+</ul>
MeasureFormat
<ul>
<li><span style='color:orange'>(draft)</span> public final boolean <i>equals</i>(java.lang.Object)</li>
<li><span style='color:orange'>(draft)</span> public java.lang.StringBuffer <i>format</i>(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)</li>
-<li><span style='color:orange'>(draft)</span> public T extends java.lang.Appendable <i>formatMeasures</i>(T, java.text.FieldPosition, Measure...)</li>
-<li><span style='color:orange'>(draft)</span> public java.lang.String <i>formatMeasures</i>(Measure...)</li>
+<li><span style='color:orange'>(draft)</span> public final java.lang.String <i>formatMeasures</i>(Measure...)</li>
+<li><span style='color:orange'>(draft)</span> public java.lang.StringBuilder <i>formatMeasures</i>(java.lang.StringBuilder, java.text.FieldPosition, Measure...)</li>
<li><span style='color:orange'>(draft)</span> public static MeasureFormat <i>getInstance</i>(ULocale, MeasureFormat.FormatWidth)</li>
<li><span style='color:orange'>(draft)</span> public static MeasureFormat <i>getInstance</i>(ULocale, MeasureFormat.FormatWidth, NumberFormat)</li>
-<li><span style='color:orange'>(draft)</span> public ULocale <i>getLocale</i>()</li>
+<li><span style='color:orange'>(draft)</span> public final ULocale <i>getLocale</i>()</li>
<li><span style='color:orange'>(draft)</span> public NumberFormat <i>getNumberFormat</i>()</li>
<li><span style='color:orange'>(draft)</span> public MeasureFormat.FormatWidth <i>getWidth</i>()</li>
<li><span style='color:orange'>(draft)</span> public final int <i>hashCode</i>()</li>
</ul>
NumberFormat
<ul>
+<li><span style='color:orange'>(draft)</span> public static final int ACCOUNTINGCURRENCYSTYLE</li>
<li><span style='color:orange'>(draft)</span> public DisplayContext <i>getContext</i>(DisplayContext.Type)</li>
<li><span style='color:orange'>(draft)</span> public void <i>setContext</i>(DisplayContext)</li>
</ul>
<li><span style='color:orange'>(draft)</span> public static final RelativeDateTimeFormatter.RelativeUnit WEEKS</li>
<li><span style='color:orange'>(draft)</span> public static final RelativeDateTimeFormatter.RelativeUnit YEARS</li>
</ul>
-TimeUnitFormat
+RuleBasedCollator
<ul>
-<li><span style='color:orange'>(draft)</span> public java.lang.Object <i>clone</i>()</li>
-<li><span style='color:orange'>(draft)</span> public T extends java.lang.Appendable <i>formatMeasures</i>(T, java.text.FieldPosition, Measure...)</li>
-<li><span style='color:orange'>(draft)</span> public java.lang.String <i>formatMeasures</i>(Measure...)</li>
-<li><span style='color:orange'>(draft)</span> public ULocale <i>getLocale</i>()</li>
-<li><span style='color:orange'>(draft)</span> public NumberFormat <i>getNumberFormat</i>()</li>
-<li><span style='color:orange'>(draft)</span> public MeasureFormat.FormatWidth <i>getWidth</i>()</li>
+<li><span style='color:green'>(stable)</span> public int <i>getDecomposition</i>()</li>
+<li><span style='color:orange'>(draft)</span> public ULocale <i>getLocale</i>(ULocale.Type)</li>
+<li><span style='color:orange'>(draft)</span> public int <i>getMaxVariable</i>()</li>
+<li><span style='color:green'>(stable)</span> public int <i>getStrength</i>()</li>
+<li><span style='color:green'>(stable)</span> public void <i>setDecomposition</i>(int)</li>
+<li><span style='color:orange'>(draft)</span> public RuleBasedCollator <i>setMaxVariable</i>(int)</li>
+</ul>
+RuleBasedNumberFormat
+<ul>
+<li><span style='color:orange'>(draft)</span> public void <i>setContext</i>(DisplayContext)</li>
+</ul>
+SearchIterator
+<ul>
+<li><span style='color:orange'>(draft)</span> public SearchIterator.ElementComparisonType <i>getElementComparisonType</i>()</li>
+<li><span style='color:orange'>(draft)</span> public void <i>setElementComparisonType</i>(SearchIterator.ElementComparisonType)</li>
+</ul>
+SearchIterator.ElementComparisonType
+<ul>
+<li><span style='color:orange'>(draft)</span> public static final SearchIterator.ElementComparisonType ANY_BASE_WEIGHT_IS_WILDCARD</li>
+<li><span style='color:orange'>(draft)</span> public static final SearchIterator.ElementComparisonType PATTERN_BASE_WEIGHT_IS_WILDCARD</li>
+<li><span style='color:orange'>(draft)</span> public static final SearchIterator.ElementComparisonType STANDARD_ELEMENT_COMPARISON</li>
+</ul>
+SpoofChecker.RestrictionLevel
+<ul>
+<li><span style='color:orange'>(draft)</span> public static final SpoofChecker.RestrictionLevel ASCII</li>
+<li><span style='color:orange'>(draft)</span> public static final SpoofChecker.RestrictionLevel HIGHLY_RESTRICTIVE</li>
+<li><span style='color:orange'>(draft)</span> public static final SpoofChecker.RestrictionLevel MINIMALLY_RESTRICTIVE</li>
+<li><span style='color:orange'>(draft)</span> public static final SpoofChecker.RestrictionLevel MODERATELY_RESTRICTIVE</li>
+<li><span style='color:orange'>(draft)</span> public static final SpoofChecker.RestrictionLevel SINGLE_SCRIPT_RESTRICTIVE</li>
+<li><span style='color:orange'>(draft)</span> public static final SpoofChecker.RestrictionLevel UNRESTRICTIVE</li>
</ul>
</ul>
<h3>Package com.ibm.icu.util</h3>
<ul>
+<li><span style='color:orange'>(draft)</span> public class <i>ICUCloneNotSupportedException</i></li>
+<li><span style='color:orange'>(draft)</span> public class <i>ICUException</i></li>
+<li><span style='color:orange'>(draft)</span> public class <i>ICUUncheckedIOException</i></li>
MeasureUnit
<ul>
<li><span style='color:orange'>(draft)</span> public static final MeasureUnit ACRE</li>
</ul>
<hr/>
-<p><i><font size="-1">Contents generated by ReportAPI tool on Mon Jan 20 12:34:51 EST 2014<br/>Copyright (C) 2014, International Business Machines Corporation, All Rights Reserved.</font></i></p>
+<p><i><font size="-1">Contents generated by ReportAPI tool on Thu Mar 13 00:18:26 EDT 2014<br/>Copyright (C) 2014, International Business Machines Corporation, All Rights Reserved.</font></i></p>
</body>
</html>
*
* @param <V> The Record value type is unused. It can be omitted for this class
* if it was omitted for the AlphabeticIndex that built it.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static final class ImmutableIndex<V> implements Iterable<Bucket<V>> {
private final BucketList<V> buckets;
* Returns the number of index buckets and labels, including underflow/inflow/overflow.
*
* @return the number of index buckets
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public int getBucketCount() {
return buckets.getBucketCount();
*
* @param name the string to be sorted into an index bucket
* @return the bucket number for the name
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public int getBucketIndex(CharSequence name) {
return buckets.getBucketIndex(name, collatorPrimaryOnly);
*
* @param index bucket number
* @return the index-th bucket
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public Bucket<V> getBucket(int index) {
if (0 <= index && index < buckets.getBucketCount()) {
/**
* {@inheritDoc}
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public Iterator<Bucket<V>> iterator() {
return buckets.iterator();
* collator provided to the AlphabeticIndex remains unchanged after creation of the index.
*
* @param collator The collator to use to order the contents of this index.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public AlphabeticIndex(RuleBasedCollator collator) {
this(null, collator);
* Builds an immutable, thread-safe version of this instance, without data records.
*
* @return an immutable index instance
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public ImmutableIndex<V> buildImmutableIndex() {
// The current AlphabeticIndex Java code never modifies the bucket list once built.
/**
* {@inheritDoc}
+ * @stable ICU 2.8
*/
@Override
public boolean equals(Object obj) {
/**
* {@inheritDoc}
+ * @draft ICU 53 (retain)
+ * @provisional This API might change or be removed in a future release.
*/
@Override
public ULocale getLocale(ULocale.Type type) {
* @see SearchIterator
* @see RuleBasedCollator
* @author Laura Werner, synwee
- * @since ICU 2.0
+ * @stable ICU 2.0
*/
// internal notes: all methods do not guarantee the correct status of the
// characteriterator. the caller has to maintain the original index position
// if necessary. methods could change the index position as it deems fit
public final class StringSearch extends SearchIterator {
-
- /**
- * DONE is returned by {@link #previous()} and {@link #next()} after all valid matches have
- * been returned, and by {@link SearchIterator#first() first()} and
- * {@link SearchIterator#last() last()} if there are no matches at all.
- * @see #previous
- * @see #next
- * @stable ICU 2.0
- */
- public static final int DONE = -1;
private Pattern pattern_;
private RuleBasedCollator collator_;
* See UAX #31 Unicode Identifier and Pattern Syntax.
* http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers
*
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public enum ScriptUsage {
/**
* Not encoded in Unicode.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
NOT_ENCODED,
/**
* Unknown script usage.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
UNKNOWN,
/**
* Candidate for Exclusion from Identifiers.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
EXCLUDED,
/**
* Limited Use script.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
LIMITED_USE,
/**
* Aspirational Use script.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ASPIRATIONAL,
/**
* Recommended script.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
RECOMMENDED
}
*
* @param script script code
* @return the sample character string
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static final String getSampleString(int script) {
int sampleChar = ScriptMetadata.getScriptProps(script) & 0x1fffff;
* @param script script code
* @return script usage
* @see ScriptUsage
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static final ScriptUsage getUsage(int script) {
return usageValues[(ScriptMetadata.getScriptProps(script) >> 21) & 7];
*
* @param script script code
* @return true if the script is right-to-left
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static final boolean isRightToLeft(int script) {
return (ScriptMetadata.getScriptProps(script) & ScriptMetadata.RTL) != 0;
*
* @param script script code
* @return true if the script allows line breaks between letters
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static final boolean breaksBetweenLetters(int script) {
return (ScriptMetadata.getScriptProps(script) & ScriptMetadata.LB_LETTERS) != 0;
*
* @param script script code
* @return true if the script is cased
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static final boolean isCased(int script) {
return (ScriptMetadata.getScriptProps(script) & ScriptMetadata.CASED) != 0;
/**
* Style parameter for CompactDecimalFormat.
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
public enum CompactStyle {
/**
* Short version, like "1.2T"
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
SHORT,
/**
* Longer version, like "1.2 trillion", if available. May return same result as SHORT if not.
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
LONG
}
}
/**
- * @draft ICU 53
- * @provisional
+ * {@inheritDoc}
*/
@Override
public Object clone() {
// MeasureFormat
/**
- * @draft ICU 53
- * @provisional
+ * {@inheritDoc}
*/
@Override
public StringBuilder formatMeasures(
}
/**
- * @draft ICU 53
- * @provisional
+ * {@inheritDoc}
*/
@Override
public MeasureFormat.FormatWidth getWidth() {
}
/**
- * @draft ICU 53
- * @provisional
+ * {@inheritDoc}
*/
@Override
public NumberFormat getNumberFormat() {
/**
* Returns a filter that accepts all currencies in use on the given date.
* @param date the date as milliseconds after Jan 1, 1970
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static CurrencyFilter onDate(long date) {
return ALL.withDate(date);
* Measured in milliseconds since Jan 1, 1970 GMT.
* @param to The date on or before which a currency must have been in use.
* Measured in milliseconds since Jan 1, 1970 GMT.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static CurrencyFilter onDateRange(long from, long to) {
return ALL.withDateRange(from, to);
/**
* Returns a CurrencyFilter for finding currencies that were either once used,
* are used, or will be used as tender.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static CurrencyFilter onTender() {
return ALL.withTender();
* Returns a copy of this filter that accepts all currencies in use on
* the given date.
* @param date the date as milliseconds after Jan 1, 1970
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public CurrencyFilter withDate(long date) {
return new CurrencyFilter(this.region, this.currency, date, date, this.tenderOnly);
* Measured in milliseconds since Jan 1, 1970 GMT.
* @param to The date on or before which a currency must have been in use.
* Measured in milliseconds since Jan 1, 1970 GMT.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public CurrencyFilter withDateRange(long from, long to) {
return new CurrencyFilter(this.region, this.currency, from, to, this.tenderOnly);
/**
* Returns a copy of this filter that filters for currencies that were
* either once used, are used, or will be used as tender.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public CurrencyFilter withTender() {
return new CurrencyFilter(this.region, this.currency, this.from, this.to, true);
/**
* Determine whether or not this currency was once used, is used,
* or will be used as tender in this region.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public boolean isTender() {
return tender;
* corresponding to the {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET} fields. This displays the
* localized GMT format.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public final static int TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31;
* corresponding to the {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET} fields. This displays the
* ISO 8601 local time offset format or UTC indicator ("Z").
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public final static int TIMEZONE_ISO_FIELD = 32;
* corresponding to the {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET} fields. This displays the
* ISO 8601 local time offset format.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public final static int TIMEZONE_ISO_LOCAL_FIELD = 33;
* boolean attributes
*
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public enum BooleanAttribute {
/**
* indicates whitespace tolerance. Also included is trailing dot tolerance.
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
PARSE_ALLOW_WHITESPACE,
/**
* indicates tolerance of numeric data when String data may be assumed.
* e.g. YEAR_NAME_FIELD
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
PARSE_ALLOW_NUMERIC,
/**
* 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
+ * @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
+ * @provisional This API might change or be removed in a future release.
*/
PARSE_PARTIAL_MATCH
};
* inputs must match this object's format more closely.
* @param lenient when true, Calendar parsing is lenient
* @see com.ibm.icu.util.Calendar#setLenient
- * @draft ICU 53
+ * @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public void setCalendarLenient(boolean lenient)
{
/**
* Returns whether date/time parsing in the encapsulated Calendar object is lenient.
- * @draft ICU 53
+ * @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public boolean isCalendarLenient()
{
*
* @see BooleanAttribute
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value)
{
*
* @see BooleanAttribute
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public boolean getBooleanAttribute(BooleanAttribute key)
{
/**
* {@icu} Constant for width; only supported for weekdays.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static final int SHORT = 3;
* Get the TimeZone
* @return A copy of the TimeZone associated with this date interval formatter.
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public TimeZone getTimeZone()
{
* Set the TimeZone for the calendar used by this DateIntervalFormat object.
* @param zone The new TimeZone, will be cloned for use by this DateIntervalFormat.
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public void setTimeZone(TimeZone zone)
{
* If the limit is set too high, an OutOfMemoryException may be triggered.
* The default value is 1000.
* @param newValue the new limit
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public void setParseMaxDigits(int newValue) {
if (newValue > 0) {
/**
* Get the current maximum number of exponent digits when parsing a
* number.
- *
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @return the maximum number of exponent digits for parsing
+ * @stable ICU 51
*/
public int getParseMaxDigits() {
return PARSE_MAX_EXPONENT;
/*
*******************************************************************************
- * Copyright (C) 2012, International Business Machines Corporation and *
+ * Copyright (C) 2012-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
/**
* Display context settings.
* Note, the specific numeric values are internal and may change.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public enum DisplayContext {
/**
* A possible setting for DIALECT_HANDLING:
* use standard names when generating a locale name,
* e.g. en_GB displays as 'English (United Kingdom)'.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
STANDARD_NAMES(Type.DIALECT_HANDLING, 0),
/**
* A possible setting for DIALECT_HANDLING:
* use dialect names, when generating a locale name,
* e.g. en_GB displays as 'British English'.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
DIALECT_NAMES(Type.DIALECT_HANDLING, 1),
/**
/**
* A possible setting for CAPITALIZATION:
* The capitalization context to be used is unknown (this is the default value).
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
CAPITALIZATION_NONE(Type.CAPITALIZATION, 0),
/**
* A possible setting for CAPITALIZATION:
* The capitalization context if a date, date symbol or display name is to be
* formatted with capitalization appropriate for the middle of a sentence.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE(Type.CAPITALIZATION, 1),
/**
* A possible setting for CAPITALIZATION:
* The capitalization context if a date, date symbol or display name is to be
* formatted with capitalization appropriate for the beginning of a sentence.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE(Type.CAPITALIZATION, 2),
/**
* A possible setting for CAPITALIZATION:
* The capitalization context if a date, date symbol or display name is to be
* formatted with capitalization appropriate for a user-interface list or menu item.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
CAPITALIZATION_FOR_UI_LIST_OR_MENU(Type.CAPITALIZATION, 3),
/**
* The capitalization context if a date, date symbol or display name is to be
* formatted with capitalization appropriate for stand-alone usage such as an
* isolated name on a calendar page.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
CAPITALIZATION_FOR_STANDALONE(Type.CAPITALIZATION, 4);
/**
* Type values for DisplayContext
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public enum Type {
/**
* DIALECT_HANDLING can be set to STANDARD_NAMES or DIALECT_NAMES.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
DIALECT_HANDLING,
/**
* CAPITALIZATION can be set to one of CAPITALIZATION_NONE through
* CAPITALIZATION_FOR_STANDALONE.
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
CAPITALIZATION
}
/**
* Get the Type part of the enum item
* (e.g. CAPITALIZATION)
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public Type type() {
return type;
/**
* Get the value part of the enum item
* (e.g. CAPITALIZATION_FOR_STANDALONE)
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public int value() {
return value;
* separately). The class is not subclassable.
*
* @author Mark Davis
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
final public class ListFormatter {
private final SimplePatternFormatter two;
* @param locale
* the locale in question.
* @return ListFormatter
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
public static ListFormatter getInstance(ULocale locale) {
return getInstance(locale, Style.STANDARD);
* @param locale
* the locale in question.
* @return ListFormatter
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
public static ListFormatter getInstance(Locale locale) {
return getInstance(ULocale.forLocale(locale), Style.STANDARD);
* Create a list formatter that is appropriate for the default FORMAT locale.
*
* @return ListFormatter
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
public static ListFormatter getInstance() {
return getInstance(ULocale.getDefault(ULocale.Category.FORMAT));
* @param items
* items to format. The toString() method is called on each.
* @return items formatted into a string
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
public String format(Object... items) {
return format(Arrays.asList(items));
* @param items
* items to format. The toString() method is called on each.
* @return items formatted into a string
- * @draft ICU 50
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 50
*/
public String format(Collection<?> items) {
// TODO optimize this for the common case that the patterns are all of the
* @param contexts one or more context settings (e.g. for dialect
* handling, capitalization, etc.
* @return a LocaleDisplayNames instance
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public static LocaleDisplayNames getInstance(ULocale locale, DisplayContext... contexts) {
return LocaleDisplayNamesImpl.getInstance(locale, contexts);
* Returns the current value for a specified DisplayContext.Type.
* @param type the DisplayContext.Type whose value to return
* @return the current DisplayContext setting for the specified type
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public abstract DisplayContext getContext(DisplayContext.Type type);
* Formatting width enum.
*
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
// Be sure to update MeasureUnitTest.TestSerialFormatWidthEnum
// when adding an enum value.
* Spell out everything.
*
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
WIDE("units", ListFormatter.Style.DURATION, NumberFormat.PLURALCURRENCYSTYLE),
* Abbreviate when possible.
*
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
SHORT("unitsShort", ListFormatter.Style.DURATION_SHORT, NumberFormat.ISOCURRENCYSTYLE),
* Brief. Use only a symbol for the unit when possible.
*
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
NARROW("unitsNarrow", ListFormatter.Style.DURATION_NARROW, NumberFormat.CURRENCYSTYLE),
* In these cases formatMeasures formats as 5:37:23 instead of 5h, 37m, 23s.
*
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
NUMERIC("unitsNarrow", ListFormatter.Style.DURATION_NARROW, NumberFormat.CURRENCYSTYLE);
* @param formatWidth hints how long formatted strings should be.
* @return The new MeasureFormat object.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static MeasureFormat getInstance(ULocale locale, FormatWidth formatWidth) {
return getInstance(locale, formatWidth, NumberFormat.getInstance(locale));
* @param format This is defensively copied.
* @return The new MeasureFormat object.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static MeasureFormat getInstance(ULocale locale, FormatWidth formatWidth, NumberFormat format) {
PluralRules rules = PluralRules.forLocale(locale);
* @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
*
* @draft ICU53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
@Override
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
}
/**
+ * Parses text from a string to produce a <code>Measure</code>.
* @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)
* @throws UnsupportedOperationException Not supported.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
@Override
public Measure parseObject(String source, ParsePosition pos) {
* @param measures a sequence of one or more measures.
* @return the formatted string.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public final String formatMeasures(Measure... measures) {
return formatMeasures(
* @return appendTo.
* @see MeasureFormat#formatMeasures(Measure...)
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public StringBuilder formatMeasures(
StringBuilder appendTo, FieldPosition fieldPosition, Measure... measures) {
* Two MeasureFormats, a and b, are equal if and only if they have the same formatWidth,
* locale, and equal number formats.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
@Override
public final boolean equals(Object other) {
}
/**
+ * {@inheritDoc}
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
@Override
public final int hashCode() {
/**
* Get the format width this instance is using.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public MeasureFormat.FormatWidth getWidth() {
return formatWidth;
/**
* Get the locale of this instance.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public final ULocale getLocale() {
return getLocale(ULocale.VALID_LOCALE);
/**
* Get a copy of the number format.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public NumberFormat getNumberFormat() {
return numberFormat.get();
/*
*******************************************************************************
- * Copyright (C) 2013, International Business Machines Corporation and *
+ * Copyright (C) 2013-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
* (3 secs ago), and relative day periods ("yesterday afternoon"), etc.
*
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public final class RelativeDateTimeFormatter {
* Represents the unit for formatting a relative date. e.g "in 5 days"
* or "in 3 months"
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static enum RelativeUnit {
/**
* Seconds
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
SECONDS,
/**
* Minutes
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
MINUTES,
/**
* Hours
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
HOURS,
/**
* Days
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
DAYS,
/**
* Weeks
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
WEEKS,
/**
* Months
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
MONTHS,
/**
* Years
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
YEARS,
}
/**
* Represents an absolute unit.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static enum AbsoluteUnit {
/**
* Sunday
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
SUNDAY,
/**
* Monday
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
MONDAY,
/**
* Tuesday
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
TUESDAY,
/**
* Wednesday
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
WEDNESDAY,
/**
* Thursday
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
THURSDAY,
/**
* Friday
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
FRIDAY,
/**
* Saturday
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
SATURDAY,
/**
* Day
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
DAY,
/**
* Week
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
WEEK,
/**
* Month
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
MONTH,
/**
* Year
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
YEAR,
/**
* Now
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
NOW,
}
* Represents a direction for an absolute unit e.g "Next Tuesday"
* or "Last Tuesday"
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static enum Direction {
/**
* Two before. Not fully supported in every locale
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
LAST_2,
/**
* Last
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
LAST,
/**
* This
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
THIS,
/**
* Next
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
NEXT,
/**
* Two after. Not fully supported in every locale
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
NEXT_2,
/**
* Plain, which means the absence of a qualifier
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
PLAIN;
}
/**
* Returns a RelativeDateTimeFormatter for the default locale.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static RelativeDateTimeFormatter getInstance() {
return getInstance(ULocale.getDefault());
*
* @param locale the locale.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static RelativeDateTimeFormatter getInstance(ULocale locale) {
RelativeDateTimeFormatterData data = cache.get(locale);
* @param nf the number format object. It is defensively copied to ensure thread-safety
* and immutability of this class.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public static RelativeDateTimeFormatter getInstance(ULocale locale, NumberFormat nf) {
RelativeDateTimeFormatterData data = cache.get(locale);
* @throws IllegalArgumentException if direction is something other than
* NEXT or LAST.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public String format(double quantity, Direction direction, RelativeUnit unit) {
if (direction != Direction.LAST && direction != Direction.NEXT) {
* @throws IllegalArgumentException if the direction is incompatible with
* unit this can occur with NOW which can only take PLAIN.
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public String format(Direction direction, AbsoluteUnit unit) {
if (unit == AbsoluteUnit.NOW && direction != Direction.PLAIN) {
* @return the date and time concatenated according to the default
* calendar in this locale e.g 'yesterday, 3:45'
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public String combineDateAndTime(String relativeDateString, String timeString) {
return this.combinedDateAndTime.format(
* Returns a copy of the NumberFormat this object is using.
*
* @draft ICU 53
- * @provisional
+ * @provisional This API might change or be removed in a future release.
*/
public NumberFormat getNumberFormat() {
// This class is thread-safe, yet numberFormat is not. To ensure thread-safety of this
/**
* Constants from UAX 31 for use in setRestrictionLevel.
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
public enum RestrictionLevel {
/**
* Only ASCII characters: U+0000..U+007F
*
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
ASCII,
/**
* All characters in each identifier must be from a single script.
*
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
- SINGLE_SCRIPT_RESTRICTIVE,
+ SINGLE_SCRIPT_RESTRICTIVE,
/**
* All characters in each identifier must be from a single script, or from the combinations: Latin + Han +
* Hiragana + Katakana; Latin + Han + Bopomofo; or Latin + Han + Hangul. Note that this level will satisfy the
* vast majority of Latin-script users; also that TR36 has ASCII instead of Latin.
*
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
HIGHLY_RESTRICTIVE,
/**
* Allow Latin with other scripts except Cyrillic, Greek, Cherokee Otherwise, the same as Highly Restrictive
*
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
MODERATELY_RESTRICTIVE,
/**
* Moderately Restrictive
*
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
MINIMALLY_RESTRICTIVE,
/**
* Any valid identifiers, including characters outside of the Identifier Profile, such as I♥NY.org
*
* @draft ICU 53
+ * @provisional This API might change or be removed in a future release.
*/
UNRESTRICTIVE
}
/**
* Constant for full name style format.
* For example, the full name for "hour" in English is "hour" or "hours".
- * @stable ICU 4.2
+ * @deprecated ICU 53 see {@link MeasureFormat.FormatWidth}
*/
+ @Deprecated
public static final int FULL_NAME = 0;
/**
* Constant for abbreviated name style format.
* For example, the abbreviated name for "hour" in English is "hr" or "hrs".
- * @stable ICU 4.2
+ * @deprecated ICU 53 see {@link MeasureFormat.FormatWidth}
*/
+ @Deprecated
public static final int ABBREVIATED_NAME = 1;
private static final int TOTAL_STYLES = 2;
/**
* Create empty format using full name style, for example, "hours".
* Use setLocale and/or setFormat to modify.
- * @stable ICU 4.0
+ * @deprecated ICU 53 use {@link MeasureFormat} instead.
*/
+ @Deprecated
public TimeUnitFormat() {
mf = MeasureFormat.getInstance(ULocale.getDefault(), FormatWidth.WIDE);
isReady = false;
/**
* Create TimeUnitFormat given a ULocale, and using full name style.
* @param locale locale of this time unit formatter.
- * @stable ICU 4.0
+ * @deprecated ICU 53 use {@link MeasureFormat} instead.
*/
+ @Deprecated
public TimeUnitFormat(ULocale locale) {
this(locale, FULL_NAME);
}
/**
* Create TimeUnitFormat given a Locale, and using full name style.
* @param locale locale of this time unit formatter.
- * @stable ICU 4.0
+ * @deprecated ICU 53 use {@link MeasureFormat} instead.
*/
+ @Deprecated
public TimeUnitFormat(Locale locale) {
this(locale, FULL_NAME);
}
* @param style format style, either FULL_NAME or ABBREVIATED_NAME style.
* @throws IllegalArgumentException if the style is not FULL_NAME or
* ABBREVIATED_NAME style.
- * @stable ICU 4.2
+ * @deprecated ICU 53 use {@link MeasureFormat} instead.
*/
+ @Deprecated
public TimeUnitFormat(ULocale locale, int style) {
if (style < FULL_NAME || style >= TOTAL_STYLES) {
throw new IllegalArgumentException("style should be either FULL_NAME or ABBREVIATED_NAME style");
/**
* Create TimeUnitFormat given a Locale and a formatting style.
- * @stable ICU 4.2
+ * @deprecated ICU 53 use {@link MeasureFormat} instead.
*/
+ @Deprecated
public TimeUnitFormat(Locale locale, int style) {
this(ULocale.forLocale(locale), style);
}
* Set the locale used for formatting or parsing.
* @param locale locale of this time unit formatter.
* @return this, for chaining.
- * @stable ICU 4.0
+ * @deprecated ICU 53 see {@link MeasureFormat}.
*/
+ @Deprecated
public TimeUnitFormat setLocale(ULocale locale) {
if (locale != this.locale){
mf = mf.withLocale(locale);
* Set the locale used for formatting or parsing.
* @param locale locale of this time unit formatter.
* @return this, for chaining.
- * @stable ICU 4.0
+ * @deprecated ICU 53 see {@link MeasureFormat}.
*/
+ @Deprecated
public TimeUnitFormat setLocale(Locale locale) {
return setLocale(ULocale.forLocale(locale));
}
* {@link NumberFormat#getNumberInstance(ULocale)}.
* @param format the number formatter.
* @return this, for chaining.
- * @stable ICU 4.0
+ * @deprecated ICU 53 see {@link MeasureFormat}.
*/
+ @Deprecated
public TimeUnitFormat setNumberFormat(NumberFormat format) {
if (format == this.format) {
return this;
/**
* Format a TimeUnitAmount.
* @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
- * @stable ICU 4.0
+ * @deprecated ICU 53 see {@link MeasureFormat}.
*/
+ @Deprecated
public StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition pos) {
return mf.format(obj, toAppendTo, pos);
/**
* Parse a TimeUnitAmount.
* @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)
- * @stable ICU 4.0
+ * @deprecated ICU 53 see {@link MeasureFormat}.
*/
+ @Deprecated
@Override
public TimeUnitAmount parseObject(String source, ParsePosition pos) {
if (!isReady) {
for (TimeUnit timeUnit : timeUnitToCountToPatterns.keySet()) {
Map<String, Object[]> countToPattern = timeUnitToCountToPatterns.get(timeUnit);
for (Entry<String, Object[]> patternEntry : countToPattern.entrySet()) {
- String count = patternEntry.getKey();
- for (int styl = FULL_NAME; styl < TOTAL_STYLES; ++styl) {
- MessageFormat pattern = (MessageFormat)(patternEntry.getValue())[styl];
- pos.setErrorIndex(-1);
- pos.setIndex(oldPos);
- // see if we can parse
- Object parsed = pattern.parseObject(source, pos);
- if ( pos.getErrorIndex() != -1 || pos.getIndex() == oldPos ) {
- // nothing parsed
- continue;
- }
- Number temp = null;
- if ( ((Object[])parsed).length != 0 ) {
- // pattern with Number as beginning,
- // such as "{0} d".
- // check to make sure that the timeUnit is consistent
- Object tempObj = ((Object[])parsed)[0];
- if (tempObj instanceof Number) {
- temp = (Number) tempObj;
- } else {
- // Since we now format the number ourselves, parseObject will likely give us back a String for
- // the number. When this happens we must parse the formatted number ourselves.
- try {
- temp = format.parse(tempObj.toString());
- } catch (ParseException e) {
- continue;
+ String count = patternEntry.getKey();
+ for (int styl = FULL_NAME; styl < TOTAL_STYLES; ++styl) {
+ MessageFormat pattern = (MessageFormat) (patternEntry.getValue())[styl];
+ pos.setErrorIndex(-1);
+ pos.setIndex(oldPos);
+ // see if we can parse
+ Object parsed = pattern.parseObject(source, pos);
+ if (pos.getErrorIndex() != -1 || pos.getIndex() == oldPos) {
+ // nothing parsed
+ continue;
+ }
+ Number temp = null;
+ if (((Object[]) parsed).length != 0) {
+ // pattern with Number as beginning,
+ // such as "{0} d".
+ // check to make sure that the timeUnit is consistent
+ Object tempObj = ((Object[]) parsed)[0];
+ if (tempObj instanceof Number) {
+ temp = (Number) tempObj;
+ } else {
+ // Since we now format the number ourselves, parseObject will likely give us back a String
+ // for
+ // the number. When this happens we must parse the formatted number ourselves.
+ try {
+ temp = format.parse(tempObj.toString());
+ } catch (ParseException e) {
+ continue;
+ }
}
}
- }
- int parseDistance = pos.getIndex() - oldPos;
- if ( parseDistance > longestParseDistance ) {
- resultNumber = temp;
- resultTimeUnit = timeUnit;
- newPos = pos.getIndex();
- longestParseDistance = parseDistance;
- countOfLongestMatch = count;
+ int parseDistance = pos.getIndex() - oldPos;
+ if (parseDistance > longestParseDistance) {
+ resultNumber = temp;
+ resultTimeUnit = timeUnit;
+ newPos = pos.getIndex();
+ longestParseDistance = parseDistance;
+ countOfLongestMatch = count;
+ }
}
}
- }
}
- /* After find the longest match, parse the number.
- * Result number could be null for the pattern without number pattern.
- * such as unit pattern in Arabic.
- * When result number is null, use plural rule to set the number.
+ /*
+ * After find the longest match, parse the number. Result number could be null for the pattern without number
+ * pattern. such as unit pattern in Arabic. When result number is null, use plural rule to set the number.
*/
if (resultNumber == null && longestParseDistance != 0) {
// set the number using plurrual count
- if ( countOfLongestMatch.equals("zero") ) {
+ if (countOfLongestMatch.equals("zero")) {
resultNumber = Integer.valueOf(0);
- } else if ( countOfLongestMatch.equals("one") ) {
+ } else if (countOfLongestMatch.equals("one")) {
resultNumber = Integer.valueOf(1);
- } else if ( countOfLongestMatch.equals("two") ) {
+ } else if (countOfLongestMatch.equals("two")) {
resultNumber = Integer.valueOf(2);
} else {
// should not happen.
isReady = true;
}
- private void setup(String resourceKey, Map<TimeUnit, Map<String, Object[]>> timeUnitToCountToPatterns,
- int style, Set<String> pluralKeywords) {
-// fill timeUnitToCountToPatterns from resource file
-try {
- ICUResourceBundle resource = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, locale);
- ICUResourceBundle unitsRes = resource.getWithFallback(resourceKey);
- int size = unitsRes.getSize();
- for ( int index = 0; index < size; ++index) {
- String timeUnitName = unitsRes.get(index).getKey();
- TimeUnit timeUnit = null;
- if ( timeUnitName.equals("year") ) {
- timeUnit = TimeUnit.YEAR;
- } else if ( timeUnitName.equals("month") ) {
- timeUnit = TimeUnit.MONTH;
- } else if ( timeUnitName.equals("day") ) {
- timeUnit = TimeUnit.DAY;
- } else if ( timeUnitName.equals("hour") ) {
- timeUnit = TimeUnit.HOUR;
- } else if ( timeUnitName.equals("minute") ) {
- timeUnit = TimeUnit.MINUTE;
- } else if ( timeUnitName.equals("second") ) {
- timeUnit = TimeUnit.SECOND;
- } else if ( timeUnitName.equals("week") ) {
- timeUnit = TimeUnit.WEEK;
- } else {
- continue;
- }
- ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(timeUnitName);
- int count = oneUnitRes.getSize();
- Map<String, Object[]> countToPatterns = timeUnitToCountToPatterns.get(timeUnit);
- if (countToPatterns == null) {
- countToPatterns = new TreeMap<String, Object[]>();
- timeUnitToCountToPatterns.put(timeUnit, countToPatterns);
- }
- for ( int pluralIndex = 0; pluralIndex < count; ++pluralIndex) {
- String pluralCount = oneUnitRes.get(pluralIndex).getKey();
- if (!pluralKeywords.contains(pluralCount))
- continue;
- String pattern = oneUnitRes.get(pluralIndex).getString();
- final MessageFormat messageFormat = new MessageFormat(pattern, locale);
- // save both full name and abbreviated name in one table
- // is good space-wise, but it degrades performance,
- // since it needs to check whether the needed space
- // is already allocated or not.
- Object[] pair = countToPatterns.get(pluralCount);
- if (pair == null) {
- pair = new Object[2];
- countToPatterns.put(pluralCount, pair);
- }
- pair[style] = messageFormat;
- }
- }
-} catch ( MissingResourceException e ) {
-}
-// there should be patterns for each plural rule in each time unit.
-// For each time unit,
-// for each plural rule, following is unit pattern fall-back rule:
-// ( for example: "one" hour )
-// look for its unit pattern in its locale tree.
-// if pattern is not found in its own locale, such as de_DE,
-// look for the pattern in its parent, such as de,
-// keep looking till found or till root.
-// if the pattern is not found in root either,
-// fallback to plural count "other",
-// look for the pattern of "other" in the locale tree:
-// "de_DE" to "de" to "root".
-// If not found, fall back to value of
-// static variable DEFAULT_PATTERN_FOR_xxx, such as "{0} h".
-//
-// Following is consistency check to create pattern for each
-// plural rule in each time unit using above fall-back rule.
-//
-final TimeUnit[] timeUnits = TimeUnit.values();
-Set<String> keywords = pluralRules.getKeywords();
-for ( int i = 0; i < timeUnits.length; ++i ) {
- // for each time unit,
- // get all the patterns for each plural rule in this locale.
- final TimeUnit timeUnit = timeUnits[i];
- Map<String, Object[]> countToPatterns = timeUnitToCountToPatterns.get(timeUnit);
- if (countToPatterns == null) {
- countToPatterns = new TreeMap<String, Object[]>();
- timeUnitToCountToPatterns.put(timeUnit, countToPatterns);
- }
- for (String pluralCount : keywords) {
- if ( countToPatterns.get(pluralCount) == null ||
- countToPatterns.get(pluralCount)[style] == null ) {
- // look through parents
- searchInTree(resourceKey, style, timeUnit, pluralCount, pluralCount, countToPatterns);
- }
- }
-}
-}
-// srcPluralCount is the original plural count on which the pattern is
-// searched for.
-// searchPluralCount is the fallback plural count.
-// For example, to search for pattern for ""one" hour",
-// "one" is the srcPluralCount,
-// if the pattern is not found even in root, fallback to
-// using patterns of plural count "other",
-// then, "other" is the searchPluralCount.
-private void searchInTree(String resourceKey, int styl,
- TimeUnit timeUnit, String srcPluralCount,
- String searchPluralCount, Map<String, Object[]> countToPatterns) {
-ULocale parentLocale=locale;
-String srcTimeUnitName = timeUnit.toString();
-while ( parentLocale != null ) {
- try {
- // look for pattern for srcPluralCount in locale tree
- ICUResourceBundle unitsRes = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, parentLocale);
- unitsRes = unitsRes.getWithFallback(resourceKey);
- ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(srcTimeUnitName);
- String pattern = oneUnitRes.getStringWithFallback(searchPluralCount);
- final MessageFormat messageFormat = new MessageFormat(pattern, locale);
- Object[] pair = countToPatterns.get(srcPluralCount);
- if (pair == null) {
- pair = new Object[2];
- countToPatterns.put(srcPluralCount, pair);
- }
- pair[styl] = messageFormat;
- return;
- } catch ( MissingResourceException e ) {
- }
- parentLocale=parentLocale.getFallback();
-}
-// if no unitsShort resource was found even after fallback to root locale
-// then search the units resource fallback from the current level to root
-if ( parentLocale == null && resourceKey.equals("unitsShort") ) {
- searchInTree("units", styl, timeUnit, srcPluralCount, searchPluralCount, countToPatterns);
- if ( countToPatterns != null &&
- countToPatterns.get(srcPluralCount) != null &&
- countToPatterns.get(srcPluralCount)[styl] != null ) {
- return;
- }
-}
-// if not found the pattern for this plural count at all,
-// fall-back to plural count "other"
-if ( searchPluralCount.equals("other") ) {
- // set default fall back the same as the resource in root
- MessageFormat messageFormat = null;
- if ( timeUnit == TimeUnit.SECOND ) {
- messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_SECOND, locale);
- } else if ( timeUnit == TimeUnit.MINUTE ) {
- messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MINUTE, locale);
- } else if ( timeUnit == TimeUnit.HOUR ) {
- messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_HOUR, locale);
- } else if ( timeUnit == TimeUnit.WEEK ) {
- messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_WEEK, locale);
- } else if ( timeUnit == TimeUnit.DAY ) {
- messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_DAY, locale);
- } else if ( timeUnit == TimeUnit.MONTH ) {
- messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MONTH, locale);
- } else if ( timeUnit == TimeUnit.YEAR ) {
- messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_YEAR, locale);
- }
- Object[] pair = countToPatterns.get(srcPluralCount);
- if (pair == null) {
- pair = new Object[2];
- countToPatterns.put(srcPluralCount, pair);
- }
- pair[styl] = messageFormat;
-} else {
- // fall back to rule "other", and search in parents
- searchInTree(resourceKey, styl, timeUnit, srcPluralCount, "other", countToPatterns);
-}
-}
+ private void setup(String resourceKey, Map<TimeUnit, Map<String, Object[]>> timeUnitToCountToPatterns, int style,
+ Set<String> pluralKeywords) {
+ // fill timeUnitToCountToPatterns from resource file
+ try {
+ ICUResourceBundle resource = (ICUResourceBundle) UResourceBundle.getBundleInstance(
+ ICUResourceBundle.ICU_BASE_NAME, locale);
+ ICUResourceBundle unitsRes = resource.getWithFallback(resourceKey);
+ int size = unitsRes.getSize();
+ for (int index = 0; index < size; ++index) {
+ String timeUnitName = unitsRes.get(index).getKey();
+ TimeUnit timeUnit = null;
+ if (timeUnitName.equals("year")) {
+ timeUnit = TimeUnit.YEAR;
+ } else if (timeUnitName.equals("month")) {
+ timeUnit = TimeUnit.MONTH;
+ } else if (timeUnitName.equals("day")) {
+ timeUnit = TimeUnit.DAY;
+ } else if (timeUnitName.equals("hour")) {
+ timeUnit = TimeUnit.HOUR;
+ } else if (timeUnitName.equals("minute")) {
+ timeUnit = TimeUnit.MINUTE;
+ } else if (timeUnitName.equals("second")) {
+ timeUnit = TimeUnit.SECOND;
+ } else if (timeUnitName.equals("week")) {
+ timeUnit = TimeUnit.WEEK;
+ } else {
+ continue;
+ }
+ ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(timeUnitName);
+ int count = oneUnitRes.getSize();
+ Map<String, Object[]> countToPatterns = timeUnitToCountToPatterns.get(timeUnit);
+ if (countToPatterns == null) {
+ countToPatterns = new TreeMap<String, Object[]>();
+ timeUnitToCountToPatterns.put(timeUnit, countToPatterns);
+ }
+ for (int pluralIndex = 0; pluralIndex < count; ++pluralIndex) {
+ String pluralCount = oneUnitRes.get(pluralIndex).getKey();
+ if (!pluralKeywords.contains(pluralCount))
+ continue;
+ String pattern = oneUnitRes.get(pluralIndex).getString();
+ final MessageFormat messageFormat = new MessageFormat(pattern, locale);
+ // save both full name and abbreviated name in one table
+ // is good space-wise, but it degrades performance,
+ // since it needs to check whether the needed space
+ // is already allocated or not.
+ Object[] pair = countToPatterns.get(pluralCount);
+ if (pair == null) {
+ pair = new Object[2];
+ countToPatterns.put(pluralCount, pair);
+ }
+ pair[style] = messageFormat;
+ }
+ }
+ } catch (MissingResourceException e) {
+ }
+ // there should be patterns for each plural rule in each time unit.
+ // For each time unit,
+ // for each plural rule, following is unit pattern fall-back rule:
+ // ( for example: "one" hour )
+ // look for its unit pattern in its locale tree.
+ // if pattern is not found in its own locale, such as de_DE,
+ // look for the pattern in its parent, such as de,
+ // keep looking till found or till root.
+ // if the pattern is not found in root either,
+ // fallback to plural count "other",
+ // look for the pattern of "other" in the locale tree:
+ // "de_DE" to "de" to "root".
+ // If not found, fall back to value of
+ // static variable DEFAULT_PATTERN_FOR_xxx, such as "{0} h".
+ //
+ // Following is consistency check to create pattern for each
+ // plural rule in each time unit using above fall-back rule.
+ //
+ final TimeUnit[] timeUnits = TimeUnit.values();
+ Set<String> keywords = pluralRules.getKeywords();
+ for (int i = 0; i < timeUnits.length; ++i) {
+ // for each time unit,
+ // get all the patterns for each plural rule in this locale.
+ final TimeUnit timeUnit = timeUnits[i];
+ Map<String, Object[]> countToPatterns = timeUnitToCountToPatterns.get(timeUnit);
+ if (countToPatterns == null) {
+ countToPatterns = new TreeMap<String, Object[]>();
+ timeUnitToCountToPatterns.put(timeUnit, countToPatterns);
+ }
+ for (String pluralCount : keywords) {
+ if (countToPatterns.get(pluralCount) == null || countToPatterns.get(pluralCount)[style] == null) {
+ // look through parents
+ searchInTree(resourceKey, style, timeUnit, pluralCount, pluralCount, countToPatterns);
+ }
+ }
+ }
+ }
+
+ // srcPluralCount is the original plural count on which the pattern is
+ // searched for.
+ // searchPluralCount is the fallback plural count.
+ // For example, to search for pattern for ""one" hour",
+ // "one" is the srcPluralCount,
+ // if the pattern is not found even in root, fallback to
+ // using patterns of plural count "other",
+ // then, "other" is the searchPluralCount.
+ private void searchInTree(String resourceKey, int styl, TimeUnit timeUnit, String srcPluralCount,
+ String searchPluralCount, Map<String, Object[]> countToPatterns) {
+ ULocale parentLocale = locale;
+ String srcTimeUnitName = timeUnit.toString();
+ while (parentLocale != null) {
+ try {
+ // look for pattern for srcPluralCount in locale tree
+ ICUResourceBundle unitsRes = (ICUResourceBundle) UResourceBundle.getBundleInstance(
+ ICUResourceBundle.ICU_BASE_NAME, parentLocale);
+ unitsRes = unitsRes.getWithFallback(resourceKey);
+ ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(srcTimeUnitName);
+ String pattern = oneUnitRes.getStringWithFallback(searchPluralCount);
+ final MessageFormat messageFormat = new MessageFormat(pattern, locale);
+ Object[] pair = countToPatterns.get(srcPluralCount);
+ if (pair == null) {
+ pair = new Object[2];
+ countToPatterns.put(srcPluralCount, pair);
+ }
+ pair[styl] = messageFormat;
+ return;
+ } catch (MissingResourceException e) {
+ }
+ parentLocale = parentLocale.getFallback();
+ }
+ // if no unitsShort resource was found even after fallback to root locale
+ // then search the units resource fallback from the current level to root
+ if (parentLocale == null && resourceKey.equals("unitsShort")) {
+ searchInTree("units", styl, timeUnit, srcPluralCount, searchPluralCount, countToPatterns);
+ if (countToPatterns != null && countToPatterns.get(srcPluralCount) != null
+ && countToPatterns.get(srcPluralCount)[styl] != null) {
+ return;
+ }
+ }
+ // if not found the pattern for this plural count at all,
+ // fall-back to plural count "other"
+ if (searchPluralCount.equals("other")) {
+ // set default fall back the same as the resource in root
+ MessageFormat messageFormat = null;
+ if (timeUnit == TimeUnit.SECOND) {
+ messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_SECOND, locale);
+ } else if (timeUnit == TimeUnit.MINUTE) {
+ messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MINUTE, locale);
+ } else if (timeUnit == TimeUnit.HOUR) {
+ messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_HOUR, locale);
+ } else if (timeUnit == TimeUnit.WEEK) {
+ messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_WEEK, locale);
+ } else if (timeUnit == TimeUnit.DAY) {
+ messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_DAY, locale);
+ } else if (timeUnit == TimeUnit.MONTH) {
+ messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MONTH, locale);
+ } else if (timeUnit == TimeUnit.YEAR) {
+ messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_YEAR, locale);
+ }
+ Object[] pair = countToPatterns.get(srcPluralCount);
+ if (pair == null) {
+ pair = new Object[2];
+ countToPatterns.put(srcPluralCount, pair);
+ }
+ pair[styl] = messageFormat;
+ } else {
+ // fall back to rule "other", and search in parents
+ searchInTree(resourceKey, styl, timeUnit, srcPluralCount, "other", countToPatterns);
+ }
+ }
// boilerplate code to make TimeUnitFormat otherwise follow the contract of
// MeasureFormat
/**
- * @draft ICU 53
- * @provisional
+ * @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
@Override
public StringBuilder formatMeasures(
StringBuilder appendTo, FieldPosition fieldPosition, Measure... measures) {
}
/**
- * @draft ICU 53
- * @provisional
+ * @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
@Override
public MeasureFormat.FormatWidth getWidth() {
return mf.getWidth();
}
/**
- * @draft ICU 53
- * @provisional
+ * @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
@Override
public NumberFormat getNumberFormat() {
return mf.getNumberFormat();
}
/**
- * @draft ICU 53
- * @provisional
+ * @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
@Override
public Object clone() {
TimeUnitFormat result = (TimeUnitFormat) super.clone();
/*
*******************************************************************************
- * Copyright (C) 2011-2013, International Business Machines Corporation and *
+ * Copyright (C) 2011-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
/**
* Short localized GMT offset format, such as "GMT-5", "UTC+1:30"
* This style is equivalent to the LDML date format pattern "O".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
LOCALIZED_GMT_SHORT (0x0040),
/**
* Short ISO 8601 local time difference (basic format) or the UTC indicator.
* For example, "-05", "+0530", and "Z"(UTC).
* This style is equivalent to the LDML date format pattern "X".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_BASIC_SHORT (ISO_Z_STYLE_FLAG),
/**
* Short ISO 8601 locale time difference (basic format).
* For example, "-05" and "+0530".
* This style is equivalent to the LDML date format pattern "x".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_BASIC_LOCAL_SHORT (ISO_LOCAL_STYLE_FLAG),
/**
* Fixed width ISO 8601 local time difference (basic format) or the UTC indicator.
* For example, "-0500", "+0530", and "Z"(UTC).
* This style is equivalent to the LDML date format pattern "XX".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_BASIC_FIXED (ISO_Z_STYLE_FLAG),
/**
* Fixed width ISO 8601 local time difference (basic format).
* For example, "-0500" and "+0530".
* This style is equivalent to the LDML date format pattern "xx".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_BASIC_LOCAL_FIXED (ISO_LOCAL_STYLE_FLAG),
/**
* ISO 8601 local time difference (basic format) with optional seconds field, or the UTC indicator.
* For example, "-0500", "+052538", and "Z"(UTC).
* This style is equivalent to the LDML date format pattern "XXXX".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_BASIC_FULL (ISO_Z_STYLE_FLAG),
/**
* ISO 8601 local time difference (basic format) with optional seconds field.
* For example, "-0500" and "+052538".
* This style is equivalent to the LDML date format pattern "xxxx".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_BASIC_LOCAL_FULL (ISO_LOCAL_STYLE_FLAG),
/**
* Fixed width ISO 8601 local time difference (extended format) or the UTC indicator.
* For example, "-05:00", "+05:30", and "Z"(UTC).
* This style is equivalent to the LDML date format pattern "XXX".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_EXTENDED_FIXED (ISO_Z_STYLE_FLAG),
/**
* Fixed width ISO 8601 local time difference (extended format).
* For example, "-05:00" and "+05:30".
* This style is equivalent to the LDML date format pattern "xxx" and "ZZZZZ".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_EXTENDED_LOCAL_FIXED (ISO_LOCAL_STYLE_FLAG),
/**
* ISO 8601 local time difference (extended format) with optional seconds field, or the UTC indicator.
* For example, "-05:00", "+05:25:38", and "Z"(UTC).
* This style is equivalent to the LDML date format pattern "XXXXX".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_EXTENDED_FULL (ISO_Z_STYLE_FLAG),
/**
* ISO 8601 local time difference (extended format) with optional seconds field.
* For example, "-05:00" and "+05:25:38".
* This style is equivalent to the LDML date format pattern "xxxxx".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ISO_EXTENDED_LOCAL_FULL (ISO_LOCAL_STYLE_FLAG),
/**
* Time Zone ID, such as "America/Los_Angeles".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ZONE_ID (0x0200),
/**
* Short Time Zone ID (BCP 47 Unicode location extension, time zone type value), such as "uslax".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
ZONE_ID_SHORT (0x0400),
/**
* Exemplar location, such as "Los Angeles" and "Paris".
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
EXEMPLAR_LOCATION (0x0800);
* @see TimeZoneFormat#getGMTOffsetPattern(GMTOffsetPatternType)
* @see TimeZoneFormat#setGMTOffsetPattern(GMTOffsetPatternType, String)
* @stable ICU 49
- * @provisional This API might change or be removed in a future release.
*/
public enum GMTOffsetPatternType {
/**
NEGATIVE_HMS ("-H:mm:ss", "Hms", false),
/**
* Positive offset with hours field
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
POSITIVE_H ("+H", "H", true),
/**
* Negative offset with hours field
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
NEGATIVE_H ("-H", "H", false);
* (-24 hours < offset < +24 hours).
* @see #formatOffsetISO8601Extended(int, boolean, boolean, boolean)
* @see #parseOffsetISO8601(String, ParsePosition)
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public final String formatOffsetISO8601Basic(int offset, boolean useUtcIndicator, boolean isShort, boolean ignoreSeconds) {
return formatOffsetISO8601(offset, true, useUtcIndicator, isShort, ignoreSeconds);
* (-24 hours < offset < +24 hours).
* @see #formatOffsetISO8601Basic(int, boolean, boolean, boolean)
* @see #parseOffsetISO8601(String, ParsePosition)
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public final String formatOffsetISO8601Extended(int offset, boolean useUtcIndicator, boolean isShort, boolean ignoreSeconds) {
return formatOffsetISO8601(offset, false, useUtcIndicator, isShort, ignoreSeconds);
* @see #parseOffsetLocalizedGMT(String, ParsePosition)
* @throws IllegalArgumentException if the specified offset is out of supported range
* (-24 hours < offset < +24 hours).
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public String formatOffsetShortLocalizedGMT(int offset) {
return formatOffsetLocalizedGMT(offset, true);
* @return the offset from GMT(UTC) in milliseconds for the given short localized GMT
* offset format string.
* @see #formatOffsetShortLocalizedGMT(int)
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
public int parseOffsetShortLocalizedGMT(String text, ParsePosition pos) {
return parseOffsetLocalizedGMT(text, pos, true, null);
/*
*******************************************************************************
- * Copyright (C) 2011-2013, International Business Machines Corporation and *
+ * Copyright (C) 2011-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
/**
* Exemplar location name, such as "Los Angeles".
*
- * @draft ICU 51
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 51
*/
EXEMPLAR_LOCATION,
}
* @return A collection of matches.
* @see NameType
* @see MatchInfo
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
public Collection<MatchInfo> find(CharSequence text, int start, EnumSet<NameType> types) {
/**
* A <code>MatchInfo</code> represents a time zone name match used by
* {@link TimeZoneNames#find(CharSequence, int, EnumSet)}.
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
public static class MatchInfo {
* or 2) both <code>tzID</code> and <code>mzID</code> are <code>null</code>,
* or 3) <code>matchLength</code> is 0 or smaller.
* @see NameType
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
public MatchInfo(NameType nameType, String tzID, String mzID, int matchLength) {
*
* @return the time zone ID, or <code>null</code>.
* @see #mzID()
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
public String tzID() {
*
* @return the meta zone ID, or <code>null</code>.
* @see #tzID()
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
public String mzID() {
* Returns the time zone name type.
* @return the time zone name type enum.
* @see NameType
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
public NameType nameType() {
/**
* Returns the match length.
* @return the match length.
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
public int matchLength() {
/**
* Sole constructor for invocation by subclass constructors.
*
- * @draft ICU 49
+ * @draft ICU 49 (Retain)
* @provisional This API might change or be removed in a future release.
*/
protected TimeZoneNames() {