ICU-10763 ICU4J 53 API status updates.

X-SVN-Rev: 35452
This commit is contained in:
Yoshito Umaoka 2014-03-13 04:45:07 +00:00
parent 21d28f0945
commit 3a18f04d94
21 changed files with 631 additions and 491 deletions

View File

@ -2,11 +2,11 @@
<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>
@ -40,10 +40,13 @@ RuleBasedBreakIterator
<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>
@ -75,18 +78,39 @@ TimeUnit
<hr/>
<h2>Deprecated or Obsoleted in ICU4J 53.0.1</h2>
<p>(no API obsoleted)</p>
<hr/>
<h2>Changed in ICU4J 53.0.1 (old, new)</h2>
<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.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>
@ -94,18 +118,55 @@ TimeUnitFormat
<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&lt;V&gt; <i>buildImmutableIndex</i>()</li>
</ul>
AlphabeticIndex.Bucket.LabelType
<ul>
<li><span style='color:green'>(stable)</span> public static final AlphabeticIndex.Bucket.LabelType INFLOW</li>
@ -113,11 +174,99 @@ AlphabeticIndex.Bucket.LabelType
<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>
@ -127,6 +276,8 @@ AlphabeticIndex.Bucket.LabelType
<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>
@ -140,6 +291,12 @@ BreakIterator
<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>
@ -151,17 +308,25 @@ DateFormat
</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>
@ -176,6 +341,7 @@ MeasureFormat.FormatWidth
</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>
@ -213,19 +379,46 @@ RelativeDateTimeFormatter.RelativeUnit
<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>
@ -290,6 +483,6 @@ ULocale
</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>

View File

