<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.collate.dir}/src">
- <include name="com/ibm/icu/**"/>
+ <include name="com/ibm/icu/text/**"/>
+ <include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.charset.dir}/src">
<include name="com/ibm/icu/charset/**"/>
</java>
</target>
- <target name="swatDeprecated" depends="build-tools" description="Convert @deprecated @draft tags to @provisional">
- <antcall target="_runSwatDeprecated">
- <param name="swat.deprecated.opt" value="-dep"/>
- </antcall>
- </target>
-
- <target name="swatProvisional" depends="build-tools" description="Convert @provisional tags to @deprecated @draft">
- <antcall target="_runSwatDeprecated">
- <param name="swat.deprecated.opt" value="-prov"/>
- </antcall>
- </target>
-
- <target name="_runSwatDeprecated">
- <java classname="com.ibm.icu.dev.tool.docs.SwatDeprecated"
- classpath="${icu4j.build-tools.jar}"
- failonerror="true">
- <arg value="${swat.deprecated.opt}"/>
- <arg value="-src"/>
- <arg value="${icu4j.core.dir}/src"/>
- <arg value="-dst"/>
- <arg value="${icu4j.core.dir}/src"/>
- <arg value="-overwrite"/>
- <arg value="-verbose"/>
- </java>
- <java classname="com.ibm.icu.dev.tool.docs.SwatDeprecated"
- classpath="${icu4j.build-tools.jar}"
- failonerror="true">
- <arg value="${swat.deprecated.opt}"/>
- <arg value="-src"/>
- <arg value="${icu4j.charset.dir}/src"/>
- <arg value="-dst"/>
- <arg value="${icu4j.charset.dir}/src"/>
- <arg value="-overwrite"/>
- <arg value="-verbose"/>
- </java>
- </target>
-
<target name="serialTestData" depends="main, tests">
<property name="serial.test.data.dir" value="${out.dir}/serialTestData"/>
<delete dir="${serial.test.data.dir}"/>
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public ULocale getLocale(ULocale.Type type) {
return ULocale.ROOT;
/**
* {@inheritDoc}
* @draft ICU 53 (retain)
- * @provisional This API might change or be removed in a future release.
*/
@Override
public ULocale getLocale(ULocale.Type type) {
* </ul>
*
* @draft ICU 3.6 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
//TODO:
/**
* Default constructor
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences(){}
/**
* Number Format type
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public static final int
NF_NUMBER = 0, // NumberFormat.NUMBERSTYLE
/**
* Date Format type
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public static final int
DF_FULL = DateFormat.FULL, // 0
/**
* For selecting a choice of display names
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public static final int
ID_LOCALE = 0,
/**
* Break iterator type
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public static final int
BI_CHARACTER = BreakIterator.KIND_CHARACTER, // 0
* for Breton first, then French if that fails.
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setLocales(List<ULocale> inputLocales) {
if (isFrozen()) {
*
* @return a copy of the language/locale priority list.
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public List<ULocale> getLocales() {
List<ULocale> result;
* @param index The index (0..n) of the desired item.
* @return desired item. null if index is out of range
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public ULocale getLocale(int index) {
List<ULocale> lcls = locales;
* @param uLocales list of locales in an array
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setLocales(ULocale[] uLocales) {
if (isFrozen()) {
* @param uLocale single locale
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setLocale(ULocale uLocale) {
if (isFrozen()) {
* Section 14.4 of the RFC 2616 (HTTP 1.1)
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setLocales(String acceptLanguageString) {
if (isFrozen()) {
* @return a resource bundle for the given base name and locale based on the
* language/locale priority list stored in this object
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public ResourceBundle getResourceBundle(String baseName) {
return getResourceBundle(baseName, null);
* @return a resource bundle for the given base name and locale based on the
* language/locale priority list stored in this object
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public ResourceBundle getResourceBundle(String baseName, ClassLoader loader) {
UResourceBundle urb = null;
* @param territory code
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setTerritory(String territory) {
if (isFrozen()) {
*
* @return territory code, explicit or implicit.
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public String getTerritory() {
if (territory == null) {
* @param currency Valid ISO 4217 currency code.
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setCurrency(Currency currency) {
if (isFrozen()) {
*
* @return currency code, explicit or implicit.
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public Currency getCurrency() {
if (currency == null) {
* @param calendar arbitrary calendar
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setCalendar(Calendar calendar) {
if (isFrozen()) {
*
* @return calendar explicit or implicit.
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public Calendar getCalendar() {
if (calendar == null) {
* @param timezone a valid TZID (see UTS#35).
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setTimeZone(TimeZone timezone) {
if (isFrozen()) {
*
* @return timezone, either implicitly or explicitly set
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public TimeZone getTimeZone() {
if (timezone == null) {
*
* @return collator explicit or implicit.
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public Collator getCollator() {
if (collator == null) {
* @param collator The collator object to be passed.
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setCollator(Collator collator) {
if (isFrozen()) {
* @param type break type - BI_CHARACTER or BI_WORD, BI_LINE, BI_SENTENCE, BI_TITLE
* @return break iterator explicit or implicit
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public BreakIterator getBreakIterator(int type) {
if (type < BI_CHARACTER || type >= BI_LIMIT) {
* @param iterator a break iterator
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setBreakIterator(int type, BreakIterator iterator) {
if (type < BI_CHARACTER || type >= BI_LIMIT) {
* @param type specifies the type of the ID: ID_LANGUAGE, etc.
* @return the display name
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public String getDisplayName(String id, int type) {
String result = id;
* @param format The date format
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setDateFormat(int dateStyle, int timeStyle, DateFormat format) {
if (isFrozen()) {
* @param timeStyle DF_FULL, DF_LONG, DF_MEDIUM, DF_SHORT or DF_NONE
* @return a DateFormat, according to the above description
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public DateFormat getDateFormat(int dateStyle, int timeStyle) {
if (dateStyle == DF_NONE && timeStyle == DF_NONE
*
* @param style NF_NUMBER, NF_CURRENCY, NF_PERCENT, NF_SCIENTIFIC, NF_INTEGER
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public NumberFormat getNumberFormat(int style) {
if (style < 0 || style >= NF_LIMIT) {
* @param format The number format
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences setNumberFormat(int style, NumberFormat format) {
if (isFrozen()) {
*
* @return this, for chaining
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
public GlobalizationPreferences reset() {
if (isFrozen()) {
*
* @param inputLocales The list of input locales
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected List<ULocale> processLocales(List<ULocale> inputLocales) {
// Note: Some of the callers, and non-ICU call sites, could be simpler/more efficient
* @param dateStyle
* @param timeStyle
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected DateFormat guessDateFormat(int dateStyle, int timeStyle) {
DateFormat result;
*
* @param style
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected NumberFormat guessNumberFormat(int style) {
NumberFormat result;
* This function can be overridden by subclasses to use different heuristics.
*
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected String guessTerritory() {
String result;
* This function can be overridden by subclasses to use different heuristics
*
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected Currency guessCurrency() {
return Currency.getInstance(new ULocale("und-" + getTerritory()));
* one whose modification will not affect this object.</b>
*
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected List<ULocale> guessLocales() {
if (implicitLocales == null) {
* one whose modification will not affect this object.</b>
*
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected Collator guessCollator() {
ULocale collLocale = getAvailableLocale(TYPE_COLLATOR);
*
* @param type
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected BreakIterator guessBreakIterator(int type) {
BreakIterator bitr = null;
* one whose modification will not affect this object.</b>
*
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected TimeZone guessTimeZone() {
// TODO fix using real data
* one whose modification will not affect this object.</b>
*
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
protected Calendar guessCalendar() {
ULocale calLocale = getAvailableLocale(TYPE_CALENDAR);
/**
* @draft ICU 3.6
- * @provisional This API might change or be removed in a future release.
*/
@Override
public boolean isFrozen() {
/**
* @draft ICU 4.4
- * @provisional This API might change or be removed in a future release.
*/
@Override
public GlobalizationPreferences freeze() {
/**
* @draft ICU 4.4
- * @provisional This API might change or be removed in a future release.
*/
@Override
public GlobalizationPreferences cloneAsThawed() {
*
* @return `MeasureUnit`.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public MeasureUnit getOutputUnit() {
return this.outputUnit;
* @internal ICU 69 technology preview
* @deprecated This API is for technology preview only.
*/
+ @Deprecated
public String getGender() {
return this.gender;
}
* <p>Here, RELAXED favors Max-Fraction and STRICT favors Max-Significant. Note that this larger
* number caused the two modes to favor the opposite result.
*
- * @provisional This API might change or be removed in a future release.
* @draft ICU 69
*/
public static enum RoundingPriority {
/**
* Favor greater precision by relaxing one of the rounding constraints.
*
- * @provisional This API might change or be removed in a future release.
* @draft ICU 69
*/
RELAXED,
-
+
/**
* Favor adherence to all rounding constraints by producing lower precision.
*
- * @provisional This API might change or be removed in a future release.
* @draft ICU 69
*/
STRICT,
* Behavior of this option with non-currency units is not defined at this time.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
* @see NumberFormatter
*/
FORMAL,
* Behavior of this option with non-currency units is not defined at this time.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
* @see NumberFormatter
*/
VARIANT,
* Same as AUTO, but do not show the sign on negative zero.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
NEGATIVE,
* Same as ACCOUNTING, but do not show the sign on negative zero.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
ACCOUNTING_NEGATIVE,
}
* @return The fluent chain
* @throws IllegalArgumentException in case of Setting a usage string but not a correct input unit.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public T usage(String usage) {
return create(KEY_USAGE, usage);
* @internal ICU 69 technology preview
* @deprecated This API is for technology preview only.
*/
+ @Deprecated
public T unitDisplayCase(String unitDisplayCase) {
return create(KEY_UNIT_DISPLAY_CASE, unitDisplayCase);
}
import java.io.InvalidObjectException;
import java.util.Locale;
-import com.ibm.icu.util.ULocale;
import com.ibm.icu.text.UFormat;
+import com.ibm.icu.util.ULocale;
/**
* The main entrypoint to the formatting of ranges of numbers, including currencies and other units of measurement.
* Class for span fields in FormattedNumberRange.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public static final class SpanField extends UFormat.SpanField {
private static final long serialVersionUID = 8750397196515368729L;
* list that is represented by the span.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public static final SpanField NUMBER_RANGE_SPAN = new SpanField("number-range-span");
* @return An array of Locales. All of the locales in the array can
* be used when creating a BreakIterator.
* @draft ICU 3.2 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static synchronized ULocale[] getAvailableULocales()
{
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public final ULocale getLocale(ULocale.Type type) {
return type == ULocale.ACTUAL_LOCALE ?
* @param isoCode the three-letter ISO code.
* @return the formal symbol.
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public abstract String getFormalSymbol(String isoCode);
* @param isoCode the three-letter ISO code.
* @return the variant symbol.
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public abstract String getVariantSymbol(String isoCode);
/**
* Hour Cycle
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public enum HourCycle {
/**
* hour in am/pm (0~11)
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
HOUR_CYCLE_11,
/**
* hour in am/pm (1~12)
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
HOUR_CYCLE_12,
/**
* hour in day (0~23)
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
HOUR_CYCLE_23,
/**
* hour in day (1~24)
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
HOUR_CYCLE_24;
};
* {@icu} Returns the set of locales for which DateFormats are installed.
* @return the set of locales for which DateFormats are installed.
* @draft ICU 3.2 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale[] getAvailableULocales()
{
* @param cal The calendar system for which a date/time format is desired.
* @param locale The locale for which the date/time format is desired.
* @stable ICU 3.2
- * @provisional This API might change or be removed in a future release.
*/
static final public DateFormat getInstance(Calendar cal, ULocale locale) {
return getDateTimeInstance(cal, SHORT, SHORT, locale);
* @return An array of <code>ULocale</code>s for which localized
* <code>DateFormatSymbols</code> instances are available.
* @draft ICU 3.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale[] getAvailableULocales() {
return ICUResourceBundle.getAvailableULocales();
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public final ULocale getLocale(ULocale.Type type) {
return type == ULocale.ACTUAL_LOCALE ?
* serialization method resolve instances to the constant
* DateIntervalFormat.SpanField values
* @draft ICU 64
- * @provisional This API might change or be removed in a future release.
*/
@Override
protected Object readResolve() throws InvalidObjectException {
*
* @param context The DisplayContext value to set.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public void setContext(DisplayContext context)
{
* @param type the DisplayContext.Type whose value to return
* @return the current DisplayContext setting for the specified type
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public DisplayContext getContext(DisplayContext.Type type)
{
private String normalizeHourMetacharacters(String skeleton, ULocale locale) {
StringBuilder result = new StringBuilder(skeleton);
-
+
char hourMetachar = '\0';
int metacharStart = 0;
int metacharCount = 0;
}
}
}
-
+
if (hourMetachar != '\0') {
char hourChar = 'H';
char dayPeriodChar = 'a';
}
convertedPattern = convertedPattern.substring(0, firstQuotePos) + convertedPattern.substring(secondQuotePos + 1);
}
-
+
if (convertedPattern.indexOf('h') != -1) {
hourChar = 'h';
} else if (convertedPattern.indexOf('K') != -1) {
} else if (convertedPattern.indexOf('k') != -1) {
hourChar = 'k';
}
-
+
if (convertedPattern.indexOf('b') != -1) {
dayPeriodChar = 'b';
} else if (convertedPattern.indexOf('B') != -1) {
dayPeriodChar = 'B';
}
-
+
if (hourChar == 'H' || hourChar == 'k') {
result.replace(metacharStart, metacharStart + metacharCount, String.valueOf(hourChar));
} else {
pattern.getSecondPart(), differenceInfo, suppressDayPeriodField);
pattern = new PatternInfo(part1, part2,
pattern.firstDateInPtnIsLaterDate());
-
+
// share
intervalPatterns.put(DateIntervalInfo.
CALENDAR_FIELD_TO_PATTERN_LETTER[field],
}
return adjustedPtn.toString();
}
-
+
/**
* Does the same thing as String.replace(), except that it won't perform the
* substitution inside quoted literal text.
} else {
StringBuilder result = new StringBuilder();
String source = targetString;
-
+
while (firstQuoteIndex >= 0) {
int secondQuoteIndex = source.indexOf("\'", firstQuoteIndex + 1);
if (secondQuoteIndex < 0) {
secondQuoteIndex = source.length() - 1;
}
-
+
String unquotedText = source.substring(0, firstQuoteIndex);
String quotedText = source.substring(firstQuoteIndex, secondQuoteIndex + 1);
-
+
result.append(unquotedText.replace(strToReplace, strToReplaceWith));
result.append(quotedText);
-
+
source = source.substring(secondQuoteIndex + 1);
firstQuoteIndex = source.indexOf("\'");
}
/**
* Return the default hour cycle.
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public DateFormat.HourCycle getDefaultHourCycle() {
switch(getDefaultHourFormatChar()) {
* @see #setMinimumGroupingDigits(int)
* @see #MINIMUM_GROUPING_DIGITS_MIN2
* @category Separators
- * @provisional This API might change or be removed in a future release.
* @draft ICU 68
*/
public static final int MINIMUM_GROUPING_DIGITS_AUTO = -2;
* @see #setMinimumGroupingDigits(int)
* @see #MINIMUM_GROUPING_DIGITS_AUTO
* @category Separators
- * @provisional This API might change or be removed in a future release.
* @draft ICU 68
*/
public static final int MINIMUM_GROUPING_DIGITS_MIN2 = -3;
* @return An array of <code>ULocale</code>s for which localized
* <code>DecimalFormatSymbols</code> instances are available.
* @stable ICU 3.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale[] getAvailableULocales() {
return ICUResourceBundle.getAvailableULocales();
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public final ULocale getLocale(ULocale.Type type) {
return type == ULocale.ACTUAL_LOCALE ?
* Type of meaning expressed by the list.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public enum Type {
/**
* Conjunction formatting, e.g. "Alice, Bob, Charlie, and Delta".
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
AND,
* "Alice, Bob, Charlie, or Delta".
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
OR,
* Formatting of a list of values with units, e.g. "5 pounds, 12 ounces".
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
UNITS
};
* Verbosity level of the list patterns.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public enum Width {
/**
* Use list formatting with full words (no abbreviations) when possible.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
WIDE,
* Use list formatting of typical length.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
SHORT,
* Use list formatting of the shortest possible length.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
NARROW,
};
* Class for span fields in FormattedList.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static final class SpanField extends UFormat.SpanField {
private static final long serialVersionUID = 3563544214705634403L;
* within the input list that is represented by the span.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static final SpanField LIST_SPAN = new SpanField("list-span");
/**
* Field selectors for format fields defined by ListFormatter.
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static final class Field extends Format.Field {
private static final long serialVersionUID = -8071145668708265437L;
/**
* The literal text in the result which came from the resources.
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static Field LITERAL = new Field("literal");
/**
* The element text in the result which came from the input strings.
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static Field ELEMENT = new Field("element");
}
/**
- * Serizalization method resolve instances to the constant Field values
+ * Serialization method resolve instances to the constant Field values
*
* @draft ICU 64
- * @provisional This API might change or be removed in a future release.
*/
@Override
protected Object readResolve() throws InvalidObjectException {
* Not intended for public subclassing.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static final class FormattedList implements FormattedValue {
private final FormattedStringBuilder string;
/**
* {@inheritDoc}
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
@Override
public String toString() {
/**
* {@inheritDoc}
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
@Override
public int length() {
/**
* {@inheritDoc}
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
@Override
public char charAt(int index) {
/**
* {@inheritDoc}
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
@Override
public CharSequence subSequence(int start, int end) {
/**
* {@inheritDoc}
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
@Override
public <A extends Appendable> A appendTo(A appendable) {
/**
* {@inheritDoc}
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
@Override
public boolean nextPosition(ConstrainedFieldPosition cfpos) {
/**
* {@inheritDoc}
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
@Override
public AttributedCharacterIterator toCharacterIterator() {
* the locale in question.
* @return ListFormatter
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static ListFormatter getInstance(ULocale locale, Type type, Width width) {
String styleName = typeWidthToStyleString(type, width);
* the locale in question.
* @return ListFormatter
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static ListFormatter getInstance(Locale locale, Type type, Width width) {
return getInstance(ULocale.forLocale(locale), type, width);
* items to format. The toString() method is called on each.
* @return items formatted into a FormattedList
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public FormattedList formatToValue(Object... items) {
return formatToValue(Arrays.asList(items));
* items to format. The toString() method is called on each.
* @return items formatted into a FormattedList
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public FormattedList formatToValue(Collection<?> items) {
return formatImpl(items, true).toValue();
* @throws UnsupportedOperationException
* Not supported.
* @draft ICU 53 (Retain)
- * @provisional This API might change or be removed in a future release.
*/
@Override
public Measure parseObject(String source, ParsePosition pos) {
* {@icu} Returns the list of Locales for which NumberFormats are available.
* @return the available locales
* @draft ICU 3.2 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale[] getAvailableULocales() {
if (shim == null) {
* @return The keyword of the selected rule.
* @throws UnsupportedOperationException If called on an instance without plural ranges data.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public String select(FormattedNumberRange range) {
if (standardPluralRanges == null) {
* Returns the set of locales for which PluralRules are known.
* @return the set of locales for which PluralRules are known, as a list
* @draft ICU 4.2 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale[] getAvailableULocales() {
return Factory.getDefaultFactory().getAvailableULocales();
* index 0 if locale is directly defined (without fallback) as having plural rules
* @return the functionally-equivalent locale
* @draft ICU 4.2 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale getFunctionalEquivalent(ULocale locale, boolean[] isAvailable) {
return Factory.getDefaultFactory().getFunctionalEquivalent(locale, isAvailable);
* Status of the keyword for the rules, given a set of explicit values.
*
* @draft ICU 50
- * @provisional This API might change or be removed in a future release.
*/
public enum KeywordStatus {
/**
* The keyword is not valid for the rules.
*
* @draft ICU 50
- * @provisional This API might change or be removed in a future release.
*/
INVALID,
/**
* The keyword is valid, but unused (it is covered by the explicit values, OR has no values for the given {@link SampleType}).
*
* @draft ICU 50
- * @provisional This API might change or be removed in a future release.
*/
SUPPRESSED,
/**
* The keyword is valid, used, and has a single possible value (before considering explicit values).
*
* @draft ICU 50
- * @provisional This API might change or be removed in a future release.
*/
UNIQUE,
/**
* The keyword is valid, used, not unique, and has a finite set of values.
*
* @draft ICU 50
- * @provisional This API might change or be removed in a future release.
*/
BOUNDED,
/**
* The keyword is valid but not bounded; there indefinitely many matching values.
*
* @draft ICU 50
- * @provisional This API might change or be removed in a future release.
*/
UNBOUNDED
}
* If non null, set to the unique value.
* @return the KeywordStatus
* @draft ICU 50
- * @provisional This API might change or be removed in a future release.
*/
public KeywordStatus getKeywordStatus(String keyword, int offset, Set<Double> explicits,
Output<Double> uniqueValue) {
* Serizalization method resolve instances to the constant Field values
*
* @draft ICU 64
- * @provisional This API might change or be removed in a future release.
*/
@Override
protected Object readResolve() throws InvalidObjectException {
break;
case 7:
if ("quarter".contentEquals(keyword)) {
- return QUARTER; // TODO: Check @provisional
+ return QUARTER; // RelativeUnit.QUARTERS is deprecated
}
break;
default:
* @param restrictionLevel
* The loosest restriction level allowed.
* @return self
- * @provisional This API might change or be removed in a future release.
* @stable ICU 58
*/
public Builder setRestrictionLevel(RestrictionLevel restrictionLevel) {
* Sometimes, a time zone is mapped to a different time zone in the past. For example, "America/Indiana/Knox"
* had been moving "Eastern Time" and "Central Time" back and forth. Therefore, it is necessary that time zone
* to meta zones mapping data are stored by date range.
- *
+ *
* <p><b>Note:</b>
* <p>
* {@link TimeZoneFormat} assumes an instance of <code>TimeZoneNames</code> is immutable. If you want to provide
* result returned by a method with time zone ID "America/Indiana/Indianapolis", because it's not a canonical time zone
* ID (the canonical time zone ID for the time zone is "America/Indianapolis". See
* {@link TimeZone#getCanonicalID(String)} about ICU canonical time zone IDs.
- *
+ *
* <p>
* In CLDR, most of time zone display names except location names are provided through meta zones. But a time zone may
* have a specific name that is not shared with other time zones.
* For example, time zone "Europe/London" has English long name for standard time "Greenwich Mean Time", which is also
* shared with other time zones. However, the long name for daylight saving time is "British Summer Time", which is only
* used for "Europe/London".
- *
+ *
* <p>
* {@link #getTimeZoneDisplayName(String, NameType)} is designed for accessing a name only used by a single time zone.
* But is not necessarily mean that a subclass implementation use the same model with CLDR. A subclass implementation
* may provide time zone names only through {@link #getTimeZoneDisplayName(String, NameType)}, or only through
* {@link #getMetaZoneDisplayName(String, NameType)}, or both.
- *
+ *
* <p>
* The default <code>TimeZoneNames</code> implementation returned by {@link #getInstance(ULocale)} uses the locale data
* imported from CLDR. In CLDR, set of meta zone IDs and mappings between zone IDs and meta zone IDs are shared by all
/**
* Time zone display name types
- *
+ *
* @stable ICU 49
*/
public enum NameType {
/**
* Returns an instance of <code>TimeZoneNames</code> for the specified locale.
- *
+ *
* @param locale
* The locale.
* @return An instance of <code>TimeZoneNames</code>
/**
* Returns an instance of <code>TimeZoneNames</code> for the specified
* {@link java.util.Locale}.
- *
+ *
* @param locale
* The {@link java.util.Locale}.
* @return An instance of <code>TimeZoneDisplayNames</code>
* Note: The input locale is used for resolving ambiguous names (e.g. "IST" is parsed
* as Israel Standard Time for Israel, while it is parsed as India Standard Time for
* all other regions). The zone names returned by this instance are not localized.
- *
+ *
* @stable ICU 54
*/
public static TimeZoneNames getTZDBInstance(ULocale locale) {
/**
* Returns an immutable set of all available meta zone IDs used by the given time zone.
- *
+ *
* @param tzID
* The canonical time zone ID.
* @return An immutable set of all available meta zone IDs used by the given time zone.
/**
* Returns the meta zone ID for the given canonical time zone ID at the given date.
- *
+ *
* @param tzID
* The canonical time zone ID.
* @param date
/**
* Returns the reference zone ID for the given meta zone ID for the region.
- *
+ *
* Note: Each meta zone must have a reference zone associated with a special region "001" (world).
* Some meta zones may have region specific reference zone IDs other than the special region
* "001". When a meta zone does not have any region specific reference zone IDs, this method
* return the reference zone ID for the special region "001" (world).
- *
+ *
* @param mzID
* The meta zone ID.
* @param region
/**
* Returns the display name of the meta zone.
- *
+ *
* @param mzID
* The meta zone ID.
* @param type
/**
* Returns the display name of the time zone at the given date.
- *
+ *
* <p>
* <b>Note:</b> This method calls the subclass's {@link #getTimeZoneDisplayName(String, NameType)} first. When the
* result is null, this method calls {@link #getMetaZoneID(String, long)} to get the meta zone ID mapped from the
* time zone, then calls {@link #getMetaZoneDisplayName(String, NameType)}.
- *
+ *
* @param tzID
* The canonical time zone ID.
* @param type
/**
* Returns the display name of the time zone. Unlike {@link #getDisplayName(String, NameType, long)},
* this method does not get a name from a meta zone used by the time zone.
- *
+ *
* @param tzID
* The canonical time zone ID.
* @param type
* </ol>
* For example, "New York" is returned for the time zone ID "America/New_York" when this object does not have the
* localized location name.
- *
+ *
* @param tzID
* The canonical time zone ID
* @return The exemplar location name for the given time zone, or null when a localized location name is not
/**
* Finds time zone name prefix matches for the input text at the
* given offset and returns a collection of the matches.
- *
+ *
* @param text the text.
* @param start the starting offset within the text.
* @param types the set of name types, or <code>null</code> for all name types.
* @see NameType
* @see MatchInfo
* @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) {
throw new UnsupportedOperationException("The method is not implemented in TimeZoneNames base class.");
* A <code>MatchInfo</code> represents a time zone name match used by
* {@link TimeZoneNames#find(CharSequence, int, EnumSet)}.
* @draft ICU 49 (Retain)
- * @provisional This API might change or be removed in a future release.
*/
public static class MatchInfo {
private NameType _nameType;
/**
* Constructing a <code>MatchInfo</code>.
- *
+ *
* @param nameType the name type enum.
* @param tzID the time zone ID, or null
* @param mzID the meta zone ID, or null
* or 3) <code>matchLength</code> is 0 or smaller.
* @see NameType
* @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) {
if (nameType == null) {
/**
* Returns the time zone ID, or <code>null</code> if not available.
- *
+ *
* <p><b>Note</b>: A <code>MatchInfo</code> must have either a time zone ID
* or a meta zone ID.
- *
+ *
* @return the time zone ID, or <code>null</code>.
* @see #mzID()
* @draft ICU 49 (Retain)
- * @provisional This API might change or be removed in a future release.
*/
public String tzID() {
return _tzID;
/**
* Returns the meta zone ID, or <code>null</code> if not available.
- *
+ *
* <p><b>Note</b>: A <code>MatchInfo</code> must have either a time zone ID
* or a meta zone ID.
- *
+ *
* @return the meta zone ID, or <code>null</code>.
* @see #tzID()
* @draft ICU 49 (Retain)
- * @provisional This API might change or be removed in a future release.
*/
public String mzID() {
return _mzID;
* @return the time zone name type enum.
* @see NameType
* @draft ICU 49 (Retain)
- * @provisional This API might change or be removed in a future release.
*/
public NameType nameType() {
return _nameType;
* Returns the match length.
* @return the match length.
* @draft ICU 49 (Retain)
- * @provisional This API might change or be removed in a future release.
*/
public int matchLength() {
return _matchLength;
/**
* Sole constructor for invocation by subclass constructors.
- *
+ *
* @draft ICU 49 (Retain)
- * @provisional This API might change or be removed in a future release.
*/
protected TimeZoneNames() {
}
/**
* The super class of <code>TimeZoneNames</code> service factory classes.
- *
+ *
* @internal
* @deprecated This API is ICU internal only.
*/
public static abstract class Factory {
/**
* The factory method of <code>TimeZoneNames</code>.
- *
+ *
* @param locale
* The display locale
* @return An instance of <code>TimeZoneNames</code>.
/*
* (non-Javadoc)
- *
+ *
* @see com.ibm.icu.impl.CacheBase#createInstance(java.lang.Object, java.lang.Object)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see com.ibm.icu.text.TimeZoneNames#getMetaZoneID (java.lang.String, long)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see com.ibm.icu.text.TimeZoneNames#getReferenceZoneID(java.lang.String, java.lang.String)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see com.ibm.icu.text.TimeZoneNames.Factory#getTimeZoneNames (com.ibm.icu.util.ULocale)
*/
@Override
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public final ULocale getLocale(ULocale.Type type) {
return type == ULocale.ACTUAL_LOCALE ?
* Internal class for customizing UnicodeSet parsing of properties.
* TODO: extend to allow customizing of codepoint ranges
* @draft ICU3.8 (retain)
- * @provisional This API might change or be removed in a future release.
* @author medavis
*/
abstract public static class XSymbolTable implements SymbolTable {
/**
* Default constructor
* @draft ICU3.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public XSymbolTable(){}
/**
* Supplies default implementation for SymbolTable (no action).
* @draft ICU3.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
@Override
public UnicodeMatcher lookupMatcher(int i) {
* with that property have been added to the UnicodeSet, and returns false if the
* propertyName+propertyValue combination is not recognized (in which case result is unaltered).
* @draft ICU3.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public boolean applyPropertyAlias(String propertyName, String propertyValue, UnicodeSet result) {
return false;
/**
* Supplies default implementation for SymbolTable (no action).
* @draft ICU3.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
@Override
public char[] lookup(String s) {
/**
* Supplies default implementation for SymbolTable (no action).
* @draft ICU3.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
@Override
public String parseReference(String text, ParsePosition pos, int limit) {
* around a time zone transition.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public static enum LocalOption {
/**
* An input time is always interpreted as local time before
* a time zone transition.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
FORMER(0x04),
/**
* An input time is always interpreted as local time after
* a time zone transition.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
LATTER(0x0C),
/**
* or daylight saving time, the local time before the
* transition is used.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
STANDARD_FORMER(0x05),
/**
* or daylight saving time, the local time after the
* transition is used.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
STANDARD_LATTER(0x0D),
/**
* or daylight saving time, the local time before the
* transition is used.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
DAYLIGHT_FORMER(0x07),
/**
* or daylight saving time, the local time after the
* transition is used.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
DAYLIGHT_LATTER(0x0F);
/**
* {@icu} Returns time zone offsets from local wall time.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public void getOffsetFromLocal(long date,
LocalOption nonExistingTimeOpt, LocalOption duplicatedTimeOpt, int[] offsets) {
* {@icu} Returns the list of locales for which Calendars are installed.
* @return the list of locales for which Calendars are installed.
* @draft ICU 3.2 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale[] getAvailableULocales()
{
* @param locale the locale for which the symbols should be drawn
* @return a <code>DateFormat</code> appropriate to this calendar
* @draft ICU 3.2 (retain)
- * @provisional This API might change or be removed in a future release.
*/
protected DateFormat handleGetDateFormat(String pattern, String override, ULocale locale) {
FormatConfiguration fmtConfig = new FormatConfiguration();
* @param extendedYear the extendedYear, as returned by handleGetExtendedYear
* @return the default month
* @draft ICU 3.6 (retain)
- * @provisional This API might change or be removed in a future release.
* @see #MONTH
*/
protected int getDefaultMonthInYear(int extendedYear) {
* @param month the month, as returned by getDefaultMonthInYear
* @return the default day of the month
* @draft ICU 3.6 (retain)
- * @provisional This API might change or be removed in a future release.
* @see #DAY_OF_MONTH
*/
protected int getDefaultDayInMonth(int extendedYear, int month) {
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public final ULocale getLocale(ULocale.Type type) {
return type == ULocale.ACTUAL_LOCALE ?
/**
* Implement the Coptic calendar system.
* <p>
- * CopticCalendar usually should be instantiated using
+ * CopticCalendar usually should be instantiated using
* {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a <code>ULocale</code>
* with the tag <code>"@calendar=coptic"</code>.</p>
*
* @see com.ibm.icu.util.Calendar
* @stable ICU 3.4
*/
-public final class CopticCalendar extends CECalendar
+public final class CopticCalendar extends CECalendar
{
// jdk1.4.2 serialver
private static final long serialVersionUID = 5903818751846742911L;
- /**
+ /**
* Constant for ωογτ / تﻮﺗ,
- * the 1st month of the Coptic year.
+ * the 1st month of the Coptic year.
* @stable ICU 3.4
*/
public static final int TOUT = 0;
- /**
+ /**
* Constant for Παοπι / ﻪﺑﺎﺑ,
- * the 2nd month of the Coptic year.
+ * the 2nd month of the Coptic year.
* @stable ICU 3.4
*/
public static final int BABA = 1;
- /**
+ /**
* Constant for Αθορ / رﻮﺗﺎﻫ,
- * the 3rd month of the Coptic year.
+ * the 3rd month of the Coptic year.
* @stable ICU 3.4
*/
public static final int HATOR = 2;
- /**
+ /**
* Constant for Χοιακ / ﻚﻬﻴﻛ;,
- * the 4th month of the Coptic year.
+ * the 4th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int KIAHK = 3;
- /**
+ /**
* Constant for Τωβι / طﻮﺒﻫ,
- * the 5th month of the Coptic year.
+ * the 5th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int TOBA = 4;
- /**
+ /**
* Constant for Μεϣιρ / ﺮﻴﺸﻣأ,
- * the 6th month of the Coptic year.
+ * the 6th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int AMSHIR = 5;
- /**
+ /**
* Constant for Παρεμϩατ / تﺎﻬﻣﺮﺑ,
- * the 7th month of the Coptic year.
+ * the 7th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int BARAMHAT = 6;
- /**
- * Constant for Φαρμοθι / هدﻮﻣﺮﺑ,
- * the 8th month of the Coptic year.
+ /**
+ * Constant for Φαρμοθι / هدﻮﻣﺮﺑ,
+ * the 8th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int BARAMOUDA = 7;
- /**
+ /**
* Constant for Παϣαν / ﺲﻨﺸﺑ;,
- * the 9th month of the Coptic year.
+ * the 9th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int BASHANS = 8;
- /**
+ /**
* Constant for Παωνι / ﻪﻧؤﻮﺑ,
- * the 10th month of the Coptic year.
+ * the 10th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int PAONA = 9;
- /**
+ /**
* Constant for Επηπ / ﺐﻴﺑأ,
- * the 11th month of the Coptic year.
+ * the 11th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int EPEP = 10;
- /**
+ /**
* Constant for Μεϲωρη / ىﺮﺴﻣ,
- * the 12th month of the Coptic year.
+ * the 12th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int MESRA = 11;
- /**
+ /**
* Constant for Πικογϫι μαβοτ / ﺮﻴﻐﺼﻟاﺮﻬﺸﻟا,
- * the 13th month of the Coptic year.
+ * the 13th month of the Coptic year.
* @stable ICU 3.4
*/
public static final int NASIE = 12;
-
+
private static final int JD_EPOCH_OFFSET = 1824665;
// Eras
public CopticCalendar(TimeZone zone, Locale aLocale) {
super(zone, aLocale);
}
-
+
/**
* Constructs a <code>CopticCalendar</code> based on the current time
* in the given time zone with the given locale.
public CopticCalendar(TimeZone zone, ULocale locale) {
super(zone, locale);
}
-
+
/**
* Constructs a <code>CopticCalendar</code> with the given date set
* in the default time zone with the default locale.
* {@inheritDoc}
* @stable ICU 3.8
*/
+ @Override
public String getType() {
return "coptic";
}
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Override
@Deprecated
protected int handleGetExtendedYear() {
int eyear;
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Override
@Deprecated
protected void handleComputeFields(int julianDay) {
int era, year;
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Override
@Deprecated
protected int getJDEpochOffset() {
return JD_EPOCH_OFFSET;
* @param month the month
* @param date the day
* @draft ICU 3.4 (retain)
- * @provisional This API might change or be removed in a future release.
*/
// The equivalent operation can be done by public Calendar API.
// This API was accidentally marked as @draft, but we have no good
* for example, "NT$" instead of "$" for TWD in zh-TW.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static final int FORMAL_SYMBOL_NAME = 4;
* necessarily as widely used as the regular symbol.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static final int VARIANT_SYMBOL_NAME = 5;
*
* @see SimpleDateRule
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public interface DateRule
{
*
* @see #firstBetween
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
abstract public Date firstAfter(Date start);
*
* @see #firstAfter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
abstract public Date firstBetween(Date start, Date end);
* @param date The date to check.
* @return true if this event occurs on the given date.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
abstract public boolean isOn(Date date);
* Check whether this event occurs at least once between the two
* dates given.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
abstract public boolean isBetween(Date start, Date end);
}
* a fixed number of days before or after Easter. Supports both the
* Western and Orthodox methods for calculating Easter.
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public class EasterHoliday extends Holiday
{
*
* @param name The name of the holiday
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public EasterHoliday(String name)
{
* @param daysAfter The number of days before (-) or after (+) Easter
* @param name The name of the holiday
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public EasterHoliday(int daysAfter, String name)
{
* @param orthodox Use the Orthodox calendar?
* @param name The name of the holiday
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public EasterHoliday(int daysAfter, boolean orthodox, String name)
{
/**
* Shrove Tuesday, aka Mardi Gras, 48 days before Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday SHROVE_TUESDAY = new EasterHoliday(-48, "Shrove Tuesday");
/**
* Ash Wednesday, start of Lent, 47 days before Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday ASH_WEDNESDAY = new EasterHoliday(-47, "Ash Wednesday");
/**
* Palm Sunday, 7 days before Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday PALM_SUNDAY = new EasterHoliday( -7, "Palm Sunday");
/**
* Maundy Thursday, 3 days before Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday MAUNDY_THURSDAY = new EasterHoliday( -3, "Maundy Thursday");
/**
* Good Friday, 2 days before Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday GOOD_FRIDAY = new EasterHoliday( -2, "Good Friday");
/**
* Easter Sunday
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday EASTER_SUNDAY = new EasterHoliday( 0, "Easter Sunday");
/**
* Easter Monday, 1 day after Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday EASTER_MONDAY = new EasterHoliday( 1, "Easter Monday");
/**
* Ascension, 39 days after Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday ASCENSION = new EasterHoliday( 39, "Ascension");
/**
* Pentecost (aka Whit Sunday), 49 days after Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday PENTECOST = new EasterHoliday( 49, "Pentecost");
/**
* Whit Sunday (aka Pentecost), 49 days after Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday WHIT_SUNDAY = new EasterHoliday( 49, "Whit Sunday");
/**
* Whit Monday, 50 days after Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday WHIT_MONDAY = new EasterHoliday( 50, "Whit Monday");
/**
* Corpus Christi, 60 days after Easter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
static public final EasterHoliday CORPUS_CHRISTI = new EasterHoliday( 60, "Corpus Christi");
}
/**
* Implement the Ethiopic calendar system.
* <p>
- * EthiopicCalendar usually should be instantiated using
+ * EthiopicCalendar usually should be instantiated using
* {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a <code>ULocale</code>
* with the tag <code>"@calendar=ethiopic"</code>.</p>
*
* @see com.ibm.icu.util.Calendar
* @stable ICU 3.4
*/
-public final class EthiopicCalendar extends CECalendar
+public final class EthiopicCalendar extends CECalendar
{
//jdk1.4.2 serialver
private static final long serialVersionUID = -2438495771339315608L;
- /**
+ /**
* Constant for መስከረም, the 1st month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int MESKEREM = 0;
- /**
- * Constant for ጥቅምት, the 2nd month of the Ethiopic year.
+ /**
+ * Constant for ጥቅምት, the 2nd month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int TEKEMT = 1;
- /**
- * Constant for ኅዳር, the 3rd month of the Ethiopic year.
+ /**
+ * Constant for ኅዳር, the 3rd month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int HEDAR = 2;
- /**
- * Constant for ታኅሣሥ, the 4th month of the Ethiopic year.
+ /**
+ * Constant for ታኅሣሥ, the 4th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int TAHSAS = 3;
- /**
- * Constant for ጥር, the 5th month of the Ethiopic year.
+ /**
+ * Constant for ጥር, the 5th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int TER = 4;
- /**
- * Constant for የካቲት, the 6th month of the Ethiopic year.
+ /**
+ * Constant for የካቲት, the 6th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int YEKATIT = 5;
- /**
- * Constant for መጋቢት, the 7th month of the Ethiopic year.
+ /**
+ * Constant for መጋቢት, the 7th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int MEGABIT = 6;
- /**
- * Constant for ሚያዝያ, the 8th month of the Ethiopic year.
+ /**
+ * Constant for ሚያዝያ, the 8th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int MIAZIA = 7;
- /**
- * Constant for ግንቦት, the 9th month of the Ethiopic year.
+ /**
+ * Constant for ግንቦት, the 9th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int GENBOT = 8;
- /**
- * Constant for ሰኔ, the 10th month of the Ethiopic year.
+ /**
+ * Constant for ሰኔ, the 10th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int SENE = 9;
- /**
- * Constant for ሐምሌ, the 11th month of the Ethiopic year.
+ /**
+ * Constant for ሐምሌ, the 11th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int HAMLE = 10;
- /**
- * Constant for ነሐሴ, the 12th month of the Ethiopic year.
+ /**
+ * Constant for ነሐሴ, the 12th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int NEHASSE = 11;
- /**
- * Constant for ጳጉሜን, the 13th month of the Ethiopic year.
+ /**
+ * Constant for ጳጉሜን, the 13th month of the Ethiopic year.
* @stable ICU 3.4
*/
public static final int PAGUMEN = 12;
-
+
// Up until the end of the 19th century the prevailant convention was to
- // reference the Ethiopic Calendar from the creation of the world,
+ // reference the Ethiopic Calendar from the creation of the world,
// \u12d3\u1218\u1270\u1361\u12d3\u1208\u121d
// (Amete Alem 5500 BC). As Ethiopia modernized the reference epoch from
- // the birth of Christ (\u12d3\u1218\u1270\u1361\u121d\u1215\u1228\u1275)
+ // the birth of Christ (\u12d3\u1218\u1270\u1361\u121d\u1215\u1228\u1275)
// began to displace the creation of the
// world reference point. However, years before the birth of Christ are
- // still referenced in the creation of the world system.
+ // still referenced in the creation of the world system.
// Thus -100 \u12d3/\u121d
// would be rendered as 5400 \u12d3/\u12d3.
//
- // The creation of the world in Ethiopic cannon was
+ // The creation of the world in Ethiopic cannon was
// Meskerem 1, -5500 \u12d3/\u121d 00:00:00
// applying the birth of Christ reference and Ethiopian time conventions. This is
// 6 hours less than the Julian epoch reference point (noon). In Gregorian
// the date and time was July 18th -5493 BC 06:00 AM.
- // Julian Days relative to the
+ // Julian Days relative to the
// \u12d3\u1218\u1270\u1361\u121d\u1215\u1228\u1275 epoch
// Note: we no longer use this constant
//private static final int JD_EPOCH_OFFSET_AMETE_ALEM = -285019;
- // Julian Days relative to the
+ // Julian Days relative to the
// \u12d3\u1218\u1270\u1361\u12d3\u1208\u121d epoch
private static final int JD_EPOCH_OFFSET_AMETE_MIHRET = 1723856;
public EthiopicCalendar(TimeZone zone, Locale aLocale) {
this(zone, ULocale.forLocale(aLocale));
}
-
+
/**
* Constructs a <code>EthiopicCalendar</code> based on the current time
* in the given time zone with the given locale.
* {@inheritDoc}
* @stable ICU 3.8
*/
+ @Override
public String getType() {
if (isAmeteAlemEra()) {
return "ethiopic-amete-alem";
public void setAmeteAlemEra(boolean onOff) {
eraType = onOff ? AMETE_ALEM_ERA : AMETE_MIHRET_ERA;
}
-
+
/**
* Return true if this calendar is set to the Amete Alem era.
*
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Override
@Deprecated
protected int handleGetExtendedYear() {
// Ethiopic calendar uses EXTENDED_YEAR aligned to
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Override
@Deprecated
protected void handleComputeFields(int julianDay) {
int era, year;
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Override
@Deprecated
protected int handleGetLimit(int field, int limitType) {
if (isAmeteAlemEra() && field == ERA) {
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Override
@Deprecated
protected int getJDEpochOffset() {
return JD_EPOCH_OFFSET_AMETE_MIHRET;
* @param date the day
*
* @draft ICU 3.4 (retain)
- * @provisional This API might change or be removed in a future release.
*/
// The equivalent operation can be done by public Calendar API.
// This API was accidentally marked as @draft, but we have no good
*/
private void setCalcTypeForLocale(ULocale locale) {
String localeCalType = CalendarUtil.getCalendarType(locale);
- if("ethiopic-amete-alem".equals(localeCalType)) {
+ if("ethiopic-amete-alem".equals(localeCalType)) {
setAmeteAlemEra(true);
} else {
setAmeteAlemEra(false); // default - Amete Mihret
/**
* <b>Note:</b> The Holiday framework is a technology preview.
* Despite its age, is still draft API, and clients should treat it as such.
- *
+ *
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public class HebrewHoliday extends Holiday
{
*
* @param name The name of the holiday
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public HebrewHoliday(int month, int date, String name)
{
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public HebrewHoliday(int month, int date, int length, String name)
{
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday ROSH_HASHANAH = new HebrewHoliday(HebrewCalendar.TISHRI, 1, 2, "Rosh Hashanah");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday GEDALIAH = new HebrewHoliday(HebrewCalendar.TISHRI, 3, "Fast of Gedaliah");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday YOM_KIPPUR = new HebrewHoliday(HebrewCalendar.TISHRI, 10, "Yom Kippur");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday SUKKOT = new HebrewHoliday(HebrewCalendar.TISHRI, 15, 6, "Sukkot");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday HOSHANAH_RABBAH = new HebrewHoliday(HebrewCalendar.TISHRI, 21, "Hoshanah Rabbah");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday SHEMINI_ATZERET = new HebrewHoliday(HebrewCalendar.TISHRI, 22, "Shemini Atzeret");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday SIMCHAT_TORAH = new HebrewHoliday(HebrewCalendar.TISHRI, 23, "Simchat Torah");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday HANUKKAH = new HebrewHoliday(HebrewCalendar.KISLEV, 25, "Hanukkah");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday TEVET_10 = new HebrewHoliday(HebrewCalendar.TEVET, 10, "Fast of Tevet 10");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday TU_BSHEVAT = new HebrewHoliday(HebrewCalendar.SHEVAT, 15, "Tu B'Shevat");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday ESTHER = new HebrewHoliday(HebrewCalendar.ADAR, 13, "Fast of Esther");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday PURIM = new HebrewHoliday(HebrewCalendar.ADAR, 14, "Purim");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday SHUSHAN_PURIM = new HebrewHoliday(HebrewCalendar.ADAR, 15, "Shushan Purim");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday PASSOVER = new HebrewHoliday(HebrewCalendar.NISAN, 15, 8, "Passover");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday YOM_HASHOAH = new HebrewHoliday(HebrewCalendar.NISAN, 27, "Yom Hashoah");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday YOM_HAZIKARON = new HebrewHoliday(HebrewCalendar.IYAR, 4, "Yom Hazikaron");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday YOM_HAATZMAUT = new HebrewHoliday(HebrewCalendar.IYAR, 5, "Yom Ha'Atzmaut");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday PESACH_SHEINI = new HebrewHoliday(HebrewCalendar.IYAR, 14, "Pesach Sheini");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday LAG_BOMER = new HebrewHoliday(HebrewCalendar.IYAR, 18, "Lab B'Omer");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday YOM_YERUSHALAYIM = new HebrewHoliday(HebrewCalendar.IYAR, 28, "Yom Yerushalayim");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday SHAVUOT = new HebrewHoliday(HebrewCalendar.SIVAN, 6, 2, "Shavuot");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday TAMMUZ_17 = new HebrewHoliday(HebrewCalendar.TAMUZ, 17, "Fast of Tammuz 17");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday TISHA_BAV = new HebrewHoliday(HebrewCalendar.AV, 9, "Fast of Tisha B'Av");
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static HebrewHoliday SELIHOT = new HebrewHoliday(HebrewCalendar.ELUL, 21, "Selihot");
}
*
* An abstract class representing a holiday.
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public abstract class Holiday implements DateRule
{
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static Holiday[] getHolidays()
{
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static Holiday[] getHolidays(Locale locale)
{
/**
* @draft ICU 3.2
- * @provisional This API might change or be removed in a future release.
*/
public static Holiday[] getHolidays(ULocale locale)
{
*
* @see #firstBetween
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
@Override
public Date firstAfter(Date start) {
*
* @see #firstAfter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
@Override
public Date firstBetween(Date start, Date end) {
* @param date The date to check.
* @return true if this holiday occurs on the given date.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
@Override
public boolean isOn(Date date) {
* Check whether this holiday occurs at least once between the two
* dates given.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
@Override
public boolean isBetween(Date start, Date end) {
* falls. Holiday's implementation of the DateRule interface
* simply delegates to this DateRule object.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
protected Holiday(String name, DateRule rule)
{
* Return the name of this holiday in the language of the default <code>DISPLAY</code> locale.
* @see Category#DISPLAY
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public String getDisplayName() {
return getDisplayName(ULocale.getDefault(Category.DISPLAY));
*
* @see ResourceBundle
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public String getDisplayName(Locale locale)
{
*
* @see ResourceBundle
* @draft ICU 3.2
- * @provisional This API might change or be removed in a future release.
*/
public String getDisplayName(ULocale locale)
{
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public DateRule getRule() {
return rule;
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public void setRule(DateRule rule) {
this.rule = rule;
* processing time, stack depth, or heap memory requirements.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public class ICUInputTooLongException extends ICUException {
private static final long serialVersionUID = -2602876786689338226L;
* Default constructor.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public ICUInputTooLongException() {
}
*
* @param message exception message string
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public ICUInputTooLongException(String message) {
super(message);
*
* @param cause original exception
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public ICUInputTooLongException(Throwable cause) {
super(cause);
* @param message exception message string
* @param cause original exception
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public ICUInputTooLongException(String message, Throwable cause) {
super(message, cause);
* taking year and era into account. Defaults to 0 (JANUARY) for Gregorian.
* @param extendedYear the extendedYear, as returned by handleGetExtendedYear
* @return the default month
- * @provisional ICU 3.6
* @draft ICU 3.6 (retain)
* @see #MONTH
*/
* @param month the month, as returned by getDefaultMonthInYear
* @return the default day of the month
* @draft ICU 3.6 (retain)
- * @provisional ICU 3.6
* @see #DAY_OF_MONTH
*/
@Override
*
* @see LocaleMatcher.Builder#setDirection(LocaleMatcher.Direction)
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public enum Direction {
/**
* Locale matching includes one-way matches such as Breton→French. (default)
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
WITH_ONE_WAY,
/**
* but ignoring one-way matches.
*
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
ONLY_TWO_WAY
}
* best supported locale.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public Builder setNoDefaultLocale() {
this.defaultLocale = null;
* @param direction the match direction to set.
* @return this Builder object
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public Builder setDirection(Direction direction) {
this.direction = direction;
* @param supported the supported locale for distance comparison.
* @return this Builder object
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public Builder setMaxDistance(Locale desired, Locale supported) {
if (desired == null || supported == null) {
* @param supported the supported locale for distance comparison.
* @return this Builder object
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public Builder setMaxDistance(ULocale desired, ULocale supported) {
if (desired == null || supported == null) {
* @param supported The supported locale.
* @return true if the pair of locales matches acceptably.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public boolean isMatch(Locale desired, Locale supported) {
int indexAndDistance = LocaleDistance.INSTANCE.getBestIndexAndDistance(
* @param supported The supported locale.
* @return true if the pair of locales matches acceptably.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public boolean isMatch(ULocale desired, ULocale supported) {
int indexAndDistance = LocaleDistance.INSTANCE.getBestIndexAndDistance(
* or prefix of a compound unit.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public enum Complexity {
/**
* A single unit, like kilojoule.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
SINGLE,
* A compound unit, like meter-per-second.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
COMPOUND,
* A mixed unit, like hour-and-minute.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
MIXED
}
* Enumeration for SI and binary prefixes, e.g. "kilo-", "nano-", "mebi-".
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public enum MeasurePrefix {
* SI prefix: yotta, 10^24.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
YOTTA(24, "yotta", 10),
* SI prefix: zetta, 10^21.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
ZETTA(21, "zetta", 10),
* SI prefix: exa, 10^18.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
EXA(18, "exa", 10),
* SI prefix: peta, 10^15.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
PETA(15, "peta", 10),
* SI prefix: tera, 10^12.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
TERA(12, "tera", 10),
* SI prefix: giga, 10^9.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
GIGA(9, "giga", 10),
* SI prefix: mega, 10^6.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
MEGA(6, "mega", 10),
* SI prefix: kilo, 10^3.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
KILO(3, "kilo", 10),
* SI prefix: hecto, 10^2.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
HECTO(2, "hecto", 10),
* SI prefix: deka, 10^1.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
DEKA(1, "deka", 10),
* The absence of an SI prefix.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
ONE(0, "", 10),
* SI prefix: deci, 10^-1.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
DECI(-1, "deci", 10),
* SI prefix: centi, 10^-2.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
CENTI(-2, "centi", 10),
* SI prefix: milli, 10^-3.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
MILLI(-3, "milli", 10),
* SI prefix: micro, 10^-6.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
MICRO(-6, "micro", 10),
* SI prefix: nano, 10^-9.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
NANO(-9, "nano", 10),
* SI prefix: pico, 10^-12.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
PICO(-12, "pico", 10),
* SI prefix: femto, 10^-15.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
FEMTO(-15, "femto", 10),
* SI prefix: atto, 10^-18.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
ATTO(-18, "atto", 10),
* SI prefix: zepto, 10^-21.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
ZEPTO(-21, "zepto", 10),
* SI prefix: yocto, 10^-24.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
YOCTO(-24, "yocto", 10),
* IEC binary prefix: kibi, 1024^1.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
KIBI(1, "kibi", 1024),
* IEC binary prefix: mebi, 1024^2.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
MEBI(2, "mebi", 1024),
* IEC binary prefix: gibi, 1024^3.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
GIBI(3, "gibi", 1024),
* IEC binary prefix: tebi, 1024^4.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
TEBI(4, "tebi", 1024),
* IEC binary prefix: pebi, 1024^5.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
PEBI(5, "pebi", 1024),
* IEC binary prefix: exbi, 1024^6.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
EXBI(6, "exbi", 1024),
* IEC binary prefix: zebi, 1024^7.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
ZEBI(7, "zebi", 1024),
* IEC binary prefix: yobi, 1024^8.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
YOBI(8, "yobi", 1024);
* - if the prefix is "gibi", the base will be 1024.
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public int getBase() {
return base;
* - if the prefix is "gibi", the power will be 3 (for base 1024).
*
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public int getPower() {
return power;
* @param identifier CLDR Unit Identifier
* @throws IllegalArgumentException if the identifier is invalid.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static MeasureUnit forIdentifier(String identifier) {
if (identifier == null || identifier.isEmpty()) {
*
* @return The string form of this unit.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public String getIdentifier() {
String result = measureUnitImpl == null ? getSubtype() : measureUnitImpl.getIdentifier();
*
* @return The unit complexity.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public Complexity getComplexity() {
if (measureUnitImpl == null) {
* @return A new SINGLE unit.
* @throws UnsupportedOperationException if this unit is a COMPOUND or MIXED unit.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public MeasureUnit withPrefix(MeasurePrefix prefix) {
SingleUnitImpl singleUnit = getSingleUnitImpl();
* @return The prefix of this SINGLE unit, from MeasurePrefix.
* @throws UnsupportedOperationException if the unit is COMPOUND or MIXED.
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public MeasurePrefix getPrefix() {
return getSingleUnitImpl().getPrefix();
* @return The dimensionality (power) of this simple unit.
* @throws UnsupportedOperationException if the unit is COMPOUND or MIXED.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public int getDimensionality() {
return getSingleUnitImpl().getDimensionality();
* @return A new SINGLE unit.
* @throws UnsupportedOperationException if the unit is COMPOUND or MIXED.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public MeasureUnit withDimensionality(int dimensionality) {
SingleUnitImpl singleUnit = getSingleUnitImpl();
* @return The reciprocal of the target unit.
* @throws UnsupportedOperationException if the unit is MIXED.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public MeasureUnit reciprocal() {
MeasureUnitImpl measureUnit = getCopyOfMeasureUnitImpl();
* @return The product of the target unit with the provided unit.
* @throws UnsupportedOperationException if the unit is MIXED.
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public MeasureUnit product(MeasureUnit other) {
MeasureUnitImpl implCopy = getCopyOfMeasureUnitImpl();
*
* @return An unmodifiable list of single units
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public List<MeasureUnit> splitToSingleUnits() {
final ArrayList<SingleUnitImpl> singleUnits =
/**
* Constant for unit of concentr: milligram-ofglucose-per-deciliter
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit MILLIGRAM_OFGLUCOSE_PER_DECILITER = MeasureUnit.internalGetInstance("concentr", "milligram-ofglucose-per-deciliter");
/**
* Constant for unit of graphics: dot
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit DOT = MeasureUnit.internalGetInstance("graphics", "dot");
/**
* Constant for unit of length: earth-radius
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit EARTH_RADIUS = MeasureUnit.internalGetInstance("length", "earth-radius");
/**
* Constant for unit of light: candela
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit CANDELA = MeasureUnit.internalGetInstance("light", "candela");
/**
* Constant for unit of light: lumen
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit LUMEN = MeasureUnit.internalGetInstance("light", "lumen");
/**
* Constant for unit of mass: grain
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit GRAIN = MeasureUnit.internalGetInstance("mass", "grain");
/**
* Constant for unit of volume: dessert-spoon
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit DESSERT_SPOON = MeasureUnit.internalGetInstance("volume", "dessert-spoon");
/**
* Constant for unit of volume: dessert-spoon-imperial
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit DESSERT_SPOON_IMPERIAL = MeasureUnit.internalGetInstance("volume", "dessert-spoon-imperial");
/**
* Constant for unit of volume: dram
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit DRAM = MeasureUnit.internalGetInstance("volume", "dram");
/**
* Constant for unit of volume: drop
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit DROP = MeasureUnit.internalGetInstance("volume", "drop");
/**
* Constant for unit of volume: jigger
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit JIGGER = MeasureUnit.internalGetInstance("volume", "jigger");
/**
* Constant for unit of volume: pinch
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit PINCH = MeasureUnit.internalGetInstance("volume", "pinch");
/**
* Constant for unit of volume: quart-imperial
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit QUART_IMPERIAL = MeasureUnit.internalGetInstance("volume", "quart-imperial");
* Dimensionless unit for percent and permille.
* @see NumberFormatter
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public final class NoUnit {
/**
* Since ICU 68, this constant equals null.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit BASE = null;
* Since ICU 68, this constant is equivalent to MeasureUnit.PERCENT.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit PERCENT = MeasureUnit.PERCENT;
* Since ICU 68, this constant is equivalent to MeasureUnit.PERMILLE.
*
* @draft ICU 68
- * @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit PERMILLE = MeasureUnit.PERMILLE;
/**
* <b>Note:</b> The Holiday framework is a technology preview.
* Despite its age, is still draft API, and clients should treat it as such.
- *
+ *
* Implementation of DateRule that takes a range.
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public class RangeDateRule implements DateRule {
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public RangeDateRule() {
}
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public void add(DateRule rule) {
add(new Date(Long.MIN_VALUE), rule);
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public void add(Date start, DateRule rule) {
// TODO: Insert in the right place
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public Date firstAfter(Date start) {
// Find the range that I should look at
int index = startIndex(start);
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public Date firstBetween(Date start, Date end) {
if (end == null) {
return firstAfter(start);
}
-
+
// Find the range that I should look at
int index = startIndex(start);
Date result = null;
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public boolean isOn(Date date) {
Range r = rangeAt(startIndex(date));
return r != null && r.rule != null && r.rule.isOn(date);
* Check whether this event occurs at least once between the two
* dates given.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public boolean isBetween(Date start, Date end) {
return firstBetween(start,end) == null;
}
: null;
}
- List<Range> ranges = new ArrayList<Range>(2);
+ List<Range> ranges = new ArrayList<>(2);
}
//-----------------------------------------------------------------------
/**
* {@inheritDoc}
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
@Override
public void getOffsetFromLocal(long date,
/**
* <b>Note:</b> The Holiday framework is a technology preview.
* Despite its age, is still draft API, and clients should treat it as such.
- *
+ *
* Simple implementation of DateRule.
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public class SimpleDateRule implements DateRule
{
* @param month The month in which this rule occurs (0-based).
* @param dayOfMonth The date in that month (1-based).
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleDateRule(int month, int dayOfMonth)
{
* on or after dayOfMonth. If false, the rule selects
* the first dayOfWeek on or before dayOfMonth.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleDateRule(int month, int dayOfMonth, int dayOfWeek, boolean after)
{
*
* @see #firstBetween
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public Date firstAfter(Date start)
{
return doFirstBetween(start, null);
*
* @see #firstAfter
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public Date firstBetween(Date start, Date end)
{
// Pin to the min/max dates for this rule
* @param date The date to check.
* @return true if this event occurs on the given date.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public boolean isOn(Date date)
{
Calendar c = calendar;
* Check whether this event occurs at least once between the two
* dates given.
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
+ @Override
public boolean isBetween(Date start, Date end)
{
return firstBetween(start, end) != null; // TODO: optimize?
}
}
- /**
- * @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
- */
// public void setCalendar(Calendar c) {
// calendar = c;
// }
/**
* <b>Note:</b> The Holiday framework is a technology preview.
* Despite its age, is still draft API, and clients should treat it as such.
- *
+ *
* A holiday whose date can be represented by a month, day, and optionally day of week
* in the Gregorian calendar.
*
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public class SimpleHoliday extends Holiday {
/**
*
* @see Holiday#getDisplayName(java.util.Locale)
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleHoliday(int month, int dayOfMonth, String name)
{
*
* @see Holiday#getDisplayName(java.util.Locale)
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleHoliday(int month, int dayOfMonth, String name,
int startYear)
*
* @see Holiday#getDisplayName(java.util.Locale)
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleHoliday(int month, int dayOfMonth, String name,
int startYear, int endYear)
*
* @see Holiday#getDisplayName(java.util.Locale)
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleHoliday(int month, int dayOfMonth, int dayOfWeek, String name)
{
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleHoliday(int month, int dayOfMonth, int dayOfWeek, String name,
int startYear)
{
- super(name, rangeRule(startYear, 0,
+ super(name, rangeRule(startYear, 0,
new SimpleDateRule(month, dayOfMonth,
dayOfWeek > 0 ? dayOfWeek : - dayOfWeek,
dayOfWeek > 0)));
/**
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public SimpleHoliday(int month, int dayOfMonth, int dayOfWeek, String name,
int startYear, int endYear)
{
- super(name, rangeRule(startYear, endYear,
+ super(name, rangeRule(startYear, endYear,
new SimpleDateRule(month, dayOfMonth,
dayOfWeek > 0 ? dayOfWeek : - dayOfWeek,
dayOfWeek > 0)));
/**
* New Year's Day - January 1st
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday NEW_YEARS_DAY =
new SimpleHoliday(Calendar.JANUARY, 1, "New Year's Day");
/**
* Epiphany, January 6th
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday EPIPHANY =
new SimpleHoliday(Calendar.JANUARY, 6, "Epiphany");
/**
* May Day, May 1st
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday MAY_DAY =
new SimpleHoliday(Calendar.MAY, 1, "May Day");
/**
* Assumption, August 15th
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday ASSUMPTION =
new SimpleHoliday(Calendar.AUGUST, 15, "Assumption");
/**
* All Saints' Day, November 1st
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday ALL_SAINTS_DAY =
new SimpleHoliday(Calendar.NOVEMBER, 1, "All Saints' Day");
/**
* All Souls' Day, November 1st
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday ALL_SOULS_DAY =
new SimpleHoliday(Calendar.NOVEMBER, 2, "All Souls' Day");
/**
* Immaculate Conception, December 8th
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday IMMACULATE_CONCEPTION =
new SimpleHoliday(Calendar.DECEMBER, 8, "Immaculate Conception");
/**
* Christmas Eve, December 24th
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday CHRISTMAS_EVE =
new SimpleHoliday(Calendar.DECEMBER, 24, "Christmas Eve");
/**
* Christmas, December 25th
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday CHRISTMAS =
new SimpleHoliday(Calendar.DECEMBER, 25, "Christmas");
/**
* Boxing Day, December 26th
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday BOXING_DAY =
new SimpleHoliday(Calendar.DECEMBER, 26, "Boxing Day");
/**
* Saint Stephen's Day, December 26th
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday ST_STEPHENS_DAY =
new SimpleHoliday(Calendar.DECEMBER, 26, "St. Stephen's Day");
/**
* New Year's Eve, December 31st
* @draft ICU 2.8
- * @provisional This API might change or be removed in a future release.
*/
public static final SimpleHoliday NEW_YEARS_EVE =
new SimpleHoliday(Calendar.DECEMBER, 31, "New Year's Eve");
/**
* {@inheritDoc}
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
@Override
public void getOffsetFromLocal(long date,
* @param locale the ULocale to canonicalize
* @return the ULocale created from the canonical version of the ULocale.
* @draft ICU 67
- * @provisional This API might change or be removed in a future release.
*/
public static ULocale createCanonical(ULocale locale) {
return createCanonical(locale.getName());
* locale data, then the valid locale is <i>null</i>.
*
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static Type ACTUAL_LOCALE = new Type();
* <p>Note: The valid locale will be returned correctly in ICU
* 3.0 or later. In ICU 2.8, it is not returned correctly.
* @draft ICU 2.8 (retain)
- * @provisional This API might change or be removed in a future release.
*/
public static Type VALID_LOCALE = new Type();
* @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE
* @see com.ibm.icu.util.ULocale#VALID_LOCALE
* @draft ICU 2.8 (retainAll)
- * @provisional This API might change or be removed in a future release.
*/
public static final class Type {
private Type() {}
/**
* {@inheritDoc}
* @draft ICU 69
- * @provisional This API might change or be removed in a future release.
*/
@Override
public void getOffsetFromLocal(long date,
}
else if (isDraft(name)) {
System.out.println(" * @draft ICU " + getVersion(name, thisVersion));
- System.out.println(" * @provisional This API might change or be removed in a future release.");
} else {
System.out.println(" * @stable ICU " + getVersion(name, thisVersion));
}
public void TestIdentifierDetails() {
MeasureUnit joule = MeasureUnit.forIdentifier("joule");
assertEquals("Initial joule", "joule", joule.getIdentifier());
-
+
// "Invalid prefix" test not needed: in Java we cannot pass a
// non-existant enum instance. (In C++ an int can be typecast.)
+++ /dev/null
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
- *******************************************************************************
- * Copyright (C) 2006-2010, International Business Machines Corporation and *
- * others. All Rights Reserved. *
- *******************************************************************************
- */
-package com.ibm.icu.dev.tool.docs;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-public class SwatDeprecated {
- private File srcFile;
- private File dstFile;
- private int maxLength = 85;
- private String srcPrefix;
- private String dstPrefix;
- private String srcTag;
- private String trgTag;
- private boolean overwrite;
- private int verbosity;
- private int cc; // changed file count
- //private boolean inPlace;
- private String copyYear;
-
- private PrintWriter pw = new PrintWriter(System.out);
-
- private static FilenameFilter ff = new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return (new File(dir, name).isDirectory() && !"CVS".equals(name)) ||
- (!name.equals("SwatDeprecated.java") && name.endsWith(".java"));
- }
- };
-
- public static void main(String[] args) {
- String src = System.getProperty("user.dir");
- String dst = src;
- boolean dep = true;
- boolean ovr = false;
- int vrb = 1;
-
- for (int i = 0; i < args.length; ++i) {
- String arg = args[i].toLowerCase();
- if (arg.charAt(0) == '-') {
- if (arg.equals("-src")) {
- src = args[++i];
- }
- else if (arg.equals("-dst")) {
- dst = args[++i];
- }
- else if (arg.equals("-dep")) {
- dep = true;
- }
- else if (arg.equals("-prov")) {
- dep = false;
- }
- else if (arg.equals("-overwrite")) {
- ovr = true;
- }
- else if (arg.equals("-silent")) { // no output
- vrb = 0;
- }
- else if (arg.equals("-quiet")) { // output parameters and count of changed files (default)
- vrb = 1;
- }
- else if (arg.equals("-verbose")) { // output names of modified files
- vrb = 2;
- }
- else if (arg.equals("-noisy")) { // output names of files not modified
- vrb = 3;
- }
- else if (arg.equals("-copydebug")) { // output copyright debugging
- vrb = 4;
- }
- else if (arg.equals("-debug")) { // output all debugging
- vrb = 5;
- }
- }
- }
-
- new SwatDeprecated(src, dst, dep, ovr, vrb).run();
- }
-
- public SwatDeprecated(String src, String dst, boolean dep, boolean overwrite, int verbosity) {
- this.srcFile = new File(src);
- this.dstFile = new File(dst);
- this.overwrite = overwrite;
- this.verbosity = verbosity;
- this.copyYear = new SimpleDateFormat("yyyy").format(new Date());
-
- this.srcTag = "@deprecated This is a draft API and might change in a future release of ICU.";
- this.trgTag = "@provisional This API might change or be removed in a future release.";
- if (!dep) {
- String temp = srcTag;
- srcTag = trgTag;
- trgTag = temp;
- }
- try {
- this.srcPrefix = srcFile.getCanonicalPath();
- this.dstPrefix = dstFile.getCanonicalPath();
- }
- catch (IOException e) {
- RuntimeException re = new RuntimeException(e.getMessage());
- re.initCause(e);
- throw re;
- }
-
- //this.inPlace = srcPrefix.equals(dstPrefix);
- this.cc = 0;
-
- if (verbosity >= 1) {
- pw.println("replacing '" + srcTag + "'");
- pw.println(" with '" + trgTag + "'");
- pw.println();
- pw.println(" source: '" + srcPrefix + "'");
- pw.println("destination: '" + dstPrefix + "'");
- pw.println(" overwrite: " + overwrite);
- pw.println(" verbosity: " + verbosity);
- pw.flush();
- }
- }
-
- public void run() {
- if (!srcFile.exists()) {
- throw new RuntimeException("file " + srcFile.getPath() + " does not exist.");
- }
- doList(srcFile);
- if (verbosity >= 1) {
- pw.println("changed " + cc + " file(s)");
- pw.flush();
- }
- }
-
- public void doList(File file) {
- String[] filenames = file.list(ff);
- if (verbosity >= 5) {
- pw.println(file.getPath());
- dumpList(filenames);
- pw.flush();
- }
- for (int i = 0; i < filenames.length; ++i) {
- File f = new File(file, filenames[i]);
- if (f.isDirectory()) {
- doList(f);
- } else {
- processFile(f);
- }
- }
- }
-
- public void processFile(File inFile) {
- File bakFile = null;
- try {
- String inPath = inFile.getCanonicalPath();
- if (verbosity >= 5) {
- pw.println("processFile: " + inPath);
- }
-
- String outPath = dstPrefix + inPath.substring(srcPrefix.length());
- File outFile = new File(outPath);
-
- File tmpFile = null;
- if (outFile.exists()) {
- if (!overwrite) {
- throw new RuntimeException("no permission to overwrite file: " + outPath);
- } else {
- bakFile = outFile;
- tmpFile = File.createTempFile(inFile.getName(), null, inFile.getParentFile());
- }
- } else {
- tmpFile = outFile;
- File parent = tmpFile.getParentFile();
- parent.mkdirs();
- tmpFile.createNewFile();
- }
-
- String tmpPath = tmpFile.getPath();
- if (verbosity >= 5) {
- pw.println("tmpFile: " + tmpPath);
- }
-
- InputStream is = new FileInputStream(inFile);
- OutputStream os = new FileOutputStream(tmpFile);
-
- PrintStream ps = new PrintStream(os);
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
-
- String line;
- int n = 0;
- int tc = 0;
-// boolean debug = false;
- while (null != (line = br.readLine())) {
- // int temp = line.indexOf("@deprecated");
- int ix = line.indexOf(srcTag);
-// if (temp != -1 && ix == -1) {
-// if (debug == false) {
-// debug = true;
-// pw.println("file: " + name);
-// }
-// pw.println("[" + n + "] " + line);
-// pw.flush();
-// }
- if (ix != -1) {
- if (verbosity >= 5) {
- pw.println("[" + n + "] " + line);
- }
-
- line = line.substring(0,ix) + trgTag;
-
- ++tc;
- } else if (n < 20) {
- // swat copyrights in the first 20 lines while we're at it
- ix = line.indexOf("opyright");
- if (ix != -1) {
- String nline = null;
- do {
- if (verbosity == 4) {
- pw.println("[" + n + "] " + line);
- }
- ix = line.indexOf("-200");
- if (ix != -1) {
- nline = line.substring(0, ix) + "-" + copyYear + line.substring(ix+5);
- break;
- }
- ix = line.indexOf("- 200");
- if (ix != -1) {
- nline = line.substring(0, ix) + "-" + copyYear + line.substring(ix+6);
- break;
- }
- ix = line.indexOf("-199");
- if (ix != -1) {
- nline = line.substring(0, ix) + "-" + copyYear + line.substring(ix+5);
- break;
- }
- ix = line.indexOf(copyYear);
- if (ix != -1) {
- break; // nothing needs changing
- }
- ix = line.indexOf("200");
- if (ix != -1) {
- nline = line.substring(0, ix+4) + "-" + copyYear + line.substring(ix+4);
- break;
- }
- ix = line.indexOf("199");
- if (ix != -1) {
- nline = line.substring(0, ix+4) + "-" + copyYear + line.substring(ix+4);
- break;
- }
- } while (false);
-
- if (nline != null) {
- if (verbosity >= 4) {
- pw.println(" --> " + nline);
- }
- line = nline;
- }
- }
- }
- ps.println(line);
- ++n;
- }
- ps.flush();
- is.close();
- os.close();
-
- if (tc == 0) { // nothing changed, forget this file
- if (verbosity >= 3) {
- pw.println("no changes in file: " + inPath);
- }
- if (!tmpFile.delete()) {
- throw new RuntimeException("unable to delete unneeded temporary file: " + tmpPath);
- }
-
- return;
- }
-
- if (bakFile != null) {
- if (bakFile.exists()) {
- bakFile.delete();
- }
- if (!tmpFile.renameTo(bakFile)) {
- pw.println("warning: couldn't rename temp file to: " + outPath);
- }
- }
-
- outFile.setLastModified(inFile.lastModified());
-
- if (verbosity >= 2) {
- pw.println(inPath);
- pw.flush();
- }
- }
- catch (IOException e) {
- RuntimeException re = new RuntimeException(e.getMessage());
- re.initCause(e);
- throw re;
- }
- finally {
- pw.flush();
- }
-
- ++cc;
- }
-
- public void dumpList(String[] names) {
- if (names == null) {
- pw.print("null");
- } else {
- pw.print("{");
- int lc = 0;
- if (names.length > 0) {
- pw.println();
- pw.print(" ");
- lc = 4;
- }
- for (int i = 0; i < names.length; ++i) {
- String name = names[i];
- int nl = name.length();
- if (lc + nl > maxLength) {
- pw.println();
- pw.print(" ");
- lc = 4;
- }
- pw.print(name);
- pw.print(", ");
- lc += nl + 2;
- }
- if (names.length > 0) {
- pw.println();
- }
- pw.print("} ");
- }
- }
-}