ICU-4356 add new Java 5 APIs missing from ICU4J
X-SVN-Rev: 17339
This commit is contained in:
parent
dcd6895812
commit
f18c6dc027
@ -681,6 +681,32 @@ public class IBMCalendarTest extends CalendarTest {
|
||||
}
|
||||
}
|
||||
|
||||
public void TestComparable() {
|
||||
GregorianCalendar c0 = new GregorianCalendar();
|
||||
GregorianCalendar c1 = new GregorianCalendar();
|
||||
c1.add(Calendar.DAY_OF_MONTH, 1);
|
||||
if (c0.compareTo(c1) >= 0) {
|
||||
errln("calendar " + c0 + " not < " + c1);
|
||||
}
|
||||
c0.add(Calendar.MONTH, 1);
|
||||
if (c0.compareTo(c1) <= 0) {
|
||||
errln("calendar " + c0 + " not > " + c1);
|
||||
}
|
||||
|
||||
c0.setTimeInMillis(c1.getTimeInMillis());
|
||||
if (c0.compareTo(c1) != 0) {
|
||||
errln("calendar " + c0 + " not == " + c1);
|
||||
}
|
||||
|
||||
// coverage
|
||||
try {
|
||||
c0.compareTo((Object)null);
|
||||
errln("calendar.compareTo didn't object to null arg");
|
||||
}
|
||||
catch (NullPointerException npe) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Miscellaneous tests to increase coverage.
|
||||
*/
|
||||
|
@ -2627,7 +2627,21 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
|
||||
* @see #getUnicodeNumericValue
|
||||
*/
|
||||
public static final double NO_NUMERIC_VALUE = -123456789;
|
||||
|
||||
|
||||
/**
|
||||
* Compatibility constant for Java Character's MIN_RADIX.
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static final int MIN_RADIX = java.lang.Character.MIN_RADIX;
|
||||
|
||||
/**
|
||||
* Compatibility constant for Java Character's MAX_RADIX.
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static final int MAX_RADIX = java.lang.Character.MAX_RADIX;
|
||||
|
||||
// public methods ----------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -2853,6 +2867,20 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility override of Java deprecated method. This
|
||||
* method will always remain deprecated. Delegates to
|
||||
* java.lang.Character.isSpace.
|
||||
* @param cp the code point
|
||||
* @return true if the code point is a space character as
|
||||
* defined by java.lang.Character.isSpace.
|
||||
* @draft ICU 3.4
|
||||
* @deprecated
|
||||
*/
|
||||
public static boolean isSpace(int ch) {
|
||||
return java.lang.Character.isSpace((char)(ch & 0xffff));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value indicating a code point's Unicode category.
|
||||
* Up-to-date Unicode implementation of java.lang.Character.getType()
|
||||
@ -2958,7 +2986,59 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
|
||||
| (1 << UCharacterCategory.OTHER_LETTER)
|
||||
| (1 << UCharacterCategory.DECIMAL_DIGIT_NUMBER))) != 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compatibility override of Java deprecated method. This
|
||||
* method will always remain deprecated. Delegates to
|
||||
* java.lang.Character.isJavaIdentifierStart.
|
||||
* @param cp the code point
|
||||
* @return true if the code point can start a java identifier.
|
||||
* @draft ICU 3.4
|
||||
* @deprecated
|
||||
*/
|
||||
public static boolean isJavaLetter(int cp) {
|
||||
return isJavaIdentifierStart(cp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility override of Java deprecated method. This
|
||||
* method will always remain deprecated. Delegates to
|
||||
* java.lang.Character.isJavaIdentifierPart.
|
||||
* @param cp the code point
|
||||
* @return true if the code point can continue a java identifier.
|
||||
* @draft ICU 3.4
|
||||
* @deprecated
|
||||
*/
|
||||
public static boolean isJavaLetterOrDigit(int cp) {
|
||||
return isJavaLetterOrDigit(cp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility override of Java method, delegates to
|
||||
* java.lang.Character.isJavaIdentifierStart.
|
||||
* @param cp the code point
|
||||
* @return true if the code point can start a java identifier.
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static boolean isJavaIdentifierStart(int cp) {
|
||||
// note, downcast to char for jdk 1.4 compatibility
|
||||
return java.lang.Character.isJavaIdentifierStart((char)cp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility override of Java method, delegates to
|
||||
* java.lang.Character.isJavaIdentifierPart.
|
||||
* @param cp the code point
|
||||
* @return true if the code point can continue a java identifier.
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static boolean isJavaIdentifierPart(int cp) {
|
||||
// note, downcast to char for jdk 1.4 compatibility
|
||||
return java.lang.Character.isJavaIdentifierPart((char)cp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the specified code point is a lowercase character.
|
||||
* UnicodeData only contains case mappings for code points where they are
|
||||
|
@ -30,184 +30,184 @@ public class UCharacterEnums {
|
||||
* Unassigned character type
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int UNASSIGNED = 0;
|
||||
public static final byte UNASSIGNED = 0;
|
||||
|
||||
/**
|
||||
* Character type Cn
|
||||
* Not Assigned (no characters in [UnicodeData.txt] have this property)
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public static final int GENERAL_OTHER_TYPES = 0;
|
||||
public static final byte GENERAL_OTHER_TYPES = 0;
|
||||
|
||||
/**
|
||||
* Character type Lu
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int UPPERCASE_LETTER = 1;
|
||||
public static final byte UPPERCASE_LETTER = 1;
|
||||
|
||||
/**
|
||||
* Character type Ll
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int LOWERCASE_LETTER = 2;
|
||||
public static final byte LOWERCASE_LETTER = 2;
|
||||
|
||||
/**
|
||||
* Character type Lt
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
|
||||
public static final int TITLECASE_LETTER = 3;
|
||||
public static final byte TITLECASE_LETTER = 3;
|
||||
|
||||
/**
|
||||
* Character type Lm
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int MODIFIER_LETTER = 4;
|
||||
public static final byte MODIFIER_LETTER = 4;
|
||||
|
||||
/**
|
||||
* Character type Lo
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int OTHER_LETTER = 5;
|
||||
public static final byte OTHER_LETTER = 5;
|
||||
|
||||
/**
|
||||
* Character type Mn
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int NON_SPACING_MARK = 6;
|
||||
public static final byte NON_SPACING_MARK = 6;
|
||||
|
||||
/**
|
||||
* Character type Me
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int ENCLOSING_MARK = 7;
|
||||
public static final byte ENCLOSING_MARK = 7;
|
||||
|
||||
/**
|
||||
* Character type Mc
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int COMBINING_SPACING_MARK = 8;
|
||||
public static final byte COMBINING_SPACING_MARK = 8;
|
||||
|
||||
/**
|
||||
* Character type Nd
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int DECIMAL_DIGIT_NUMBER = 9;
|
||||
public static final byte DECIMAL_DIGIT_NUMBER = 9;
|
||||
|
||||
/**
|
||||
* Character type Nl
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int LETTER_NUMBER = 10;
|
||||
public static final byte LETTER_NUMBER = 10;
|
||||
|
||||
/**
|
||||
* Character type No
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int OTHER_NUMBER = 11;
|
||||
public static final byte OTHER_NUMBER = 11;
|
||||
|
||||
/**
|
||||
* Character type Zs
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int SPACE_SEPARATOR = 12;
|
||||
public static final byte SPACE_SEPARATOR = 12;
|
||||
|
||||
/**
|
||||
* Character type Zl
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int LINE_SEPARATOR = 13;
|
||||
public static final byte LINE_SEPARATOR = 13;
|
||||
|
||||
/**
|
||||
* Character type Zp
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int PARAGRAPH_SEPARATOR = 14;
|
||||
public static final byte PARAGRAPH_SEPARATOR = 14;
|
||||
|
||||
/**
|
||||
* Character type Cc
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int CONTROL = 15;
|
||||
public static final byte CONTROL = 15;
|
||||
|
||||
/**
|
||||
* Character type Cf
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int FORMAT = 16;
|
||||
public static final byte FORMAT = 16;
|
||||
|
||||
/**
|
||||
* Character type Co
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int PRIVATE_USE = 17;
|
||||
public static final byte PRIVATE_USE = 17;
|
||||
|
||||
/**
|
||||
* Character type Cs
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int SURROGATE = 18;
|
||||
public static final byte SURROGATE = 18;
|
||||
|
||||
/**
|
||||
* Character type Pd
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int DASH_PUNCTUATION = 19;
|
||||
public static final byte DASH_PUNCTUATION = 19;
|
||||
|
||||
/**
|
||||
* Character type Ps
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int START_PUNCTUATION = 20;
|
||||
public static final byte START_PUNCTUATION = 20;
|
||||
|
||||
/**
|
||||
* Character type Pe
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int END_PUNCTUATION = 21;
|
||||
public static final byte END_PUNCTUATION = 21;
|
||||
|
||||
/**
|
||||
* Character type Pc
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int CONNECTOR_PUNCTUATION = 22;
|
||||
public static final byte CONNECTOR_PUNCTUATION = 22;
|
||||
|
||||
/**
|
||||
* Character type Po
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int OTHER_PUNCTUATION = 23;
|
||||
public static final byte OTHER_PUNCTUATION = 23;
|
||||
|
||||
/**
|
||||
* Character type Sm
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int MATH_SYMBOL = 24;
|
||||
public static final byte MATH_SYMBOL = 24;
|
||||
|
||||
/**
|
||||
* Character type Sc
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int CURRENCY_SYMBOL = 25;
|
||||
public static final byte CURRENCY_SYMBOL = 25;
|
||||
|
||||
/**
|
||||
* Character type Sk
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int MODIFIER_SYMBOL = 26;
|
||||
public static final byte MODIFIER_SYMBOL = 26;
|
||||
|
||||
/**
|
||||
* Character type So
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int OTHER_SYMBOL = 27;
|
||||
public static final byte OTHER_SYMBOL = 27;
|
||||
|
||||
/**
|
||||
* Character type Pi
|
||||
* @see #INITIAL_QUOTE_PUNCTUATION
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int INITIAL_PUNCTUATION = 28;
|
||||
public static final byte INITIAL_PUNCTUATION = 28;
|
||||
|
||||
/**
|
||||
* Character type Pi
|
||||
@ -216,14 +216,14 @@ public class UCharacterEnums {
|
||||
* @draft ICU 2.8
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static final int INITIAL_QUOTE_PUNCTUATION = 28;
|
||||
public static final byte INITIAL_QUOTE_PUNCTUATION = 28;
|
||||
|
||||
/**
|
||||
* Character type Pf
|
||||
* @see #FINAL_QUOTE_PUNCTUATION
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int FINAL_PUNCTUATION = 29;
|
||||
public static final byte FINAL_PUNCTUATION = 29;
|
||||
|
||||
/**
|
||||
* Character type Pf
|
||||
@ -232,13 +232,13 @@ public class UCharacterEnums {
|
||||
* @draft ICU 2.8
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static final int FINAL_QUOTE_PUNCTUATION = 29;
|
||||
public static final byte FINAL_QUOTE_PUNCTUATION = 29;
|
||||
|
||||
/**
|
||||
* Character type count
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
public static final int CHAR_CATEGORY_COUNT = 30;
|
||||
public static final byte CHAR_CATEGORY_COUNT = 30;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -258,7 +258,7 @@ public class UCharacterEnums {
|
||||
public static final int LEFT_TO_RIGHT = 0;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for LEFT_TO_RIGHT.
|
||||
* JDK-compatible synonym for LEFT_TO_RIGHT.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -271,7 +271,7 @@ public class UCharacterEnums {
|
||||
public static final int RIGHT_TO_LEFT = 1;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for RIGHT_TO_LEFT.
|
||||
* JDK-compatible synonym for RIGHT_TO_LEFT.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -284,7 +284,7 @@ public class UCharacterEnums {
|
||||
public static final int EUROPEAN_NUMBER = 2;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for EUROPEAN_NUMBER.
|
||||
* JDK-compatible synonym for EUROPEAN_NUMBER.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -297,7 +297,7 @@ public class UCharacterEnums {
|
||||
public static final int EUROPEAN_NUMBER_SEPARATOR = 3;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for EUROPEAN_NUMBER_SEPARATOR.
|
||||
* JDK-compatible synonym for EUROPEAN_NUMBER_SEPARATOR.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -310,7 +310,7 @@ public class UCharacterEnums {
|
||||
public static final int EUROPEAN_NUMBER_TERMINATOR = 4;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for EUROPEAN_NUMBER_TERMINATOR.
|
||||
* JDK-compatible synonym for EUROPEAN_NUMBER_TERMINATOR.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -323,7 +323,7 @@ public class UCharacterEnums {
|
||||
public static final int ARABIC_NUMBER = 5;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for ARABIC_NUMBER.
|
||||
* JDK-compatible synonym for ARABIC_NUMBER.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -336,7 +336,7 @@ public class UCharacterEnums {
|
||||
public static final int COMMON_NUMBER_SEPARATOR = 6;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for COMMON_NUMBER_SEPARATOR.
|
||||
* JDK-compatible synonym for COMMON_NUMBER_SEPARATOR.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -349,7 +349,7 @@ public class UCharacterEnums {
|
||||
public static final int BLOCK_SEPARATOR = 7;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for BLOCK_SEPARATOR.
|
||||
* JDK-compatible synonym for BLOCK_SEPARATOR.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -362,7 +362,7 @@ public class UCharacterEnums {
|
||||
public static final int SEGMENT_SEPARATOR = 8;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for SEGMENT_SEPARATOR.
|
||||
* JDK-compatible synonym for SEGMENT_SEPARATOR.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -375,7 +375,7 @@ public class UCharacterEnums {
|
||||
public static final int WHITE_SPACE_NEUTRAL = 9;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for WHITE_SPACE_NEUTRAL.
|
||||
* JDK-compatible synonym for WHITE_SPACE_NEUTRAL.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -388,7 +388,7 @@ public class UCharacterEnums {
|
||||
public static final int OTHER_NEUTRAL = 10;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for OTHER_NEUTRAL.
|
||||
* JDK-compatible synonym for OTHER_NEUTRAL.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -401,7 +401,7 @@ public class UCharacterEnums {
|
||||
public static final int LEFT_TO_RIGHT_EMBEDDING = 11;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for LEFT_TO_RIGHT_EMBEDDING.
|
||||
* JDK-compatible synonym for LEFT_TO_RIGHT_EMBEDDING.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -414,7 +414,7 @@ public class UCharacterEnums {
|
||||
public static final int LEFT_TO_RIGHT_OVERRIDE = 12;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for LEFT_TO_RIGHT_OVERRIDE.
|
||||
* JDK-compatible synonym for LEFT_TO_RIGHT_OVERRIDE.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -427,7 +427,7 @@ public class UCharacterEnums {
|
||||
public static final int RIGHT_TO_LEFT_ARABIC = 13;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for RIGHT_TO_LEFT_ARABIC.
|
||||
* JDK-compatible synonym for RIGHT_TO_LEFT_ARABIC.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -440,7 +440,7 @@ public class UCharacterEnums {
|
||||
public static final int RIGHT_TO_LEFT_EMBEDDING = 14;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for RIGHT_TO_LEFT_EMBEDDING.
|
||||
* JDK-compatible synonym for RIGHT_TO_LEFT_EMBEDDING.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -453,7 +453,7 @@ public class UCharacterEnums {
|
||||
public static final int RIGHT_TO_LEFT_OVERRIDE = 15;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for RIGHT_TO_LEFT_OVERRIDE.
|
||||
* JDK-compatible synonym for RIGHT_TO_LEFT_OVERRIDE.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -466,7 +466,7 @@ public class UCharacterEnums {
|
||||
public static final int POP_DIRECTIONAL_FORMAT = 16;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for POP_DIRECTIONAL_FORMAT.
|
||||
* JDK-compatible synonym for POP_DIRECTIONAL_FORMAT.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
@ -479,11 +479,11 @@ public class UCharacterEnums {
|
||||
public static final int DIR_NON_SPACING_MARK = 17;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for DIR_NON_SPACING_MARK.
|
||||
* JDK-compatible synonym for DIR_NON_SPACING_MARK.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static final byte DIRECTIONALITY_NON_SPACING_MARK = (byte)DIR_NON_SPACING_MARK;
|
||||
public static final byte DIRECTIONALITY_NONSPACING_MARK = (byte)DIR_NON_SPACING_MARK;
|
||||
|
||||
/**
|
||||
* Directional type BN
|
||||
@ -492,7 +492,7 @@ public class UCharacterEnums {
|
||||
public static final int BOUNDARY_NEUTRAL = 18;
|
||||
|
||||
/**
|
||||
* JDK-compatible synonum for BOUNDARY_NEUTRAL.
|
||||
* JDK-compatible synonym for BOUNDARY_NEUTRAL.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
|
@ -181,6 +181,14 @@ public abstract class Collator implements Comparator, Cloneable
|
||||
*/
|
||||
public final static int IDENTICAL = 15;
|
||||
|
||||
/**
|
||||
* This is for backwards compatibility with Java APIs only. It
|
||||
* should not be used, IDENTICAL should be used instead. ICU's
|
||||
* collation does not support Java's FULL_DECOMPOSITION mode.
|
||||
* @since ICU 3.4
|
||||
*/
|
||||
public final static int FULL_DECOMPOSITION = IDENTICAL;
|
||||
|
||||
/**
|
||||
* <p>Decomposition mode value. With NO_DECOMPOSITION set, Strings
|
||||
* will not be decomposed for collation. This is the default
|
||||
@ -800,24 +808,6 @@ public abstract class Collator implements Comparator, Cloneable
|
||||
return new UnicodeSet(0, 0x10FFFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the equality of two Collators.
|
||||
* @param that the Collator to be compared with this.
|
||||
* @return true if this Collator is the same as that Collator;
|
||||
* false otherwise.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public abstract boolean equals(Object that);
|
||||
|
||||
// public abstract methods -----------------------------------------------
|
||||
|
||||
/**
|
||||
* Generates a unique hash code for this Collator.
|
||||
* @stable ICU 2.8
|
||||
* @return 32 bit unique hash code
|
||||
*/
|
||||
public abstract int hashCode();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Compares the source text String to the target text String according to
|
||||
|
@ -321,6 +321,40 @@ final public class DecimalFormatSymbols implements Cloneable, Serializable {
|
||||
intlCurrencySymbol = currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currency symbol, for JDK 1.4 compatibility only.
|
||||
* ICU clients should use the Currency API directly.
|
||||
* @return the currency used, or null
|
||||
* @draft ICU 3.4
|
||||
*/
|
||||
public Currency getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* ICU does not use the DecimalFormatSymbols for the
|
||||
* currency any more. This API is present
|
||||
* for API compatibility only.
|
||||
*
|
||||
* This also sets the currency symbol attribute to the currency's symbol
|
||||
* in the DecimalFormatSymbols' locale, and the international currency
|
||||
* symbol attribute to the currency's ISO 4217 currency code.
|
||||
*
|
||||
* @param currency the new currency to be used
|
||||
* @throws NullPointerException if <code>currency</code> is null
|
||||
* @draft ICU 3.4
|
||||
* @see #setCurrencySymbol
|
||||
* @see #setInternationalCurrencySymbol
|
||||
*/
|
||||
public void setCurrency(Currency currency) {
|
||||
if (currency == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
this.currency = currency;
|
||||
intlCurrencySymbol = currency.getCurrencyCode();
|
||||
currencySymbol = currency.getSymbol(locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the monetary decimal separator.
|
||||
* @return the monetary decimal separator character
|
||||
@ -564,11 +598,11 @@ final public class DecimalFormatSymbols implements Cloneable, Serializable {
|
||||
// for backward compatibility; we don't use DecimalFormatSymbols
|
||||
// for currency data anymore.
|
||||
String currname = null;
|
||||
Currency curr = Currency.getInstance(locale);
|
||||
if (curr != null) {
|
||||
intlCurrencySymbol = curr.getCurrencyCode();
|
||||
currency = Currency.getInstance(locale);
|
||||
if (currency != null) {
|
||||
intlCurrencySymbol = currency.getCurrencyCode();
|
||||
boolean[] isChoiceFormat = new boolean[1];
|
||||
currname = curr.getName(locale,
|
||||
currname = currency.getName(locale,
|
||||
Currency.SYMBOL_NAME,
|
||||
isChoiceFormat);
|
||||
// If this is a ChoiceFormat currency, then format an
|
||||
@ -632,6 +666,9 @@ final public class DecimalFormatSymbols implements Cloneable, Serializable {
|
||||
ulocale = ULocale.forLocale(locale);
|
||||
}
|
||||
serialVersionOnStream = currentSerialVersion;
|
||||
|
||||
// recreate
|
||||
currency = Currency.getInstance(intlCurrencySymbol);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -905,5 +942,8 @@ final public class DecimalFormatSymbols implements Cloneable, Serializable {
|
||||
*/
|
||||
private ULocale actualLocale;
|
||||
|
||||
// not serialized, reconstructed from intlCurrencyCode
|
||||
private transient Currency currency;
|
||||
|
||||
// -------- END ULocale boilerplate --------
|
||||
}
|
||||
|
@ -183,9 +183,9 @@ public abstract class NumberFormat extends UFormat {
|
||||
* and <code>BigDecimal</code> objects.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public final StringBuffer format(Object number,
|
||||
StringBuffer toAppendTo,
|
||||
FieldPosition pos)
|
||||
public StringBuffer format(Object number,
|
||||
StringBuffer toAppendTo,
|
||||
FieldPosition pos)
|
||||
{
|
||||
if (number instanceof Long) {
|
||||
return format(((Long)number).longValue(), toAppendTo, pos);
|
||||
@ -1474,9 +1474,11 @@ public abstract class NumberFormat extends UFormat {
|
||||
static final long serialVersionUID = -2308460125733713944L;
|
||||
|
||||
/**
|
||||
* Empty constructor.
|
||||
* Empty constructor. Public for compatibily with JDK which lets the
|
||||
* compiler generate a default public constructor even though this is
|
||||
* an abstract class.
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
protected NumberFormat() {
|
||||
public NumberFormat() {
|
||||
}
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ import java.util.Set;
|
||||
* @author Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu, Laura Werner
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
public abstract class Calendar implements Serializable, Cloneable {
|
||||
public abstract class Calendar implements Serializable, Cloneable, Comparable {
|
||||
|
||||
// Data flow in Calendar
|
||||
// ---------------------
|
||||
@ -2878,6 +2878,39 @@ public abstract class Calendar implements Serializable, Cloneable {
|
||||
return this.getClass().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the times (in millis) represented by two
|
||||
* <code>Calendar</code> objects.
|
||||
*
|
||||
* @param that the <code>Calendar</code> to compare to this.
|
||||
* @return <code>0</code> if the time represented by
|
||||
* this <code>Calendar</code> is equal to the time represented
|
||||
* by that <code>Calendar</code>, a value less than
|
||||
* <code>0</code> if the time represented by this is before
|
||||
* the time represented by that, and a value greater than
|
||||
* <code>0</code> if the time represented by this
|
||||
* is after the time represented by that.
|
||||
* @throws NullPointerException if that
|
||||
* <code>Calendar</code> is null.
|
||||
* @throws IllegalArgumentException if the time of that
|
||||
* <code>Calendar</code> can't be obtained because of invalid
|
||||
* calendar values.
|
||||
* @draft ICU 3.4
|
||||
*/
|
||||
public int compareTo(Calendar that) {
|
||||
long v = getTimeInMillis() - that.getTimeInMillis();
|
||||
return v < 0 ? -1 : (v > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement comparable API as a convenience override of
|
||||
* {@link #compareTo(Calendar)}.
|
||||
* @draft ICU 3.4
|
||||
*/
|
||||
public int compareTo(Object that) {
|
||||
return compareTo((Calendar)that);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Interface for creating custon DateFormats for different types of Calendars
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -265,6 +265,41 @@ public class Currency extends MeasureUnit implements Serializable {
|
||||
return isoCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience and compatibility override of getName that
|
||||
* requests the symbol name.
|
||||
* @see getName
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public String getSymbol() {
|
||||
return getSymbol(ULocale.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience and compatibility override of getName that
|
||||
* requests the symbol name.
|
||||
* @param loc the Locale for the symbol
|
||||
* @see getName
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public String getSymbol(Locale loc) {
|
||||
return getSymbol(ULocale.forLocale(loc));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience and compatibility override of getName that
|
||||
* requests the symbol name.
|
||||
* @param uloc the ULocale for the symbol
|
||||
* @see getName
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public String getSymbol(ULocale uloc) {
|
||||
return getName(uloc, SYMBOL_NAME, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display name for the given currency in the
|
||||
* given locale. For example, the display name for the USD
|
||||
@ -284,7 +319,7 @@ public class Currency extends MeasureUnit implements Serializable {
|
||||
public String getName(Locale locale,
|
||||
int nameStyle,
|
||||
boolean[] isChoiceFormat) {
|
||||
return getName(ULocale.forLocale(locale), nameStyle, isChoiceFormat);
|
||||
return getName(ULocale.forLocale(locale), nameStyle, isChoiceFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -268,7 +268,7 @@ public final class ULocale implements Serializable {
|
||||
* @draft ICU 2.8
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static final ULocale ROOT = new ULocale(EMPTY_STRING, null);
|
||||
public static final ULocale ROOT = new ULocale(EMPTY_STRING, (Locale)null);
|
||||
|
||||
/**
|
||||
* Cache the locale.
|
||||
@ -767,7 +767,7 @@ public final class ULocale implements Serializable {
|
||||
* start of the keyword list is indicated by '@', and consists of one
|
||||
* or more keyword/value pairs separated by commas.
|
||||
* <p>
|
||||
* This constructor not canonicalize the localeID.
|
||||
* This constructor does not canonicalize the localeID.
|
||||
*
|
||||
* @param localeID string representation of the locale, e.g:
|
||||
* "en_US", "sy_Cyrl_YU", "zh__pinyin", "es_ES@currency=EUR,collation=traditional"
|
||||
@ -778,6 +778,17 @@ public final class ULocale implements Serializable {
|
||||
this.localeID = getName(localeID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience overload of ULocale(String, String, String) for
|
||||
* compatibility with java.util.Locale.
|
||||
* @see ULocale(String, String, String)
|
||||
* @draft ICU 3.4
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public ULocale(String a, String b) {
|
||||
this(a, b, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a ULocale from a localeID constructed from the three 'fields' a, b, and c. These
|
||||
* fields are concatenated using underscores to form a localeID of
|
||||
@ -811,7 +822,7 @@ public final class ULocale implements Serializable {
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public static ULocale createCanonical(String nonCanonicalID) {
|
||||
return new ULocale(canonicalize(nonCanonicalID), null);
|
||||
return new ULocale(canonicalize(nonCanonicalID), (Locale)null);
|
||||
}
|
||||
|
||||
private static String lscvToID(String lang, String script, String country, String variant) {
|
||||
@ -1073,7 +1084,7 @@ public final class ULocale implements Serializable {
|
||||
if (localeID.length() == 0 || localeID.charAt(0) == '@') {
|
||||
return null;
|
||||
}
|
||||
return new ULocale(getFallbackString(localeID), null);
|
||||
return new ULocale(getFallbackString(localeID), (Locale)null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1990,7 +2001,7 @@ public final class ULocale implements Serializable {
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public ULocale setKeywordValue(String keyword, String value) {
|
||||
return new ULocale(setKeywordValue(localeID, keyword, value), null);
|
||||
return new ULocale(setKeywordValue(localeID, keyword, value), (Locale)null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,12 +130,13 @@ public abstract class UResourceBundle extends ResourceBundle{
|
||||
|
||||
/**
|
||||
* Sole constructor. (For invocation by subclass constructors, typically
|
||||
* implicit.)
|
||||
* implicit.) This is public for compatibility with Java, whose compiler
|
||||
* will generate public default constructors for an abstract class.
|
||||
* @draft ICU 3.0
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
protected UResourceBundle() { }
|
||||
|
||||
public UResourceBundle() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a UResourceBundle for the locale specified, from which users can extract resources by using
|
||||
|
Loading…
Reference in New Issue
Block a user