* Typo, use DUPLOYAN
* @deprecated ICU 54
*/
+ @Deprecated
public static final int DUPLOYAN_SHORTAND = DUPLOYAN;
/**
* ISO 15924 script code
private boolean[] explicit = new boolean[StandardPluralCategories.COUNT];
/**
- * Internal class for mapping from two StandardPluralCategories values to another.
+ * Constructor
*
* @internal
* @deprecated This API is ICU internal only.
*/
- public static final class Matrix implements Comparable<Matrix>, Cloneable {
+ @Deprecated
+ public PluralRanges() {
+ }
+
+ /**
+ * Internal class for mapping from two StandardPluralCategories values to another.
+ */
+ private static final class Matrix implements Comparable<Matrix>, Cloneable {
private byte[] data = new byte[StandardPluralCategories.COUNT * StandardPluralCategories.COUNT];
{
for (int i = 0; i < data.length; ++i) {
}
}
+ Matrix() {
+ }
+
/**
* Internal method for setting.
- *
- * @internal
- * @deprecated This API is ICU internal only.
*/
- public void set(StandardPluralCategories start, StandardPluralCategories end, StandardPluralCategories result) {
+ @SuppressWarnings("unused")
+ void set(StandardPluralCategories start, StandardPluralCategories end, StandardPluralCategories result) {
data[start.ordinal() * StandardPluralCategories.COUNT + end.ordinal()] = result == null ? (byte) -1
: (byte) result.ordinal();
}
/**
* Internal method for setting; throws exception if already set.
- *
- * @internal
- * @deprecated This API is ICU internal only.
*/
- public void setIfNew(StandardPluralCategories start, StandardPluralCategories end,
+ void setIfNew(StandardPluralCategories start, StandardPluralCategories end,
StandardPluralCategories result) {
byte old = data[start.ordinal() * StandardPluralCategories.COUNT + end.ordinal()];
if (old >= 0) {
/**
* Internal method for getting.
- *
- * @internal
- * @deprecated This API is ICU internal only.
*/
- public StandardPluralCategories get(StandardPluralCategories start, StandardPluralCategories end) {
+ StandardPluralCategories get(StandardPluralCategories start, StandardPluralCategories end) {
byte result = data[start.ordinal() * StandardPluralCategories.COUNT + end.ordinal()];
return result < 0 ? null : StandardPluralCategories.VALUES.get(result);
}
/**
* Internal method to see if <*,end> values are all the same.
- *
- * @internal
- * @deprecated This API is ICU internal only.
*/
- public StandardPluralCategories endSame(StandardPluralCategories end) {
+ @SuppressWarnings("unused")
+ StandardPluralCategories endSame(StandardPluralCategories end) {
StandardPluralCategories first = null;
for (StandardPluralCategories start : StandardPluralCategories.VALUES) {
StandardPluralCategories item = get(start, end);
/**
* Internal method to see if <start,*> values are all the same.
- *
- * @internal
- * @deprecated This API is ICU internal only.
*/
- public StandardPluralCategories startSame(StandardPluralCategories start,
+ @SuppressWarnings("unused")
+ StandardPluralCategories startSame(StandardPluralCategories start,
EnumSet<StandardPluralCategories> endDone, Output<Boolean> emit) {
emit.value = false;
StandardPluralCategories first = null;
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Deprecated
public void add(StandardPluralCategories rangeStart, StandardPluralCategories rangeEnd,
StandardPluralCategories result) {
if (isFrozen) {
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Deprecated
public StandardPluralCategories get(StandardPluralCategories start, StandardPluralCategories end) {
StandardPluralCategories result = matrix.get(start, end);
return result == null ? end : result;
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Deprecated
public boolean isExplicit(StandardPluralCategories start, StandardPluralCategories end) {
return matrix.get(start, end) != null;
}
* @internal
* @deprecated This API is ICU internal only.
*/
+ @Deprecated
public boolean isExplicitlySet(StandardPluralCategories count) {
return explicit[count.ordinal()];
}
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+ @Deprecated
@Override
public boolean equals(Object other) {
if (this == other) {
return matrix.equals(otherPR.matrix) && Arrays.equals(explicit, otherPR.explicit);
}
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
@Override
+ @Deprecated
public int hashCode() {
return matrix.hashCode();
}
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+ @Deprecated
public int compareTo(PluralRanges that) {
return matrix.compareTo(that.matrix);
}
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+ @Deprecated
public boolean isFrozen() {
return isFrozen;
}
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+ @Deprecated
public PluralRanges freeze() {
isFrozen = true;
return this;
}
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+ @Deprecated
public PluralRanges cloneAsThawed() {
PluralRanges result = new PluralRanges();
result.explicit = explicit.clone();
return result;
}
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
@Override
+ @Deprecated
public String toString() {
return matrix.toString();
}
* @return the code point IF the string is non-null and consists of a single code point.
* otherwise returns -1.
* @param s to test
+ * @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
public static int getSingleCodePoint(CharSequence s) {
if (s == null || s.length() == 0) {
return -1;
* @param codePoint to test
* @param s to test
* @return equivalent of code point comparator comparing two strings.
+ * @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
public static int compareCodePoint(int codePoint, CharSequence s) {
if (s == null) {
return 1;
/**
* Append the <code>toPattern()</code> representation of a
* string to the given <code>StringBuffer</code>.
- * @return
*/
private static StringBuffer _appendToPat(StringBuffer buf, String s, boolean escapeUnprintable) {
int cp;
/**
* Append the <code>toPattern()</code> representation of a
* character to the given <code>StringBuffer</code>.
- * @return
*/
private static StringBuffer _appendToPat(StringBuffer buf, int c, boolean escapeUnprintable) {
// "Utility.isUnprintable(c)" seems redundant since the the call
/**
* A struct-like class used for iteration through ranges, for faster iteration than by String.
- * Read about the restrictions on usage in {@link #UnicodeSet.ranges()}.
+ * Read about the restrictions on usage in {@link UnicodeSet#ranges()}.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public static class EntryRange {
/**
* The starting code point of the range.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public int codepoint;
/**
* The ending code point of the range
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public int codepointEnd;
-
+
+ EntryRange() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
+ */
@Override
public String toString() {
StringBuffer b = new StringBuffer();
* // do something with each string;
* }
* </pre>
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public Iterable<EntryRange> ranges() {
return new EntryRanges();
* <tr><th>NOT_CONTAINED</th><td>xxxabcyyy|</td></tr>
* </table>
* </p>The entire string is traversed.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public class UnicodeSetSpanner {
*
* @param source
* the original UnicodeSet
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public UnicodeSetSpanner(UnicodeSet source) {
unicodeSet = source;
* Returns the UnicodeSet used for processing. It is frozen iff the original was.
*
* @return the construction set.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public UnicodeSet getUnicodeSet() {
return unicodeSet;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*
- * @see java.lang.Object#equals(java.lang.Object)
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
@Override
public boolean equals(Object other) {
return other instanceof UnicodeSetSpanner && unicodeSet.equals(((UnicodeSetSpanner) other).unicodeSet);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*
- * @see java.lang.Object#hashCode()
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
@Override
public int hashCode() {
* Options for replaceFrom and countIn to control how to treat each matched span. The name is from "qualifier" as used in regex,
* since it is similar to whether one is replacing [abc] by x, or [abc]* by x.
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public enum CountMethod {
/**
* Collapse spans. That is, modify/count the entire matching span as a single item, instead of separate
* code points.
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
WHOLE_SPAN,
/**
* <li>spanning with [{ab}] will count two MIN_ELEMENTS.</li>
* <li>spanning with [ab{ab}] will also count two MIN_ELEMENTS.</li>
* </ul>
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
MIN_ELEMENTS,
// Note: could in the future have an additional option MAX_ELEMENTS
* @param sequence
* the sequence to count characters in
* @return the count. Zero if there are none.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public int countIn(CharSequence sequence) {
return countIn(sequence, CountMethod.MIN_ELEMENTS, SpanCondition.SIMPLE);
* @param sequence
* the sequence to count characters in
* @return the count. Zero if there are none.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public int countIn(CharSequence sequence, CountMethod quantifier) {
return countIn(sequence, quantifier, SpanCondition.SIMPLE);
* NOT_CONTAINED is the reverse.
* <br><b>WARNING: </b> when a UnicodeSet contains strings, there may be unexpected behavior in edge cases.
* @return the count. Zero if there are none.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public int countIn(CharSequence sequence, CountMethod quantifier, SpanCondition spanCondition) {
int count = 0;
* @param sequence
* charsequence to replace matching spans in.
* @return modified string.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public String deleteFrom(CharSequence sequence) {
return replaceFrom(sequence, "", CountMethod.WHOLE_SPAN, SpanCondition.SIMPLE);
* @param spanCondition
* specify whether to modify the matching spans (CONTAINED or SIMPLE) or the non-matching (NOT_CONTAINED)
* @return modified string.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public String deleteFrom(CharSequence sequence, SpanCondition spanCondition) {
return replaceFrom(sequence, "", CountMethod.WHOLE_SPAN, spanCondition);
* @param replacement
* replacement sequence. To delete, use ""
* @return modified string.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public String replaceFrom(CharSequence sequence, CharSequence replacement) {
return replaceFrom(sequence, replacement, CountMethod.MIN_ELEMENTS, SpanCondition.SIMPLE);
* @param quantifier
* whether to treat an entire span as a match, or individual code points
* @return modified string.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public String replaceFrom(CharSequence sequence, CharSequence replacement, CountMethod quantifier) {
return replaceFrom(sequence, replacement, quantifier, SpanCondition.SIMPLE);
* @param quantifier
* specify whether to collapse or do codepoint by codepoint.
* @return modified string.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public String replaceFrom(CharSequence sequence, CharSequence replacement, CountMethod quantifier,
SpanCondition spanCondition) {
/**
* Options for the trim() method
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public enum TrimOption {
/**
* Trim leading spans.
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
LEADING,
/**
* Trim leading and trailing spans.
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
BOTH,
/**
* Trim trailing spans.
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
TRAILING;
}
*
* ... returns {@code "catbab"}.
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public CharSequence trim(CharSequence sequence) {
return trim(sequence, TrimOption.BOTH, SpanCondition.SIMPLE);
*
* ... returns {@code "catbab"}.
*
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public CharSequence trim(CharSequence sequence, TrimOption trimOption) {
return trim(sequence, trimOption, SpanCondition.SIMPLE);
* @param spanCondition
* SIMPLE, CONTAINED or NOT_CONTAINED
* @return a subsequence
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public CharSequence trim(CharSequence sequence, TrimOption trimOption, SpanCondition spanCondition) {
int endLeadContained, startTrailContained;
* @see #WEEKEND_ONSET
* @see #WEEKEND_CEASE
* @see #getDayOfWeekType
- * @stable ICU 2.0
- * @deprecated use getWeekDataForRegion, getWeekData, setWeekData
+ * @deprecated ICU 54 use {@link #getWeekDataForRegion(String)}, {@link #getWeekData()}, {@link #setWeekData(WeekData)}
*/
@Deprecated
public static final int WEEKDAY = 0;
* @see #WEEKEND_ONSET
* @see #WEEKEND_CEASE
* @see #getDayOfWeekType
- * @stable ICU 2.0
- * @deprecated use getWeekDataForRegion, getWeekData, setWeekData
+ * @deprecated ICU 54 use {@link #getWeekDataForRegion(String)}, {@link #getWeekData()}, {@link #setWeekData(WeekData)}
*/
@Deprecated
public static final int WEEKEND = 1;
* @see #WEEKEND
* @see #WEEKEND_CEASE
* @see #getDayOfWeekType
- * @stable ICU 2.0
- * @deprecated use getWeekDataForRegion, getWeekData, setWeekData
+ * @deprecated ICU 54 use {@link #getWeekDataForRegion(String)}, {@link #getWeekData()}, {@link #setWeekData(WeekData)}
*/
@Deprecated
public static final int WEEKEND_ONSET = 2;
* @see #WEEKEND
* @see #WEEKEND_ONSET
* @see #getDayOfWeekType
- * @stable ICU 2.0
- * @deprecated use getWeekDataForRegion, getWeekData, setWeekData
+ * @deprecated ICU 54 use {@link #getWeekDataForRegion(String)}, {@link #getWeekData()}, {@link #setWeekData(WeekData)}
*/
@Deprecated
public static final int WEEKEND_CEASE = 3;
* @see #getWeekendTransition
* @see #isWeekend(Date)
* @see #isWeekend()
- * @stable ICU 2.0
- * @deprecated use getWeekDataForRegion, getWeekData, setWeekData
+ * @deprecated ICU 54 use {@link #getWeekDataForRegion(String)}, {@link #getWeekData()}, {@link #setWeekData(WeekData)}
*/
@Deprecated
public int getDayOfWeekType(int dayOfWeek) {
* @see #getDayOfWeekType
* @see #isWeekend(Date)
* @see #isWeekend()
- * @stable ICU 2.0
- * @deprecated use getWeekDataForRegion, getWeekData, setWeekData
+ * @deprecated ICU 54 use {@link #getWeekDataForRegion(String)}, {@link #getWeekData()}, {@link #setWeekData(WeekData)}
*/
@Deprecated
public int getWeekendTransition(int dayOfWeek) {
/**
* Simple, immutable struct-like class for access to the CLDR weekend data.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public static final class WeekData {
/**
* the first day of the week, where 1 = Sunday and 7 = Saturday
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public final int firstDayOfWeek;
/**
* the minimal number of days in the first week
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public final int minimalDaysInFirstWeek;
/**
* the onset day, where 1 = Sunday and 7 = Saturday
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public final int weekendOnset;
/**
* the onset time in millis during the onset day
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public final int weekendOnsetMillis;
/**
* the cease day, where 1 = Sunday and 7 = Saturday
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public final int weekendCease;
/**
* the cease time in millis during the cease day. Exclusive, so the max is 24:00:00.000.
* Note that this will format as 00:00 the next day.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public final int weekendCeaseMillis;
/**
* Constructor
+ *
+ * @param fdow the first day of the week, where 1 = Sunday and 7 = Saturday
+ * @param mdifw the minimal number of days in the first week
+ * @param weekendOnset the onset day, where 1 = Sunday and 7 = Saturday
+ * @param weekendOnsetMillis the onset time in millis during the onset day
+ * @param weekendCease the cease day, where 1 = Sunday and 7 = Saturday
+ * @param weekendCeaseMillis the cease time in millis during the cease day.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public WeekData(int fdow, int mdifw,
int weekendOnset, int weekendOnsetMillis,
this.weekendCeaseMillis = weekendCeaseMillis;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
+ */
@Override
public int hashCode() {
return ((((firstDayOfWeek * 37 + minimalDaysInFirstWeek) * 37 + weekendOnset) * 37
+ weekendOnsetMillis) * 37 + weekendCease) * 37 + weekendCeaseMillis;
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
+ */
@Override
public boolean equals(Object other) {
if (this == other) {
&& weekendCease == that.weekendCease
&& weekendCeaseMillis == that.weekendCeaseMillis;
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
+ */
@Override
public String toString() {
return "{" + firstDayOfWeek
}
/**
- * Return simple, immutable struct-like class for access to the CLDR weekend data.
+ * {@icu} Return simple, immutable struct-like class for access to the CLDR weekend data.
* @param region The input region. The results are undefined if the region code is not valid.
* @return the WeekData for the input region
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public static WeekData getWeekDataForRegion(String region) {
return WEEK_DATA_CACHE.createInstance(region, region);
}
/**
- * Return simple, immutable struct-like class for access to the weekend data in this calendar.
+ * {@icu} Return simple, immutable struct-like class for access to the weekend data in this calendar.
* @return the WeekData for this calendar.
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public WeekData getWeekData() {
return new WeekData(firstDayOfWeek, minimalDaysInFirstWeek, weekendOnset, weekendOnsetMillis, weekendCease, weekendCeaseMillis);
}
/**
- * Set data in this calendar based on the WeekData input.
+ * {@icu} Set data in this calendar based on the WeekData input.
* @param wdata The week data to use
* @return this, for chaining
+ *
+ * @draft ICU 54
+ * @provisional This is a draft API and might change in a future release of ICU.
*/
public Calendar setWeekData(WeekData wdata) {
setFirstDayOfWeek(wdata.firstDayOfWeek);