@ -164,8 +164,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
*
* @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;
@ -180,8 +179,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
* 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();
@ -193,8 +191,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
*
* @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);
@ -205,8 +202,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
*
* @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()) {
@ -218,8 +214,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
/**
* {@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();
@ -259,8 +254,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
* 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);
@ -615,8 +609,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
* 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.

View File

@ -1431,6 +1431,7 @@ public final class RuleBasedCollator extends Collator {
/**
* {@inheritDoc}
* @stable ICU 2.8
*/
@Override
public boolean equals(Object obj) {
@ -1868,6 +1869,8 @@ public final class RuleBasedCollator extends Collator {
/**
* {@inheritDoc}
* @draft ICU 53 (retain)
* @provisional This API might change or be removed in a future release.
*/
@Override
public ULocale getLocale(ULocale.Type type) {

View File

@ -118,23 +118,13 @@ import com.ibm.icu.util.ULocale;
* @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_;

View File

@ -1360,44 +1360,37 @@ public final class UScript {
* 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
}
@ -1410,8 +1403,7 @@ public final class UScript {
*
* @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;
@ -1428,8 +1420,7 @@ public final class UScript {
* @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];
@ -1441,8 +1432,7 @@ public final class UScript {
*
* @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;
@ -1455,8 +1445,7 @@ public final class UScript {
*
* @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;
@ -1468,8 +1457,7 @@ public final class UScript {
*
* @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;

View File

@ -66,20 +66,17 @@ public class CompactDecimalFormat extends DecimalFormat {
/**
* 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
}

View File

@ -45,8 +45,7 @@ class CurrencyFormat extends MeasureFormat {
}
/**
* @draft ICU 53
* @provisional
* {@inheritDoc}
*/
@Override
public Object clone() {
@ -82,8 +81,7 @@ class CurrencyFormat extends MeasureFormat {
// MeasureFormat
/**
* @draft ICU 53
* @provisional
* {@inheritDoc}
*/
@Override
public StringBuilder formatMeasures(
@ -92,8 +90,7 @@ class CurrencyFormat extends MeasureFormat {
}
/**
* @draft ICU 53
* @provisional
* {@inheritDoc}
*/
@Override
public MeasureFormat.FormatWidth getWidth() {
@ -101,8 +98,7 @@ class CurrencyFormat extends MeasureFormat {
}
/**
* @draft ICU 53
* @provisional
* {@inheritDoc}
*/
@Override
public NumberFormat getNumberFormat() {

View File

@ -190,8 +190,7 @@ public class CurrencyMetaInfo {
/**
* 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);
@ -205,8 +204,7 @@ public class CurrencyMetaInfo {
* 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);
@ -215,8 +213,7 @@ public class CurrencyMetaInfo {
/**
* 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();
@ -275,8 +272,7 @@ public class CurrencyMetaInfo {
* 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);
@ -290,8 +286,7 @@ public class CurrencyMetaInfo {
* 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);
@ -300,8 +295,7 @@ public class CurrencyMetaInfo {
/**
* 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);
@ -491,8 +485,7 @@ public class CurrencyMetaInfo {
/**
* 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;

View File

@ -414,8 +414,7 @@ public abstract class DateFormat extends UFormat {
* 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;
@ -424,8 +423,7 @@ public abstract class DateFormat extends UFormat {
* 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;
@ -434,8 +432,7 @@ public abstract class DateFormat extends UFormat {
* 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;
@ -452,28 +449,33 @@ public abstract class DateFormat extends UFormat {
* 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
};
@ -1536,6 +1538,7 @@ public abstract class DateFormat extends UFormat {
* @param lenient when true, Calendar parsing is lenient
* @see com.ibm.icu.util.Calendar#setLenient
* @draft ICU 53
* @provisional This API might change or be removed in a future release.
*/
public void setCalendarLenient(boolean lenient)
{
@ -1546,6 +1549,7 @@ public abstract class DateFormat extends UFormat {
/**
* Returns whether date/time parsing in the encapsulated Calendar object is lenient.
* @draft ICU 53
* @provisional This API might change or be removed in a future release.
*/
public boolean isCalendarLenient()
{
@ -1558,6 +1562,7 @@ public abstract class DateFormat extends UFormat {
*
* @see BooleanAttribute
* @draft ICU 53
* @provisional This API might change or be removed in a future release.
*/
public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value)
{
@ -1580,6 +1585,7 @@ public abstract class DateFormat extends UFormat {
*
* @see BooleanAttribute
* @draft ICU 53
* @provisional This API might change or be removed in a future release.
*/
public boolean getBooleanAttribute(BooleanAttribute key)
{

View File

@ -125,8 +125,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/**
* {@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;

View File

@ -876,6 +876,7 @@ public class DateIntervalFormat extends UFormat {
* 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()
{
@ -894,6 +895,7 @@ public class DateIntervalFormat extends UFormat {
* 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)
{

View File

@ -5284,8 +5284,7 @@ public class DecimalFormat extends NumberFormat {
* 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) {
@ -5296,9 +5295,8 @@ public class DecimalFormat extends NumberFormat {
/**
* 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;

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2012, International Business Machines Corporation and *
* Copyright (C) 2012-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -9,8 +9,7 @@ package com.ibm.icu.text;
/**
* 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 {
/**
@ -21,16 +20,14 @@ 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),
/**
@ -40,32 +37,28 @@ public enum DisplayContext {
/**
* 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),
/**
@ -73,28 +66,24 @@ public enum DisplayContext {
* 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
}
@ -108,8 +97,7 @@ public enum DisplayContext {
/**
* 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;
@ -117,8 +105,7 @@ public enum DisplayContext {
/**
* 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;

View File

@ -27,8 +27,7 @@ import com.ibm.icu.util.UResourceBundle;
* 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;
@ -133,8 +132,7 @@ final public class ListFormatter {
* @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);
@ -146,8 +144,7 @@ final public class ListFormatter {
* @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);
@ -171,8 +168,7 @@ final public class ListFormatter {
* 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));
@ -184,8 +180,7 @@ final public class ListFormatter {
* @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));
@ -197,8 +192,7 @@ final public class ListFormatter {
* @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

View File

@ -68,8 +68,7 @@ public abstract class LocaleDisplayNames {
* @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);
@ -95,8 +94,7 @@ public abstract class LocaleDisplayNames {
* 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);

View File

@ -148,7 +148,7 @@ public class MeasureFormat extends UFormat {
* 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.
@ -158,7 +158,7 @@ public class MeasureFormat extends UFormat {
* 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),
@ -166,7 +166,7 @@ public class MeasureFormat extends UFormat {
* 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),
@ -174,7 +174,7 @@ public class MeasureFormat extends UFormat {
* 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),
@ -184,7 +184,7 @@ public class MeasureFormat extends UFormat {
* 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);
@ -217,7 +217,7 @@ public class MeasureFormat extends UFormat {
* @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));
@ -231,7 +231,7 @@ public class MeasureFormat extends UFormat {
* @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);
@ -282,7 +282,7 @@ public class MeasureFormat extends UFormat {
* @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) {
@ -315,10 +315,11 @@ public class MeasureFormat extends UFormat {
}
/**
* 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) {
@ -337,7 +338,7 @@ public class MeasureFormat extends UFormat {
* @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(
@ -359,7 +360,7 @@ public class MeasureFormat extends UFormat {
* @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) {
@ -400,7 +401,7 @@ public class MeasureFormat extends UFormat {
* 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) {
@ -418,8 +419,9 @@ public class MeasureFormat extends UFormat {
}
/**
* {@inheritDoc}
* @draft ICU 53
* @provisional
* @provisional This API might change or be removed in a future release.
*/
@Override
public final int hashCode() {
@ -431,7 +433,7 @@ public class MeasureFormat extends UFormat {
/**
* 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;
@ -440,7 +442,7 @@ public class MeasureFormat extends UFormat {
/**
* 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);
@ -449,7 +451,7 @@ public class MeasureFormat extends UFormat {
/**
* 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();

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2013, International Business Machines Corporation and *
* Copyright (C) 2013-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -60,7 +60,7 @@ import com.ibm.icu.util.UResourceBundle;
* (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 {
@ -68,56 +68,56 @@ 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,
}
@ -125,91 +125,91 @@ public final class RelativeDateTimeFormatter {
/**
* 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,
}
@ -218,14 +218,14 @@ public final class RelativeDateTimeFormatter {
* 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,
@ -233,35 +233,35 @@ public final class RelativeDateTimeFormatter {
/**
* 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;
}
@ -269,7 +269,7 @@ public final class RelativeDateTimeFormatter {
/**
* 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());
@ -280,7 +280,7 @@ public final class RelativeDateTimeFormatter {
*
* @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);
@ -300,7 +300,7 @@ public final class RelativeDateTimeFormatter {
* @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);
@ -324,7 +324,7 @@ public final class RelativeDateTimeFormatter {
* @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) {
@ -349,7 +349,7 @@ public final class RelativeDateTimeFormatter {
* @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) {
@ -367,7 +367,7 @@ public final class RelativeDateTimeFormatter {
* @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(
@ -378,7 +378,7 @@ public final class RelativeDateTimeFormatter {
* 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

View File

@ -147,18 +147,21 @@ public class SpoofChecker {
/**
* 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,
/**
@ -167,12 +170,14 @@ public class SpoofChecker {
* 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,
/**
@ -180,12 +185,14 @@ public class SpoofChecker {
* 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 INY.org
*
* @draft ICU 53
* @provisional This API might change or be removed in a future release.
*/
UNRESTRICTIVE
}

View File

@ -65,14 +65,16 @@ public class TimeUnitFormat extends MeasureFormat {
/**
* 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;
@ -107,8 +109,9 @@ public class TimeUnitFormat extends MeasureFormat {
/**
* 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;
@ -118,8 +121,9 @@ public class TimeUnitFormat extends MeasureFormat {
/**
* 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);
}
@ -127,8 +131,9 @@ public class TimeUnitFormat extends MeasureFormat {
/**
* 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);
}
@ -139,8 +144,9 @@ public class TimeUnitFormat extends MeasureFormat {
* @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");
@ -164,8 +170,9 @@ public class TimeUnitFormat extends MeasureFormat {
/**
* 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);
}
@ -174,8 +181,9 @@ public class TimeUnitFormat extends MeasureFormat {
* 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);
@ -192,8 +200,9 @@ public class TimeUnitFormat extends MeasureFormat {
* 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));
}
@ -203,8 +212,9 @@ public class TimeUnitFormat extends MeasureFormat {
* {@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;
@ -228,8 +238,9 @@ public class TimeUnitFormat extends MeasureFormat {
/**
* 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);
@ -238,8 +249,9 @@ public class TimeUnitFormat extends MeasureFormat {
/**
* 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) {
@ -259,25 +271,26 @@ public class TimeUnitFormat extends MeasureFormat {
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];
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 ) {
if (pos.getErrorIndex() != -1 || pos.getIndex() == oldPos) {
// nothing parsed
continue;
}
Number temp = null;
if ( ((Object[])parsed).length != 0 ) {
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];
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
// 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());
@ -287,7 +300,7 @@ public class TimeUnitFormat extends MeasureFormat {
}
}
int parseDistance = pos.getIndex() - oldPos;
if ( parseDistance > longestParseDistance ) {
if (parseDistance > longestParseDistance) {
resultNumber = temp;
resultTimeUnit = timeUnit;
newPos = pos.getIndex();
@ -297,18 +310,17 @@ public class TimeUnitFormat extends MeasureFormat {
}
}
}
/* 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.
@ -348,29 +360,30 @@ public class TimeUnitFormat extends MeasureFormat {
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);
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) {
for (int index = 0; index < size; ++index) {
String timeUnitName = unitsRes.get(index).getKey();
TimeUnit timeUnit = null;
if ( timeUnitName.equals("year") ) {
if (timeUnitName.equals("year")) {
timeUnit = TimeUnit.YEAR;
} else if ( timeUnitName.equals("month") ) {
} else if (timeUnitName.equals("month")) {
timeUnit = TimeUnit.MONTH;
} else if ( timeUnitName.equals("day") ) {
} else if (timeUnitName.equals("day")) {
timeUnit = TimeUnit.DAY;
} else if ( timeUnitName.equals("hour") ) {
} else if (timeUnitName.equals("hour")) {
timeUnit = TimeUnit.HOUR;
} else if ( timeUnitName.equals("minute") ) {
} else if (timeUnitName.equals("minute")) {
timeUnit = TimeUnit.MINUTE;
} else if ( timeUnitName.equals("second") ) {
} else if (timeUnitName.equals("second")) {
timeUnit = TimeUnit.SECOND;
} else if ( timeUnitName.equals("week") ) {
} else if (timeUnitName.equals("week")) {
timeUnit = TimeUnit.WEEK;
} else {
continue;
@ -382,7 +395,7 @@ try {
countToPatterns = new TreeMap<String, Object[]>();
timeUnitToCountToPatterns.put(timeUnit, countToPatterns);
}
for ( int pluralIndex = 0; pluralIndex < count; ++pluralIndex) {
for (int pluralIndex = 0; pluralIndex < count; ++pluralIndex) {
String pluralCount = oneUnitRes.get(pluralIndex).getKey();
if (!pluralKeywords.contains(pluralCount))
continue;
@ -400,29 +413,29 @@ try {
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 ) {
} 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];
@ -432,31 +445,31 @@ for ( int i = 0; i < timeUnits.length; ++i ) {
timeUnitToCountToPatterns.put(timeUnit, countToPatterns);
}
for (String pluralCount : keywords) {
if ( countToPatterns.get(pluralCount) == null ||
countToPatterns.get(pluralCount)[style] == null ) {
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,
}
}
// 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 ) {
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);
ICUResourceBundle unitsRes = (ICUResourceBundle) UResourceBundle.getBundleInstance(
ICUResourceBundle.ICU_BASE_NAME, parentLocale);
unitsRes = unitsRes.getWithFallback(resourceKey);
ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(srcTimeUnitName);
String pattern = oneUnitRes.getStringWithFallback(searchPluralCount);
@ -468,38 +481,37 @@ while ( parentLocale != null ) {
}
pair[styl] = messageFormat;
return;
} catch ( MissingResourceException e ) {
} 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") ) {
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 ) {
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") ) {
}
// 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 ) {
if (timeUnit == TimeUnit.SECOND) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_SECOND, locale);
} else if ( timeUnit == TimeUnit.MINUTE ) {
} else if (timeUnit == TimeUnit.MINUTE) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MINUTE, locale);
} else if ( timeUnit == TimeUnit.HOUR ) {
} else if (timeUnit == TimeUnit.HOUR) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_HOUR, locale);
} else if ( timeUnit == TimeUnit.WEEK ) {
} else if (timeUnit == TimeUnit.WEEK) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_WEEK, locale);
} else if ( timeUnit == TimeUnit.DAY ) {
} else if (timeUnit == TimeUnit.DAY) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_DAY, locale);
} else if ( timeUnit == TimeUnit.MONTH ) {
} else if (timeUnit == TimeUnit.MONTH) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MONTH, locale);
} else if ( timeUnit == TimeUnit.YEAR ) {
} else if (timeUnit == TimeUnit.YEAR) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_YEAR, locale);
}
Object[] pair = countToPatterns.get(srcPluralCount);
@ -508,20 +520,21 @@ if ( searchPluralCount.equals("other") ) {
countToPatterns.put(srcPluralCount, pair);
}
pair[styl] = messageFormat;
} else {
} 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) {
@ -529,27 +542,30 @@ if ( searchPluralCount.equals("other") ) {
}
/**
* @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();

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2011-2013, International Business Machines Corporation and *
* Copyright (C) 2011-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -115,106 +115,92 @@ public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>
/**
* 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);
@ -231,7 +217,6 @@ public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>
* @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 {
/**
@ -256,14 +241,12 @@ public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>
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);
@ -731,8 +714,7 @@ public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>
* (-24 hours &lt; offset &lt; +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);
@ -751,8 +733,7 @@ public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>
* (-24 hours &lt; offset &lt; +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);
@ -798,8 +779,7 @@ public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>
* @see #parseOffsetLocalizedGMT(String, ParsePosition)
* @throws IllegalArgumentException if the specified offset is out of supported range
* (-24 hours &lt; offset &lt; +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);
@ -1016,8 +996,7 @@ public class TimeZoneFormat extends UFormat implements Freezable<TimeZoneFormat>
* @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);

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2011-2013, International Business Machines Corporation and *
* Copyright (C) 2011-2014, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -121,8 +121,7 @@ public abstract class TimeZoneNames implements Serializable {
/**
* 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,
}
@ -309,7 +308,7 @@ public abstract class TimeZoneNames implements Serializable {
* @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) {
@ -319,7 +318,7 @@ public abstract class TimeZoneNames implements Serializable {
/**
* 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 {
@ -339,7 +338,7 @@ public abstract class TimeZoneNames implements Serializable {
* 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) {
@ -366,7 +365,7 @@ public abstract class TimeZoneNames implements Serializable {
*
* @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() {
@ -381,7 +380,7 @@ public abstract class TimeZoneNames implements Serializable {
*
* @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() {
@ -392,7 +391,7 @@ public abstract class TimeZoneNames implements Serializable {
* 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() {
@ -402,7 +401,7 @@ public abstract class TimeZoneNames implements Serializable {
/**
* 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() {
@ -413,7 +412,7 @@ public abstract class TimeZoneNames implements Serializable {
/**
* 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() {