ICU-10993 Fixed API status tag problems.
X-SVN-Rev: 36412
This commit is contained in:
parent
a40f35bba5
commit
03955adbd3
@ -766,6 +766,7 @@ public final class UScript {
|
||||
* Typo, use DUPLOYAN
|
||||
* @deprecated ICU 54
|
||||
*/
|
||||
@Deprecated
|
||||
public static final int DUPLOYAN_SHORTAND = DUPLOYAN;
|
||||
/**
|
||||
* ISO 15924 script code
|
||||
|
@ -29,12 +29,19 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
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) {
|
||||
@ -42,24 +49,22 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -72,22 +77,17 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
|
||||
/**
|
||||
* 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);
|
||||
@ -107,11 +107,9 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
|
||||
/**
|
||||
* 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;
|
||||
@ -196,6 +194,7 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
@Deprecated
|
||||
public void add(StandardPluralCategories rangeStart, StandardPluralCategories rangeEnd,
|
||||
StandardPluralCategories result) {
|
||||
if (isFrozen) {
|
||||
@ -237,6 +236,7 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
* @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;
|
||||
@ -254,6 +254,7 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isExplicit(StandardPluralCategories start, StandardPluralCategories end) {
|
||||
return matrix.get(start, end) != null;
|
||||
}
|
||||
@ -267,10 +268,17 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
* @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) {
|
||||
@ -283,24 +291,54 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
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();
|
||||
@ -308,7 +346,13 @@ public final class PluralRanges implements Freezable<PluralRanges>, Comparable<P
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public String toString() {
|
||||
return matrix.toString();
|
||||
}
|
||||
|
@ -2617,7 +2617,10 @@ public final class UTF16 {
|
||||
* @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;
|
||||
@ -2650,7 +2653,10 @@ public final class UTF16 {
|
||||
* @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;
|
||||
|
@ -601,7 +601,6 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
||||
/**
|
||||
* 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;
|
||||
@ -615,7 +614,6 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
||||
/**
|
||||
* 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
|
||||
@ -4116,18 +4114,36 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
||||
|
||||
/**
|
||||
* 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();
|
||||
@ -4155,6 +4171,9 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
||||
* // 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();
|
||||
|
@ -37,6 +37,9 @@ import com.ibm.icu.util.OutputInt;
|
||||
* <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 {
|
||||
|
||||
@ -48,6 +51,9 @@ 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;
|
||||
@ -57,26 +63,31 @@ public class UnicodeSetSpanner {
|
||||
* 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() {
|
||||
@ -87,12 +98,16 @@ public class UnicodeSetSpanner {
|
||||
* 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,
|
||||
/**
|
||||
@ -105,6 +120,9 @@ public class UnicodeSetSpanner {
|
||||
* <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
|
||||
@ -117,6 +135,9 @@ public class UnicodeSetSpanner {
|
||||
* @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);
|
||||
@ -128,6 +149,9 @@ public class UnicodeSetSpanner {
|
||||
* @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);
|
||||
@ -144,6 +168,9 @@ public class UnicodeSetSpanner {
|
||||
* 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;
|
||||
@ -169,6 +196,9 @@ public class UnicodeSetSpanner {
|
||||
* @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);
|
||||
@ -182,6 +212,9 @@ public class UnicodeSetSpanner {
|
||||
* @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);
|
||||
@ -196,6 +229,9 @@ public class UnicodeSetSpanner {
|
||||
* @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);
|
||||
@ -211,6 +247,9 @@ public class UnicodeSetSpanner {
|
||||
* @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);
|
||||
@ -229,6 +268,9 @@ public class UnicodeSetSpanner {
|
||||
* @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) {
|
||||
@ -264,21 +306,29 @@ public class UnicodeSetSpanner {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
@ -295,6 +345,8 @@ public class UnicodeSetSpanner {
|
||||
*
|
||||
* ... 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);
|
||||
@ -312,6 +364,8 @@ public class UnicodeSetSpanner {
|
||||
*
|
||||
* ... 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);
|
||||
@ -336,6 +390,9 @@ public class UnicodeSetSpanner {
|
||||
* @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;
|
||||
|
@ -1126,8 +1126,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
* @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;
|
||||
@ -1139,8 +1138,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
* @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;
|
||||
@ -1153,8 +1151,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
* @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;
|
||||
@ -1167,8 +1164,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
* @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;
|
||||
@ -4338,8 +4334,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
* @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) {
|
||||
@ -4384,8 +4379,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
* @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) {
|
||||
@ -4517,37 +4511,68 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
|
||||
/**
|
||||
* 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,
|
||||
@ -4560,11 +4585,24 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
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) {
|
||||
@ -4581,6 +4619,13 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
&& 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
|
||||
@ -4594,26 +4639,35 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user