ICU-2103 clean up @draft, @deprecated tags

X-SVN-Rev: 10450
This commit is contained in:
Ram Viswanadha 2002-12-03 22:04:17 +00:00
parent 9085040ab0
commit fc0a2adad9
12 changed files with 550 additions and 130 deletions

View file

@ -20,6 +20,7 @@ import java.util.MissingResourceException;
* (based on ISO 15924:2000, "Code for the representation of names of
* scripts"). UTR #24 describes the basis for a new Unicode data file,
* Scripts.txt.
* @stable ICU 2.4
*/
public final class UScript {
/**
@ -27,54 +28,246 @@ public final class UScript {
*/
private static final String copyrightNotice
= "Copyright \u00a92001 IBM Corp. All rights reserved.";
/**
* Invalid code
* @stable ICU 2.4
*/
public static final int INVALID_CODE = -1;
/**
* Common
* @stable ICU 2.4
*/
public static final int COMMON = 0; /* Zyyy */
/**
* Inherited
* @stable ICU 2.4
*/
public static final int INHERITED = 1; /* Qaai */
/**
* Arabic
* @stable ICU 2.4
*/
public static final int ARABIC = 2; /* Arab */
/**
* Armenian
* @stable ICU 2.4
*/
public static final int ARMENIAN = 3; /* Armn */
/**
* Bengali
* @stable ICU 2.4
*/
public static final int BENGALI = 4; /* Beng */
/**
* Bopomofo
* @stable ICU 2.4
*/
public static final int BOPOMOFO = 5; /* Bopo */
/**
* Cherokee
* @stable ICU 2.4
*/
public static final int CHEROKEE = 6; /* Cher */
/**
* Coptic
* @stable ICU 2.4
*/
public static final int COPTIC = 7; /* Qaac */
/**
* Cyrillic
* @stable ICU 2.4
*/
public static final int CYRILLIC = 8; /* Cyrl (Cyrs) */
/**
* Deseret
* @stable ICU 2.4
*/
public static final int DESERET = 9; /* Dsrt */
/**
* Devanagari
* @stable ICU 2.4
*/
public static final int DEVANAGARI = 10; /* Deva */
/**
* Ethiopic
* @stable ICU 2.4
*/
public static final int ETHIOPIC = 11; /* Ethi */
/**
* Georgian
* @stable ICU 2.4
*/
public static final int GEORGIAN = 12; /* Geor (Geon; Geoa) */
/**
* Gothic
* @stable ICU 2.4
*/
public static final int GOTHIC = 13; /* Goth */
/**
* Greek
* @stable ICU 2.4
*/
public static final int GREEK = 14; /* Grek */
/**
* Gujarati
* @stable ICU 2.4
*/
public static final int GUJARATI = 15; /* Gujr */
/**
* Gurmukhi
* @stable ICU 2.4
*/
public static final int GURMUKHI = 16; /* Guru */
/**
* Han
* @stable ICU 2.4
*/
public static final int HAN = 17; /* Hani */
/**
* Hangul
* @stable ICU 2.4
*/
public static final int HANGUL = 18; /* Hang */
/**
* Hebrew
* @stable ICU 2.4
*/
public static final int HEBREW = 19; /* Hebr */
/**
* Hiragana
* @stable ICU 2.4
*/
public static final int HIRAGANA = 20; /* Hira */
/**
* Kannada
* @stable ICU 2.4
*/
public static final int KANNADA = 21; /* Knda */
/**
* Katakana
* @stable ICU 2.4
*/
public static final int KATAKANA = 22; /* Kana */
/**
* Khmer
* @stable ICU 2.4
*/
public static final int KHMER = 23; /* Khmr */
/**
* Lao
* @stable ICU 2.4
*/
public static final int LAO = 24; /* Laoo */
/**
* Latin
* @stable ICU 2.4
*/
public static final int LATIN = 25; /* Latn (Latf; Latg) */
/**
* Malayalam
* @stable ICU 2.4
*/
public static final int MALAYALAM = 26; /* Mlym */
/**
* Mangolian
* @stable ICU 2.4
*/
public static final int MONGOLIAN = 27; /* Mong */
/**
* Myammar
* @stable ICU 2.4
*/
public static final int MYANMAR = 28; /* Mymr */
/**
* Ogham
* @stable ICU 2.4
*/
public static final int OGHAM = 29; /* Ogam */
/**
* Old Itallic
* @stable ICU 2.4
*/
public static final int OLD_ITALIC = 30; /* Ital */
/**
* Oriya
* @stable ICU 2.4
*/
public static final int ORIYA = 31; /* Orya */
/**
* Runic
* @stable ICU 2.4
*/
public static final int RUNIC = 32; /* Runr */
/**
* Sinhala
* @stable ICU 2.4
*/
public static final int SINHALA = 33; /* Sinh */
/**
* Syriac
* @stable ICU 2.4
*/
public static final int SYRIAC = 34; /* Syrc (Syrj; Syrn; Syre) */
/**
* Tamil
* @stable ICU 2.4
*/
public static final int TAMIL = 35; /* Taml */
/**
* Telugu
* @stable ICU 2.4
*/
public static final int TELUGU = 36; /* Telu */
/**
* Thana
* @stable ICU 2.4
*/
public static final int THAANA = 37; /* Thaa */
/**
* Thai
* @stable ICU 2.4
*/
public static final int THAI = 38; /* Thai */
/**
* Tibetan
* @stable ICU 2.4
*/
public static final int TIBETAN = 39; /* Tibt */
/**
* Unified Canadian Aboriginal Symbols
* @stable ICU 2.4
*/
public static final int UCAS = 40; /* Cans */
/**
* Yi syllables
* @stable ICU 2.4
*/
public static final int YI = 41; /* Yiii */
/**
* Tagalog
* @stable ICU 2.4
*/
public static final int TAGALOG = 42; /* Tglg */
/**
* Hanunooo
* @stable ICU 2.4
*/
public static final int HANUNOO = 43; /* Hano */
/**
* Buhid
* @stable ICU 2.4
*/
public static final int BUHID = 44; /* Buhd */
/**
* Tagbanwa
* @stable ICU 2.4
*/
public static final int TAGBANWA = 45; /* Tagb */
/**
* Limit
* @stable ICU 2.4
*/
public static final int CODE_LIMIT = 46;
private static final int SCRIPT_MASK = 0x0000007f;
@ -83,7 +276,6 @@ public final class UScript {
/**
* Helper function to find the code from locale.
* @param Locale the locale.
* @exception MissingResourceException if LocaleScript cannot be opened
*/
private static int[] findCodeFromLocale(Locale locale) {
@ -98,11 +290,10 @@ public final class UScript {
int[] result = new int[scripts.length];
int w = 0;
for (int i = 0; i < scripts.length; ++i) {
try {
int code = UCharacter.getPropertyValueEnum(UProperty.SCRIPT,
int code = UCharacter.getPropertyValueEnum(UProperty.SCRIPT,
scripts[i]);
result[w++] = code;
} catch (IllegalArgumentException e) {}
result[w++] = code;
}
if (w < result.length) {
@ -118,11 +309,9 @@ public final class UScript {
* Returns LATIN given "en" OR "en_US"
* @param locale Locale
* @return The script codes array. null if the the code cannot be found.
* @exception MissingResourceException
* @draft 2.1
* @stable ICU 2.4
*/
public static final int[] getCode(Locale locale)
throws MissingResourceException {
public static final int[] getCode(Locale locale){
return findCodeFromLocale(locale);
}
@ -137,7 +326,7 @@ public final class UScript {
* data.
* @param nameOrAbbrOrLocale name of the script or ISO 15924 code or locale
* @return The script codes array. null if the the code cannot be found.
* @draft 2.1
* @stable ICU 2.4
*/
public static final int[] getCode(String nameOrAbbrOrLocale){
try {
@ -155,8 +344,7 @@ public final class UScript {
* Returns UScript.MALAYAM given 0x0D02
* @param codepoint UChar32 codepoint
* @return The script code
* @exception IllegalArgumentException
* @draft 2.1
* @stable ICU 2.4
*/
public static final int getScript(int codepoint){
if (codepoint >= UCharacter.MIN_VALUE & codepoint <= UCharacter.MAX_VALUE) {
@ -171,8 +359,7 @@ public final class UScript {
* Returns "Malayam" given MALAYAM
* @param scriptCode int script code
* @return script name as a string in full as given in TR#24
* @exception IllegalArgumentException
* @draft 2.1
* @stable ICU 2.4
*/
public static final String getName(int scriptCode){
return UCharacter.getPropertyValueName(UProperty.SCRIPT,
@ -185,13 +372,17 @@ public final class UScript {
* Returns "Mlym" given MALAYAM
* @param scriptCode int script code
* @return script abbreviated name as a string as given in TR#24
* @exception IllegalArgumentException
* @draft 2.1
* @stable ICU 2.4
*/
public static final String getShortName(int scriptCode){
return UCharacter.getPropertyValueName(UProperty.SCRIPT,
scriptCode,
UProperty.NameChoice.SHORT);
}
/**
* Private Constructor. Never default construct
*/
private UScript(){}
}

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/ComposedCharIter.java,v $
* $Date: 2002/06/20 01:21:18 $
* $Revision: 1.4 $
* $Date: 2002/12/03 22:03:59 $
* $Revision: 1.5 $
*
*****************************************************************************************
*/
@ -53,7 +53,7 @@ import com.ibm.icu.impl.Utility;
* <tt>ComposedCharIter</tt> is currently based on version 2.1.8 of the
* <a href="http://www.unicode.org" target="unicode">Unicode Standard</a>.
* It will be updated as later versions of Unicode are released.
* @deprecated
* @deprecated ICU 2.2
*/
public final class ComposedCharIter {
@ -61,6 +61,7 @@ public final class ComposedCharIter {
* Constant that indicates the iteration has completed.
* {@link #next} returns this value when there are no more composed characters
* over which to iterate.
* @deprecated ICU 2.2
*/
public static final char DONE = (char) Normalizer.DONE;
@ -68,6 +69,7 @@ public final class ComposedCharIter {
* Construct a new <tt>ComposedCharIter</tt>. The iterator will return
* all Unicode characters with canonical decompositions, including Korean
* Hangul characters.
* @deprecated ICU 2.2
*/
public ComposedCharIter() {
compat = false;
@ -87,6 +89,7 @@ public final class ComposedCharIter {
* causes this <tt>ComposedCharIter</tt> not to iterate
* over the Hangul characters and their corresponding
* Jamo decompositions.
* @deprecated ICU 2.2
*/
public ComposedCharIter(boolean compat, int options) {
this.compat = compat;
@ -96,6 +99,7 @@ public final class ComposedCharIter {
/**
* Determines whether there any precomposed Unicode characters not yet returned
* by {@link #next}.
* @deprecated ICU 2.2
*/
public boolean hasNext() {
if (nextChar == Normalizer.DONE) {
@ -110,6 +114,7 @@ public final class ComposedCharIter {
* by Unicode, in ascending order. After all precomposed characters have
* been returned, {@link #hasNext} will return <tt>false</tt> and further calls
* to <tt>next</tt> will return {@link #DONE}.
* @deprecated ICU 2.2
*/
public char next() {
if (nextChar == Normalizer.DONE) {
@ -125,6 +130,7 @@ public final class ComposedCharIter {
* This method returns the decomposition of the precomposed character most
* recently returned by {@link #next}. The resulting decomposition is
* affected by the settings of the options passed to the constructor.
* @deprecated ICU 2.2
*/
public String decomposition() {
// the decomposition buffer contains the decomposition of

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/Normalizer.java,v $
* $Date: 2002/11/21 18:19:48 $
* $Revision: 1.27 $
* $Date: 2002/12/03 22:03:59 $
* $Revision: 1.28 $
*
*******************************************************************************
*/
@ -116,6 +116,7 @@ import com.ibm.icu.impl.Utility;
* often do not encode any combining marks by themselves. For conversion to such
* character encodings the Unicode text needs to be normalized to NFC.
* For more usage examples, see the Unicode Standard Annex.
* @draft ICU 2.2
*/
public final class Normalizer implements Cloneable{
@ -143,18 +144,23 @@ public final class Normalizer implements Cloneable{
/**
* Constant indicating that the end of the iteration has been reached.
* This is guaranteed to have the same value as {@link UCharacterIterator#DONE}.
*
* @draft ICU 2.2
*/
public static final int DONE = UCharacterIterator.DONE;
/**
* Constants for normalization modes.
* @draft ICU 2.2
*/
public static class Mode {
private int modeValue;
private Mode(int value){
modeValue = value;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected int normalize(char[] src, int srcStart, int srcLimit,
char[] dest, int destStart, int destLimit){
int srcLen = (srcLimit - srcStart);
@ -165,23 +171,45 @@ public final class Normalizer implements Cloneable{
System.arraycopy(src,srcStart,dest,destStart,srcLen);
return srcLen;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected String normalize(String src){
return src;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected int getMinC(){
return -1;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected int getMask(){
return -1;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected IsPrevBoundary getPrevBoundary(){
return null;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected IsNextBoundary getNextBoundary(){
return null;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected QuickCheckResult quickCheck(char[] src,int start, int limit,
boolean allowMaybe){
if(allowMaybe){
@ -189,16 +217,26 @@ public final class Normalizer implements Cloneable{
}
return NO;
}
/**
* This method is used for method dispatch
* @draft ICU 2.2
*/
protected boolean isNFSkippable(int c){
return true;
}
}
/** No decomposition/composition. */
/**
* No decomposition/composition.
* @draft ICU 2.2
*/
public static final Mode NONE = new Mode(1);
/** Canonical decomposition. */
/**
* Canonical decomposition.
* @draft ICU 2.2
*/
public static final Mode NFD = new NFDMode(2);
private static final class NFDMode extends Mode{
@ -245,7 +283,10 @@ public final class Normalizer implements Cloneable{
}
};
/** Compatibility decomposition. */
/**
* Compatibility decomposition.
* @draft ICU 2.2
*/
public static final Mode NFKD = new NFKDMode(3);
private static final class NFKDMode extends Mode{
@ -291,7 +332,10 @@ public final class Normalizer implements Cloneable{
}
};
/** Canonical decomposition followed by canonical composition. */
/**
* Canonical decomposition followed by canonical composition.
* @draft ICU 2.2
*/
public static final Mode NFC = new NFCMode(4);
private static final class NFCMode extends Mode{
@ -343,10 +387,16 @@ public final class Normalizer implements Cloneable{
}
};
/** Default normalization. */
/**
* Default normalization.
* @draft ICU 2.2
*/
public static final Mode DEFAULT = NFC;
/** Compatibility decomposition followed by canonical composition. */
/**
* Compatibility decomposition followed by canonical composition.
* @draft ICU 2.2
*/
public static final Mode NFKC =new NFKCMode(5);
private static final class NFKCMode extends Mode{
@ -396,7 +446,10 @@ public final class Normalizer implements Cloneable{
}
};
/** "Fast C or D" form. @since ICU 2.1 */
/**
* "Fast C or D" form.
* @draft ICU 2.2
*/
public static final Mode FCD = new FCDMode(6);
private static final class FCDMode extends Mode{
@ -445,7 +498,7 @@ public final class Normalizer implements Cloneable{
* altogether.
* <p>
* @see #setMode
* @deprecated To be removed after 2003-Aug-31. Use Nomalizer.NONE
* @deprecated ICU 2.2. To be removed after 2003-Aug-31. Use Nomalizer.NONE
* @see #NONE
*/
public static final Mode NO_OP = NONE;
@ -463,7 +516,7 @@ public final class Normalizer implements Cloneable{
* <b>C</b>.
* <p>
* @see #setMode
* @deprecated To be removed after 2003-Aug-31. Use Normalier.NFC
* @deprecated ICU 2.2. To be removed after 2003-Aug-31. Use Normalier.NFC
* @see #NFC
*/
public static final Mode COMPOSE = NFC;
@ -481,7 +534,7 @@ public final class Normalizer implements Cloneable{
* <b>KC</b>.
* <p>
* @see #setMode
* @deprecated To be removed after 2003-Aug-31. Use Normalizer.NFKC
* @deprecated ICU 2.2. To be removed after 2003-Aug-31. Use Normalizer.NFKC
* @see #NFKC
*/
public static final Mode COMPOSE_COMPAT = NFKC;
@ -499,7 +552,7 @@ public final class Normalizer implements Cloneable{
* <b>D</b>.
* <p>
* @see #setMode
* @deprecated To be removed after 2003-Aug-31.Use Normalizer.NFD
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.Use Normalizer.NFD
* @see #NFD
*/
public static final Mode DECOMP = NFD;
@ -517,7 +570,7 @@ public final class Normalizer implements Cloneable{
* <b>KD</b>.
* <p>
* @see #setMode
* @deprecated To be removed after 2003-Aug-31. Use Normalizer.NFKD
* @deprecated ICU 2.2. To be removed after 2003-Aug-31. Use Normalizer.NFKD
* @see #NFKD
*/
public static final Mode DECOMP_COMPAT = NFKD;
@ -538,14 +591,14 @@ public final class Normalizer implements Cloneable{
* Unicode Normalization Forms</a>.
* <p>
* @see #setOption
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
*/
public static final int IGNORE_HANGUL = 0x0001;
/**
* Result values for quickCheck().
* For details see Unicode Technical Report 15.
*
* @draft ICU 2.2
*/
public static final class QuickCheckResult{
private int resultValue;
@ -555,51 +608,54 @@ public final class Normalizer implements Cloneable{
}
/**
* Indicates that string is not in the normalized format
* @draft ICU 2.2
*/
public static final QuickCheckResult NO = new QuickCheckResult(0);
/**
* Indicates that string is in the normalized format
* @draft ICU 2.2
*/
public static final QuickCheckResult YES = new QuickCheckResult(1);
/**
* Indicates it cannot be determined if string is in the normalized
* format without further thorough checks.
* @draft ICU 2.2
*/
public static final QuickCheckResult MAYBE = new QuickCheckResult(2);
/**
* Option bit for compare:
* Case sensitively compare the strings
* @since ICU 2.2
* @draft ICU 2.2
*/
public static final int FOLD_CASE_DEFAULT = 0x0000;
/**
* Option bit for compare:
* Both input strings are assumed to fulfill FCD conditions.
* @since ICU 2.2
* @draft ICU 2.2
*/
public static final int INPUT_IS_FCD = 0x20000;
/**
* Option bit for compare:
* Perform case-insensitive comparison.
* @since ICU 2.2
* @draft ICU 2.2
*/
public static final int COMPARE_IGNORE_CASE = 0x10000;
/**
* Option bit for compare:
* Compare strings in code point order instead of code unit order.
* @since ICU 2.2
* @draft ICU 2.2
*/
public static final int COMPARE_CODE_POINT_ORDER = 0x8000;
/** Option value for case folding: exclude the mappings for dotted I
* and dotless i marked with 'I' in CaseFolding.txt.
* @since ICU 2.2
* @draft ICU 2.2
*/
public static final int FOLD_CASE_EXCLUDE_SPECIAL_I = 0x0001;
@ -615,6 +671,7 @@ public final class Normalizer implements Cloneable{
* will start at the beginning of the string.
*
* @param mode The normalization mode.
* @draft ICU 2.2
*/
public Normalizer(String str, Mode mode) {
this.text = UCharacterIterator.getInstance(str);
@ -637,8 +694,9 @@ public final class Normalizer implements Cloneable{
* Currently the only available option is {@link #IGNORE_HANGUL}.
* If you want the default behavior corresponding to one of the
* standard Unicode Normalization Forms, use 0 for this argument.
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
* Use Normalizer( String str, Mode mode).
* @draft ICU 2.2
*/
public Normalizer(String str, Mode mode, int opt) {
this.text = UCharacterIterator.getInstance(str);
@ -654,7 +712,7 @@ public final class Normalizer implements Cloneable{
* will start at the beginning of the string.
*
* @param mode The normalization mode.
*
* @draft ICU 2.2
*/
public Normalizer(CharacterIterator iter, Mode mode) {
this.text = UCharacterIterator.getInstance(
@ -676,7 +734,7 @@ public final class Normalizer implements Cloneable{
* Currently the only available option is {@link #IGNORE_HANGUL}.
* If you want the default behavior corresponding to one of the
* standard Unicode Normalization Forms, use 0 for this argument.
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
* Use Normalizer(CharacterIterator iter, Mode mode).
*/
public Normalizer(CharacterIterator iter, Mode mode, int opt){
@ -695,6 +753,7 @@ public final class Normalizer implements Cloneable{
* will start at the beginning of the string.
*
* @param mode The normalization mode.
* @draft ICU 2.2
*/
//internal constructor for now
public Normalizer(UCharacterIterator iter, Mode mode){
@ -715,6 +774,7 @@ public final class Normalizer implements Cloneable{
* However, the text storage underlying
* the <tt>CharacterIterator</tt> is not duplicated unless the
* iterator's <tt>clone</tt> method does so.
* @draft ICU 2.2
*/
public Object clone() {
try {
@ -744,6 +804,7 @@ public final class Normalizer implements Cloneable{
* NFKC rules and if false will be composed according to
* NFC rules.
* @return String The composed string
* @draft ICU 2.2
*/
public static String compose(String str, boolean compat){
char[] dest = new char[str.length()*MAX_BUF_SIZE_COMPOSE];
@ -769,7 +830,7 @@ public final class Normalizer implements Cloneable{
* NFC rules.
* @param options The only recognized option is IGNORE_HANGUL
* @return String The composed string
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
* Use compose(String str, boolean compat).
*/
public static String compose(String str, boolean compat, int options){
@ -787,7 +848,8 @@ public final class Normalizer implements Cloneable{
* @return int The total buffer size needed;if greater than length of
* result, the output was truncated.
* @exception IndexOutOfBoundsException if target.length is less than the
* required length
* required length
* @draft ICU 2.2
*/
public static int compose(char[] source,char[] target, boolean compat){
int length = NormalizerImpl.compose(source,0,source.length,
@ -815,7 +877,8 @@ public final class Normalizer implements Cloneable{
* @return int The total buffer size needed;if greater than length of
* result, the output was truncated.
* @exception IndexOutOfBoundsException if target.length is less than the
* required length
* required length
* @draft ICU 2.2
*/
public static int compose(char[] src,int srcStart, int srcLimit,
char[] dest,int destStart, int destLimit,
@ -840,7 +903,8 @@ public final class Normalizer implements Cloneable{
* @param compat If true the string will be decomposed accoding to NFKD
* rules and if false will be decomposed according to NFD
* rules.
* @return String The decomposed string
* @return String The decomposed string
* @draft ICU 2.2
*/
public static String decompose(String str, boolean compat){
char[] dest = new char[str.length()*MAX_BUF_SIZE_DECOMPOSE];
@ -867,7 +931,7 @@ public final class Normalizer implements Cloneable{
* rules and if false will be decomposed according to NFD
* rules.
* @return String The decomposed string
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
* Use decompose(String str, boolean compat).
*/
public static String decompose(String str, boolean compat, int options){
@ -886,6 +950,7 @@ public final class Normalizer implements Cloneable{
* result,the output was truncated.
* @exception IndexOutOfBoundsException if the target capacity is less than
* the required length
* @draft ICU 2.2
*/
public static int decompose(char[] source,char[] target, boolean compat){
int[] trailCC = new int[1];
@ -914,7 +979,8 @@ public final class Normalizer implements Cloneable{
* @return int The total buffer size needed;if greater than length of
* result,the output was truncated.
* @exception IndexOutOfBoundsException if the target capacity is less than
* the required length
* the required length
* @draft ICU 2.2
*/
public static int decompose(char[] src,int srcStart, int srcLimit,
char[] dest,int destStart, int destLimit,
@ -959,7 +1025,7 @@ public final class Normalizer implements Cloneable{
* @param aMode the normalization mode
*
* @param options the optional features to be enabled.
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
* Use normalize(String str, Mode mode).
*/
public static String normalize(String str, Mode mode, int options){
@ -975,6 +1041,7 @@ public final class Normalizer implements Cloneable{
* Normalizer.NFD, Normalizer.NFC, Normalizer.NFKC,
* Normalizer.NFKD, Normalizer.DEFAULT
* @return String The normalized string
* @draft ICU 2.2
*
*/
public static String normalize( String src,Mode mode){
@ -992,7 +1059,8 @@ public final class Normalizer implements Cloneable{
* @return int The total buffer size needed;if greater than length of
* result, the output was truncated.
* @exception IndexOutOfBoundsException if the target capacity is less
* than the required length
* than the required length
* @draft ICU 2.2
*/
public static int normalize(char[] source,char[] target, Mode mode){
int length = normalize(source,0,source.length,target,0,target.length,mode);
@ -1019,8 +1087,8 @@ public final class Normalizer implements Cloneable{
* @return int The total buffer size needed;if greater than length of
* result, the output was truncated.
* @exception IndexOutOfBoundsException if the target capacity is
* less than
* the required length
* less than the required length
* @draft ICU 2.2
*/
public static int normalize(char[] src,int srcStart, int srcLimit,
char[] dest,int destStart, int destLimit,
@ -1039,6 +1107,7 @@ public final class Normalizer implements Cloneable{
* @param char32 The input string to be normalized.
* @param aMode The normalization mode
* @return String The normalized string
* @draft ICU 2.2
*/
// TODO: actually do the optimization when the guts of Normalizer are
// upgraded --has just dumb implementation for now
@ -1054,6 +1123,7 @@ public final class Normalizer implements Cloneable{
* Normalizer.NFKC,Normalizer.NFKD)
* @return Return code to specify if the text is normalized or not
* (Normalizer.YES, Normalizer.NO or Normalizer.MAYBE)
* @draft ICU 2.2
*/
public static QuickCheckResult quickCheck( String source, Mode mode){
return mode.quickCheck(source.toCharArray(),0,source.length(),true);
@ -1068,6 +1138,7 @@ public final class Normalizer implements Cloneable{
* Normalizer.NFKC,Normalizer.NFKD)
* @return Return code to specify if the text is normalized or not
* (Normalizer.YES, Normalizer.NO or Normalizer.MAYBE)
* @draft ICU 2.2
*/
public static QuickCheckResult quickCheck(char[] source, Mode mode){
return mode.quickCheck(source,0,source.length,true);
@ -1092,6 +1163,7 @@ public final class Normalizer implements Cloneable{
* @return Return code to specify if the text is normalized or not
* (Normalizer.YES, Normalizer.NO or
* Normalizer.MAYBE)
* @draft ICU 2.2
*/
public static QuickCheckResult quickCheck(char[] source,int start,
@ -1120,6 +1192,7 @@ public final class Normalizer implements Cloneable{
* @param aMode the normalization mode
* @return Boolean value indicating whether the source string is in the
* "mode" normalization form
* @draft ICU 2.2
*/
public static boolean isNormalized(char[] src,int start,
int limit, Mode mode) {
@ -1132,6 +1205,7 @@ public final class Normalizer implements Cloneable{
* normalized
* @param aMode the normalization mode
* @see #isNormalized
* @draft ICU 2.2
*/
public static boolean isNormalized(String str, Mode mode) {
return (mode.quickCheck(str.toCharArray(),0,str.length(),false)==YES);
@ -1143,6 +1217,7 @@ public final class Normalizer implements Cloneable{
* normalized
* @param aMode the normalization mode
* @see #isNormalized
* @draft ICU 2.2
*/
// TODO: actually do the optimization when the guts of Normalizer are
// upgraded --has just dumb implementation for now
@ -1201,6 +1276,7 @@ public final class Normalizer implements Cloneable{
*
* @see #normalize
* @see #FCD
* @draft ICU 2.2
*/
public static int compare(char[] s1, int s1Start, int s1Limit,
char[] s2, int s2Start, int s2Limit,
@ -1241,6 +1317,7 @@ public final class Normalizer implements Cloneable{
*
* @see #normalize
* @see #FCD
* @draft ICU 2.2
*/
public static int compare(String s1, String s2, int options){
@ -1281,6 +1358,7 @@ public final class Normalizer implements Cloneable{
*
* @see #normalize
* @see #FCD
* @draft ICU 2.2
*/
public static int compare(char[] s1, char[] s2, int options){
@ -1294,6 +1372,7 @@ public final class Normalizer implements Cloneable{
* @param char32b the second code point
*
* @param aMode the normalization mode
* @draft ICU 2.2
*/
// TODO: actually do the optimization when the guts of Normalizer are
// upgraded --has just dumb implementation for now
@ -1310,6 +1389,7 @@ public final class Normalizer implements Cloneable{
* @param str2 the second string
*
* @param aMode the normalization mode
* @draft ICU 2.2
*
*/
// TODO: actually do the optimization when the guts of Normalizer are
@ -1357,6 +1437,7 @@ public final class Normalizer implements Cloneable{
* @see #previous
* @exception IndexOutOfBoundsException if target capacity is less than the
* required length
* @draft ICU 2.2
*/
/* Concatenation of normalized strings --------------------------------- */
@ -1494,6 +1575,7 @@ public final class Normalizer implements Cloneable{
* @see #next
* @see #previous
* @see #concatenate
* @draft ICU 2.2
*/
public static String concatenate(char[] left, char[] right,Mode mode){
char[] result = new char[(left.length+right.length)* MAX_BUF_SIZE_DECOMPOSE];
@ -1535,6 +1617,7 @@ public final class Normalizer implements Cloneable{
* @see #next
* @see #previous
* @see #concatenate
* @draft ICU 2.2
*/
public static String concatenate(String left, String right,Mode mode){
char[] result = new char[(left.length()+right.length())* MAX_BUF_SIZE_DECOMPOSE];
@ -1552,10 +1635,23 @@ public final class Normalizer implements Cloneable{
}
}
/**
* Gets the FC_NFKC closure set from the normalization data
* @param c The code point whose closure set is to be retrieved
* @param dest The char array to recive the closure set
* @internal
* @draft ICU 2.4
*/
public static int getFC_NFKC_Closure(int c,char[] dest){
return NormalizerImpl.getFC_NFKC_Closure(c,dest);
}
/**
* Gets the FC_NFKC closure set from the normalization data
* @param c The the code point whose closure set is to be retrieved
* @return String representation of the closure set
* @internal
* @draft ICU 2.4
*/
public static String getFC_NFKC_Closure(int c){
char[] dest = new char[10];
for(;;){
@ -1574,6 +1670,7 @@ public final class Normalizer implements Cloneable{
/**
* Return the current character in the normalized text->
* @return The codepoint as an int
* @draft ICU 2.2
*/
public int current() {
if(bufferPos<bufferLimit || nextNormalize()) {
@ -1588,6 +1685,7 @@ public final class Normalizer implements Cloneable{
* the iteration position by one. If the end
* of the text has already been reached, {@link #DONE} is returned.
* @return The codepoint as an int
* @draft ICU 2.2
*/
public int next() {
if(bufferPos<bufferLimit || nextNormalize()) {
@ -1605,6 +1703,7 @@ public final class Normalizer implements Cloneable{
* the iteration position by one. If the beginning
* of the text has already been reached, {@link #DONE} is returned.
* @return The codepoint as an int
* @draft ICU 2.2
*/
public int previous() {
if(bufferPos>0 || previousNormalize()) {
@ -1619,6 +1718,7 @@ public final class Normalizer implements Cloneable{
/**
* Reset the index to the beginning of the text.
* This is equivalent to setIndexOnly(startIndex)).
* @draft ICU 2.2
*/
public void reset() {
text.setIndex(0);
@ -1633,6 +1733,7 @@ public final class Normalizer implements Cloneable{
* specified here.
*
* @param index the desired index in the input text.
* @draft ICU 2.2
*/
public void setIndexOnly(int index) {
text.setIndex(index);
@ -1659,6 +1760,7 @@ public final class Normalizer implements Cloneable{
* @throws IllegalArgumentException if the given index is less than
* {@link #getBeginIndex} or greater than {@link #getEndIndex}.
* @return The codepoint as an int
* @draft ICU 2.2
*/
public int setIndex(int index) {
setIndexOnly(index);
@ -1669,7 +1771,7 @@ public final class Normalizer implements Cloneable{
* Retrieve the index of the start of the input text. This is the begin
* index of the <tt>CharacterIterator</tt> or the start (i.e. 0) of the
* <tt>String</tt> over which this <tt>Normalizer</tt> is iterating
* @deprecated To be removed after 2003-aug-31. Use startIndex() instead.
* @deprecated ICU 2.2. To be removed after 2003-aug-31. Use startIndex() instead.
* @return The codepoint as an int
* @see #startIndex
*/
@ -1681,9 +1783,10 @@ public final class Normalizer implements Cloneable{
* Retrieve the index of the end of the input text. This is the end index
* of the <tt>CharacterIterator</tt> or the length of the <tt>String</tt>
* over which this <tt>Normalizer</tt> is iterating
* @deprecated To be removed after 2003-aug-31. Use endIndex() instead.
* @deprecated ICU 2.2. To be removed after 2003-aug-31. Use endIndex() instead.
* @return The codepoint as an int
* @see #endIndex
* @draft ICU 2.2
*/
public int getEndIndex() {
return text.getLength()-1;
@ -1692,6 +1795,7 @@ public final class Normalizer implements Cloneable{
* Return the first character in the normalized text-> This resets
* the <tt>Normalizer's</tt> position to the beginning of the text->
* @return The codepoint as an int
* @draft ICU 2.2
*/
public int first() {
reset();
@ -1703,6 +1807,7 @@ public final class Normalizer implements Cloneable{
* the <tt>Normalizer's</tt> position to be just before the
* the input text corresponding to that normalized character.
* @return The codepoint as an int
* @draft ICU 2.2
*/
public int last() {
text.setToLimit();
@ -1723,7 +1828,8 @@ public final class Normalizer implements Cloneable{
* correspondence between characters returned by <tt>next</tt> and
* <tt>previous</tt> and the indices passed to and returned from
* <tt>setIndex</tt> and {@link #getIndex}.
*@return The current iteration position
* @return The current iteration position
* @draft ICU 2.2
*/
public int getIndex(){
if(bufferPos<bufferLimit) {
@ -1738,6 +1844,7 @@ public final class Normalizer implements Cloneable{
* index of the <tt>CharacterIterator</tt> or the start (i.e. 0) of the
* <tt>String</tt> over which this <tt>Normalizer</tt> is iterating
* @return The current iteration position
* @draft ICU 2.2
*/
public int startIndex(){
return 0;
@ -1748,6 +1855,7 @@ public final class Normalizer implements Cloneable{
* of the <tt>CharacterIterator</tt> or the length of the <tt>String</tt>
* over which this <tt>Normalizer</tt> is iterating
* @return The current iteration position
* @draft ICU 2.2
*/
public int endIndex(){
return text.getLength();
@ -1780,6 +1888,7 @@ public final class Normalizer implements Cloneable{
* </ul>
*
* @see #getMode
* @draft ICU 2.2
*/
public void setMode(Mode newMode){
mode = newMode;
@ -1788,6 +1897,7 @@ public final class Normalizer implements Cloneable{
* Return the basic operation performed by this <tt>Normalizer</tt>
*
* @see #setMode
* @draft ICU 2.2
*/
public Mode getMode() {
return mode;
@ -1813,7 +1923,7 @@ public final class Normalizer implements Cloneable{
* turn the option on and <tt>false</tt> to turn it off.
*
* @see #getOption
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
*/
public void setOption(int option,boolean value) {
if (value) {
@ -1827,7 +1937,7 @@ public final class Normalizer implements Cloneable{
* Determine whether an option is turned on or off.
* <p>
* @see #setOption
* @deprecated To be removed after 2003-Aug-31.
* @deprecated ICU 2.2. To be removed after 2003-Aug-31.
*/
public int getOption(int option){
if((options & option)!=0){
@ -1844,6 +1954,7 @@ public final class Normalizer implements Cloneable{
* underlying text storage
* @throws IndexOutOfBoundsException
* @see #getLength
* @draft ICU 2.2
*/
public int getText(char[] fillIn){
return text.getText(fillIn);
@ -1852,6 +1963,7 @@ public final class Normalizer implements Cloneable{
/**
* Gets the length of underlying text storage
* @return the length
* @draft ICU 2.2
*/
public int getLength(){
return text.getLength();
@ -1860,6 +1972,7 @@ public final class Normalizer implements Cloneable{
/**
* Returns the text under iteration as a string
* @param result a copy of the text under iteration.
* @draft ICU 2.2
*/
public String getText(){
return text.getText();
@ -1869,6 +1982,7 @@ public final class Normalizer implements Cloneable{
* Set the input text over which this <tt>Normalizer</tt> will iterate.
* The iteration position is set to the beginning of the input text->
* @param newText The new string to be normalized.
* @draft ICU 2.2
*/
public void setText(StringBuffer newText){
@ -1884,6 +1998,7 @@ public final class Normalizer implements Cloneable{
* Set the input text over which this <tt>Normalizer</tt> will iterate.
* The iteration position is set to the beginning of the input text->
* @param newText The new string to be normalized.
* @draft ICU 2.2
*/
public void setText(char[] newText){
@ -1899,6 +2014,7 @@ public final class Normalizer implements Cloneable{
* Set the input text over which this <tt>Normalizer</tt> will iterate.
* The iteration position is set to the beginning of the input text->
* @param newText The new string to be normalized.
* @draft ICU 2.2
*/
public void setText(String newText){
@ -1914,6 +2030,7 @@ public final class Normalizer implements Cloneable{
* Set the input text over which this <tt>Normalizer</tt> will iterate.
* The iteration position is set to the beginning of the input text->
* @param newText The new string to be normalized.
* @draft ICU 2.2
*/
public void setText(CharacterIterator newText){
@ -1929,6 +2046,7 @@ public final class Normalizer implements Cloneable{
* Set the input text over which this <tt>Normalizer</tt> will iterate.
* The iteration position is set to the beginning of the string.
* @param newText The new string to be normalized.
* @draft ICU 2.2
*/
//Internal method for now
public void setText(UCharacterIterator newText){
@ -2091,7 +2209,7 @@ public final class Normalizer implements Cloneable{
return buffer.length-startIndex[0];
}
protected static int previous(UCharacterIterator src,
private static int previous(UCharacterIterator src,
char[] dest, int destStart, int destLimit,
Mode mode,
/*int options,*/
@ -2319,7 +2437,7 @@ public final class Normalizer implements Cloneable{
return bufferIndex;
}
protected static int next(UCharacterIterator src,
private static int next(UCharacterIterator src,
char[] dest, int destStart, int destLimit,
Normalizer.Mode mode, /*int options,*/
boolean doNormalize, boolean[] pNeededToNormalize){

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/StringCharacterIterator.java,v $
* $Date: 2002/11/22 00:37:00 $
* $Revision: 1.4 $
* $Date: 2002/12/03 22:03:58 $
* $Revision: 1.5 $
*
*****************************************************************************************
*/
@ -28,7 +28,7 @@ import java.text.CharacterIterator;
* entire <code>String</code>.
*
* @see CharacterIterator
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public final class StringCharacterIterator implements CharacterIterator
@ -41,7 +41,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Constructs an iterator with an initial index of 0.
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public StringCharacterIterator(String text)
{
@ -53,7 +53,7 @@ public final class StringCharacterIterator implements CharacterIterator
*
* @param text The String to be iterated over
* @param pos Initial iterator position
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public StringCharacterIterator(String text, int pos)
{
@ -68,7 +68,7 @@ public final class StringCharacterIterator implements CharacterIterator
* @param begin Index of the first character
* @param end Index of the character following the last character
* @param pos Initial iterator position
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public StringCharacterIterator(String text, int begin, int end, int pos) {
if (text == null) {
@ -96,7 +96,7 @@ public final class StringCharacterIterator implements CharacterIterator
* is called.
*
* @param text The String to be iterated over
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public void setText(String text) {
if (text == null) {
@ -111,7 +111,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.first() for String.
* @see CharacterIterator#first
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public char first()
{
@ -122,7 +122,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.last() for String.
* @see CharacterIterator#last
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public char last()
{
@ -137,7 +137,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.setIndex() for String.
* @see CharacterIterator#setIndex
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public char setIndex(int p)
{
@ -151,7 +151,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.current() for String.
* @see CharacterIterator#current
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public char current()
{
@ -166,7 +166,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.next() for String.
* @see CharacterIterator#next
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public char next()
{
@ -183,7 +183,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.previous() for String.
* @see CharacterIterator#previous
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public char previous()
{
@ -199,7 +199,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.getBeginIndex() for String.
* @see CharacterIterator#getBeginIndex
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public int getBeginIndex()
{
@ -209,7 +209,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.getEndIndex() for String.
* @see CharacterIterator#getEndIndex
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public int getEndIndex()
{
@ -219,7 +219,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Implements CharacterIterator.getIndex() for String.
* @see CharacterIterator#getIndex
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public int getIndex()
{
@ -231,7 +231,7 @@ public final class StringCharacterIterator implements CharacterIterator
* @param obj the StringCharacterIterator object to be compared with.
* @return true if the given obj is the same as this
* StringCharacterIterator object; false otherwise.
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public boolean equals(Object obj)
{
@ -259,7 +259,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Computes a hashcode for this iterator.
* @return A hash code
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public int hashCode()
{
@ -269,7 +269,7 @@ public final class StringCharacterIterator implements CharacterIterator
/**
* Creates a copy of this iterator.
* @return A copy of this
* @deprecated since 2.4, use java.text.StringCharacterIterator instead.
* @deprecated ICU 2.4. Use java.text.StringCharacterIterator instead.
*/
public Object clone()
{

View file

@ -34,11 +34,17 @@ import com.ibm.icu.impl.UCharacterProperty;
* iteration, <code>java.text.CharacterIterator</code> can only iterate over
* code units and is limited to BMP (0 - 0xFFFF)
* @author Ram
* @version release 2.2, May 2002
* @draft ICU 2.4
*/
public abstract class UCharacterIterator
implements Cloneable,UForwardCharacterIterator {
/**
* Protected default constructor for the subclasses
* @draft ICU 2.4
*/
protected UCharacterIterator(){
}
// static final methods ----------------------------------------------------
@ -48,6 +54,7 @@ public abstract class UCharacterIterator
* @param source a valid source as a <code>Replaceable</code> object
* @return UCharacterIterator object
* @exception IllegalArgumentException if the argument is null
* @draft ICU 2.4
*/
public static final UCharacterIterator getInstance(Replaceable source){
return new ReplaceableUCharacterIterator(source);
@ -59,6 +66,7 @@ public abstract class UCharacterIterator
* @param source a string
* @return UCharacterIterator object
* @exception IllegalArgumentException if the argument is null
* @draft ICU 2.4
*/
public static final UCharacterIterator getInstance(String source){
return new ReplaceableUCharacterIterator(source);
@ -70,6 +78,7 @@ public abstract class UCharacterIterator
* @param source an array of UTF-16 code units
* @return UCharacterIterator object
* @exception IllegalArgumentException if the argument is null
* @draft ICU 2.4
*/
public static final UCharacterIterator getInstance(char[] source){
return getInstance(source,0,source.length);
@ -81,6 +90,7 @@ public abstract class UCharacterIterator
* @param source an array of UTF-16 code units
* @return UCharacterIterator object
* @exception IllegalArgumentException if the argument is null
* @draft ICU 2.4
*/
public static final UCharacterIterator getInstance(char[] source, int start, int limit){
return new UCharArrayIterator(source,start,limit);
@ -91,6 +101,7 @@ public abstract class UCharacterIterator
* @param source an string buffer of UTF-16 code units
* @return UCharacterIterator object
* @exception IllegalArgumentException if the argument is null
* @draft ICU 2.4
*/
public static final UCharacterIterator getInstance(StringBuffer source){
return new ReplaceableUCharacterIterator(source);
@ -102,6 +113,7 @@ public abstract class UCharacterIterator
* @param source a valid CharacterIterator object.
* @return UCharacterIterator object
* @exception IllegalArgumentException if the argument is null
* @draft ICU 2.4
*/
public static final UCharacterIterator getInstance(CharacterIterator source){
return new CharacterIteratorWrapper(source);
@ -112,7 +124,8 @@ public abstract class UCharacterIterator
* Returns a <code>java.text.CharacterIterator</code> object for
* the underlying text of this iterator. The returned iterator is
* independent of this iterator.
* @return java.text.CharacterIterator object
* @return java.text.CharacterIterator object
* @draft ICU 2.4
*/
public CharacterIterator getCharacterIterator(){
return new UCharacterIteratorWrapper(this);
@ -122,6 +135,7 @@ public abstract class UCharacterIterator
* Returns the code unit at the current index. If index is out
* of range, returns DONE. Index is not changed.
* @return current code unit
* @draft ICU 2.4
*/
public abstract int current();
@ -132,6 +146,7 @@ public abstract class UCharacterIterator
* trail surrogate, then the code point is returned. Otherwise, the code
* unit at index is returned. Index is not changed.
* @return current codepoint
* @draft ICU 2.4
*/
public int currentCodePoint(){
int ch = current();
@ -161,6 +176,7 @@ public abstract class UCharacterIterator
/**
* Returns the length of the text
* @return length of the text
* @draft ICU 2.4
*/
public abstract int getLength();
@ -168,6 +184,7 @@ public abstract class UCharacterIterator
/**
* Gets the current index in text.
* @return current index in text.
* @draft ICU 2.4
*/
public abstract int getIndex();
@ -178,7 +195,8 @@ public abstract class UCharacterIterator
* range, DONE is returned, and the iterator is reset to the limit
* of the text.
* @return the next UTF16 code unit, or DONE if the index is at the limit
* of the text.
* of the text.
* @draft ICU 2.4
*/
public abstract int next();
@ -190,7 +208,8 @@ public abstract class UCharacterIterator
* the surrogate pair, and the code point represented by the pair
* is returned.
* @return the next codepoint in text, or DONE if the index is at
* the limit of the text.
* the limit of the text.
* @draft ICU 2.4
*/
public int nextCodePoint(){
int ch1 = next();
@ -213,7 +232,8 @@ public abstract class UCharacterIterator
* resulting index is less than 0, the index is reset to 0 and
* DONE is returned.
* @return the previous code unit in the text, or DONE if the new
* index is before the start of the text.
* index is before the start of the text.
* @draft ICU 2.4
*/
public abstract int previous();
@ -226,7 +246,8 @@ public abstract class UCharacterIterator
* decremented to the start of the surrogate pair, and the code
* point represented by the pair is returned.
* @return the previous code point in the text, or DONE if the new
* index is before the start of the text.
* index is before the start of the text.
* @draft ICU 2.4
*/
public int previousCodePoint(){
int ch1 = previous();
@ -248,11 +269,13 @@ public abstract class UCharacterIterator
* @param index the index within the text.
* @exception IndexOutOfBoundsException is thrown if an invalid index is
* supplied
* @draft ICU 2.4
*/
public abstract void setIndex(int index);
/**
* Sets the current index to the limit.
* @draft ICU 2.4
*/
public void setToLimit() {
setIndex(getLength());
@ -260,6 +283,7 @@ public abstract class UCharacterIterator
/**
* Sets the current index to the start.
* @draft ICU 2.4
*/
public void setToStart() {
setIndex(0);
@ -297,7 +321,8 @@ public abstract class UCharacterIterator
* @param offset the position within the array to start putting the data.
* @return the number of code units added to fillIn, as a convenience
* @exception IndexOutOfBounds exception if there is not enough
* room after offset in the array, or if offset < 0.
* room after offset in the array, or if offset < 0.
* @draft ICU 2.4
*/
public abstract int getText(char[] fillIn, int offset);
@ -308,7 +333,8 @@ public abstract class UCharacterIterator
* units.
* @return the number of code units added to fillIn, as a convenience
* @exception IndexOutOfBounds exception if there is not enough
* room in the array.
* room in the array.
* @draft ICU 2.4
*/
public final int getText(char[] fillIn) {
return getText(fillIn, 0);
@ -317,6 +343,7 @@ public abstract class UCharacterIterator
/**
* Convenience method for returning the underlying text storage as as string
* @return the underlying text storage in the iterator as a string
* @draft ICU 2.4
*/
public String getText() {
char[] text = new char[getLength()];
@ -336,7 +363,8 @@ public abstract class UCharacterIterator
* index.
* @return the new index.
* @exception IndexOutOfBoundsException is thrown if an invalid index is
* supplied
* supplied
* @draft ICU 2.4
*
*/
public int moveIndex(int delta) {
@ -358,6 +386,7 @@ public abstract class UCharacterIterator
* @return the new index
* @exception IndexOutOfBoundsException is thrown if an invalid delta is
* supplied
* @draft ICU 2.4
*/
public int moveCodePointIndex(int delta){
if(delta>0){
@ -376,6 +405,7 @@ public abstract class UCharacterIterator
* Creates a copy of this iterator, independent from other iterators.
* If it is not possible to clone the iterator, returns null.
* @return copy of this iterator
* @draft ICU 2.4
*/
public Object clone() throws CloneNotSupportedException{
return super.clone();

View file

@ -59,6 +59,7 @@ package com.ibm.icu.text;
* }
* </code>
* </p>
* @draft ICU 2.4
*
*/
@ -66,6 +67,7 @@ public interface UForwardCharacterIterator {
/**
* Indicator that we have reached the ends of the UTF16 text.
* @draft ICU 2.4
*/
public static final int DONE = -1;
/**
@ -74,7 +76,8 @@ public interface UForwardCharacterIterator {
* range, DONE is returned, and the iterator is reset to the limit
* of the text.
* @return the next UTF16 code unit, or DONE if the index is at the limit
* of the text.
* of the text.
* @draft ICU 2.4
*/
public int next();
@ -86,7 +89,8 @@ public interface UForwardCharacterIterator {
* the surrogate pair, and the code point represented by the pair
* is returned.
* @return the next codepoint in text, or DONE if the index is at
* the limit of the text.
* the limit of the text.
* @draft ICU 2.4
*/
public int nextCodePoint();

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/UnicodeCompressor.java,v $
* $Date: 2002/02/16 03:06:20 $
* $Revision: 1.3 $
* $Date: 2002/12/03 22:03:59 $
* $Revision: 1.4 $
*
*****************************************************************************************
*/
@ -77,11 +77,7 @@ package com.ibm.icu.text;
* @see UnicodeDecompressor
*
* @author Stephen F. Booth
* @version 1.5 05 Aug 99
* @version 1.4 21 Jul 99
* @version 1.3 10 Mar 99
* @version 1.2 08 Mar 99
* @version 1.1 11 Jan 99
* @draft ICU 2.4
*/
/*
@ -294,6 +290,7 @@ public final class UnicodeCompressor implements SCSU
* Create a UnicodeCompressor.
* Sets all windows to their default values.
* @see #reset
* @draft ICU 2.4
*/
public UnicodeCompressor()
{
@ -305,6 +302,7 @@ public final class UnicodeCompressor implements SCSU
* @param buffer The string to compress.
* @return A byte array containing the compressed characters.
* @see #compress(char [], int, int)
* @draft ICU 2.4
*/
public static byte [] compress(String buffer)
{
@ -318,6 +316,7 @@ public final class UnicodeCompressor implements SCSU
* @param limit The limit of the character run to compress.
* @return A byte array containing the compressed characters.
* @see #compress(String)
* @draft ICU 2.4
*/
public static byte [] compress(char [] buffer,
int start,
@ -358,6 +357,7 @@ public final class UnicodeCompressor implements SCSU
* compressed data.
* @param byteBufferLimit The limiting offset for writing compressed data.
* @return The number of bytes written to byteBuffer.
* @draft ICU 2.4
*/
public int compress(char [] charBuffer,
int charBufferStart,
@ -822,7 +822,10 @@ public final class UnicodeCompressor implements SCSU
return (bytePos - byteBufferStart);
}
/** Reset the compressor to its initial state. */
/**
* Reset the compressor to its initial state.
* @draft ICU 2.4
*/
public void reset()
{
int i;

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/UnicodeDecompressor.java,v $
* $Date: 2002/02/16 03:06:21 $
* $Revision: 1.3 $
* $Date: 2002/12/03 22:03:59 $
* $Revision: 1.4 $
*
*****************************************************************************************
*/
@ -73,11 +73,7 @@ package com.ibm.icu.text;
* @see UnicodeCompressor
*
* @author Stephen F. Booth
* @version 1.5 05 Aug 99
* @version 1.4 21 Jul 99
* @version 1.3 10 Mar 99
* @version 1.2 08 Mar 99
* @version 1.1 11 Jan 99
* @draft ICU 2.4
*/
public final class UnicodeDecompressor implements SCSU
{
@ -108,6 +104,7 @@ public final class UnicodeDecompressor implements SCSU
* Create a UnicodeDecompressor.
* Sets all windows to their default values.
* @see #reset
* @draft ICU 2.4
*/
public UnicodeDecompressor()
{
@ -119,6 +116,7 @@ public final class UnicodeDecompressor implements SCSU
* @param buffer The byte array to decompress.
* @return A String containing the decompressed characters.
* @see #decompress(byte [], int, int)
* @draft ICU 2.4
*/
public static String decompress(byte [] buffer)
{
@ -133,6 +131,7 @@ public final class UnicodeDecompressor implements SCSU
* @param limit The limit of the byte run to decompress.
* @return A character array containing the decompressed bytes.
* @see #decompress(byte [])
* @draft ICU 2.4
*/
public static char [] decompress(byte [] buffer,
int start,
@ -172,6 +171,7 @@ public final class UnicodeDecompressor implements SCSU
* @param charBufferLimit The limiting offset for writing
* decompressed data.
* @return The number of Unicode characters written to charBuffer.
* @draft ICU 2.4
*/
public int decompress(byte [] byteBuffer,
int byteBufferStart,
@ -544,7 +544,10 @@ public final class UnicodeDecompressor implements SCSU
return (ucPos - charBufferStart);
}
/** Reset the decompressor to its initial state. */
/**
* Reset the decompressor to its initial state.
* @draft ICU 2.4
*/
public void reset()
{
// reset dynamic windows

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/CaseInsensitiveString.java,v $
* $Date: 2002/08/13 23:43:27 $
* $Revision: 1.3 $
* $Date: 2002/12/03 22:04:17 $
* $Revision: 1.4 $
*
*******************************************************************************
*/
@ -18,21 +18,34 @@ import com.ibm.icu.lang.UCharacter;
* A string used as a key in java.util.Hashtable and other
* collections. It retains case information, but its equals() and
* hashCode() methods ignore case.
* @stable
*/
public class CaseInsensitiveString {
private String string;
private int hash = 0;
/**
* Constructs an CaseInsentiveString object from the given string
* @param s The string to construct this object from
* @stable
*/
public CaseInsensitiveString(String s) {
string = s;
}
/**
* returns the underlying string
* @return String
* @stable
*/
public String getString() {
return string;
}
/**
* Compare the object with this
* @param o Object to compare this object with
* @stable
*/
public boolean equals(Object o) {
try {
return string.equalsIgnoreCase(((CaseInsensitiveString)o).string);
@ -44,7 +57,12 @@ public class CaseInsensitiveString {
}
}
}
/**
* Returns the hashCode of this object
* @return int hashcode
* @stable
*/
public int hashCode() {
if (hash == 0) {
hash = UCharacter.foldCase(string, true).hashCode();

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/CompactByteArray.java,v $
* $Date: 2002/08/12 20:26:39 $
* $Revision: 1.8 $
* $Date: 2002/12/03 22:04:17 $
* $Revision: 1.9 $
*
*****************************************************************************************
*/
@ -31,19 +31,21 @@ import com.ibm.icu.impl.Utility;
* array contains the indicies of Unicode characters to the value array.
*
* @see CompactCharArray
* @version $Revision: 1.8 $
* @author Helena Shih
* @draft ICU 2.4
*/
public final class CompactByteArray implements Cloneable {
/**
* The total number of Unicode characters.
* @draft ICU 2.4
*/
public static final int UNICODECOUNT =65536;
/**
* Default constructor for CompactByteArray, the default value of the
* compact array is 0.
* @draft ICU 2.4
*/
public CompactByteArray()
{
@ -53,6 +55,7 @@ public final class CompactByteArray implements Cloneable {
/**
* Constructor for CompactByteArray.
* @param defaultValue the default value of the compact array.
* @draft ICU 2.4
*/
public CompactByteArray(byte defaultValue)
{
@ -77,6 +80,7 @@ public final class CompactByteArray implements Cloneable {
* @param indexArray the indicies of the compact array.
* @param newValues the values of the compact array.
* @exception IllegalArgumentException If the index is out of range.
* @draft ICU 2.4
*/
public CompactByteArray(char indexArray[],
byte newValues[])
@ -102,6 +106,7 @@ public final class CompactByteArray implements Cloneable {
*
* @throws IllegalArgumentException if the index or value array is
* the wrong size.
* @draft ICU 2.4
*/
public CompactByteArray(String indexArray,
String valueArray)
@ -114,6 +119,7 @@ public final class CompactByteArray implements Cloneable {
* Get the mapped value of a Unicode character.
* @param index the character to get the mapped value with
* @return the mapped value of the given character
* @draft ICU 2.4
*/
public byte elementAt(char index)
{
@ -126,6 +132,7 @@ public final class CompactByteArray implements Cloneable {
* Set automatically expands the array if it is compacted.
* @param index the character to set the mapped value with
* @param value the new mapped value
* @draft ICU 2.4
*/
public void setElementAt(char index, byte value)
{
@ -141,6 +148,7 @@ public final class CompactByteArray implements Cloneable {
* @param start the starting offset of the range
* @param end the ending offset of the range
* @param value the new mapped value
* @draft ICU 2.4
*/
public void setElementAt(char start, char end, byte value)
{
@ -153,13 +161,17 @@ public final class CompactByteArray implements Cloneable {
touchBlock(i >> BLOCKSHIFT, value);
}
}
/**
* Compact the array.
* @draft ICU 2.4
*/
public void compact() {
compact(false);
}
/**
* Compact the array.
* @draft ICU 2.4
*/
public void compact(boolean exhaustive)
{
@ -251,6 +263,7 @@ public final class CompactByteArray implements Cloneable {
/**
* For internal use only. Do not modify the result, the behavior of
* modified results are undefined.
* @draft ICU 2.4
*/
public char[] getIndexArray()
{
@ -260,6 +273,7 @@ public final class CompactByteArray implements Cloneable {
/**
* For internal use only. Do not modify the result, the behavior of
* modified results are undefined.
* @draft ICU 2.4
*/
public byte[] getValueArray()
{
@ -268,6 +282,7 @@ public final class CompactByteArray implements Cloneable {
/**
* Overrides Cloneable
* @draft ICU 2.4
*/
public Object clone()
{
@ -287,6 +302,7 @@ public final class CompactByteArray implements Cloneable {
* @param obj the compact array object to be compared with this.
* @return true if the current compact array object is the same
* as the compact array object obj; false otherwise.
* @draft ICU 2.4
*/
public boolean equals(Object obj) {
if (obj == null) return false;
@ -305,6 +321,7 @@ public final class CompactByteArray implements Cloneable {
/**
* Generates the hash code for the compact array object
* @draft ICU 2.4
*/
public int hashCode() {
int result = 0;

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/CompactCharArray.java,v $
* $Date: 2002/08/12 20:26:39 $
* $Revision: 1.9 $
* $Date: 2002/12/03 22:04:17 $
* $Revision: 1.10 $
*
*****************************************************************************************
*/
@ -32,19 +32,21 @@ import com.ibm.icu.impl.Utility;
* A compact array is composed of a index array and value array. The index
* array contains the indicies of Unicode characters to the value array.
* @see CompactByteArray
* @version $Revision: 1.9 $
* @author Helena Shih
* @draft ICU 2.4
*/
public final class CompactCharArray implements Cloneable {
/**
* The total number of Unicode characters.
* @draft ICU 2.4
*/
public static final int UNICODECOUNT = 65536;
/**
* Default constructor for CompactCharArray, the default value of the
* compact array is 0.
* @draft ICU 2.4
*/
public CompactCharArray()
{
@ -54,6 +56,7 @@ public final class CompactCharArray implements Cloneable {
/**
* Constructor for CompactCharArray.
* @param defaultValue the default value of the compact array.
* @draft ICU 2.4
*/
public CompactCharArray(char defaultValue)
{
@ -78,6 +81,7 @@ public final class CompactCharArray implements Cloneable {
* @param indexArray the indicies of the compact array.
* @param newValues the values of the compact array.
* @exception IllegalArgumentException If the index is out of range.
* @draft ICU 2.4
*/
public CompactCharArray(char indexArray[],
char newValues[])
@ -103,6 +107,7 @@ public final class CompactCharArray implements Cloneable {
*
* @throws IllegalArgumentException if the index or value array is
* the wrong size.
* @draft ICU 2.4
*/
public CompactCharArray(String indexArray,
String valueArray)
@ -115,6 +120,7 @@ public final class CompactCharArray implements Cloneable {
* Get the mapped value of a Unicode character.
* @param index the character to get the mapped value with
* @return the mapped value of the given character
* @draft ICU 2.4
*/
public char elementAt(char index)
{
@ -128,6 +134,7 @@ public final class CompactCharArray implements Cloneable {
* Set automatically expands the array if it is compacted.
* @param index the character to set the mapped value with
* @param value the new mapped value
* @draft ICU 2.4
*/
public void setElementAt(char index, char value)
{
@ -143,6 +150,7 @@ public final class CompactCharArray implements Cloneable {
* @param start the starting offset of the range
* @param end the ending offset of the range
* @param value the new mapped value
* @draft ICU 2.4
*/
public void setElementAt(char start, char end, char value)
{
@ -155,13 +163,17 @@ public final class CompactCharArray implements Cloneable {
touchBlock(i >> BLOCKSHIFT, value);
}
}
/**
* Compact the array
* @draft ICU 2.4
*/
public void compact() {
compact(true);
}
/**
* Compact the array.
* @draft ICU 2.4
*/
public void compact(boolean exhaustive)
{
@ -275,6 +287,7 @@ public final class CompactCharArray implements Cloneable {
/**
* For internal use only. Do not modify the result, the behavior of
* modified results are undefined.
* @draft ICU 2.4
*/
public char[] getIndexArray()
{
@ -284,6 +297,7 @@ public final class CompactCharArray implements Cloneable {
/**
* For internal use only. Do not modify the result, the behavior of
* modified results are undefined.
* @draft ICU 2.4
*/
public char[] getValueArray()
{
@ -292,6 +306,7 @@ public final class CompactCharArray implements Cloneable {
/**
* Overrides Cloneable
* @draft ICU 2.4
*/
public Object clone()
{
@ -311,6 +326,7 @@ public final class CompactCharArray implements Cloneable {
* @param obj the compact array object to be compared with this.
* @return true if the current compact array object is the same
* as the compact array object obj; false otherwise.
* @draft ICU 2.4
*/
public boolean equals(Object obj) {
if (obj == null) return false;
@ -329,6 +345,7 @@ public final class CompactCharArray implements Cloneable {
/**
* Generates the hash code for the compact array object
* @draft ICU 2.4
*/
public int hashCode() {
int result = 0;
@ -365,7 +382,9 @@ public final class CompactCharArray implements Cloneable {
isCompact = false;
}
}
/**
* @draft ICU 2.4
*/
public static final int BLOCKSHIFT = 5; // NormalizerBuilder needs - liu
static final int BLOCKCOUNT =(1<<BLOCKSHIFT);
static final int INDEXSHIFT =(16-BLOCKSHIFT);

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/StringTokenizer.java,v $
* $Date: 2002/10/28 21:59:22 $
* $Revision: 1.1 $
* $Date: 2002/12/03 22:04:17 $
* $Revision: 1.2 $
*
*******************************************************************************
*/
@ -95,8 +95,7 @@ import com.ibm.icu.text.UTF16;
* </pre></blockquote>
* </p>
* @author syn wee
* @since oct 26 2002
* @draft 2.4
* @draft ICU 2.4
*/
public final class StringTokenizer implements Enumeration
{
@ -115,6 +114,7 @@ public final class StringTokenizer implements Enumeration
* @param returndelims flag indicating whether to return the delimiters
* as tokens.
* @exception throws a NullPointerException if str is null
* @draft ICU 2.4
*/
public StringTokenizer(String str, UnicodeSet delim, boolean returndelims)
{
@ -149,6 +149,7 @@ public final class StringTokenizer implements Enumeration
* @param str a string to be parsed.
* @param delim the delimiters.
* @exception throws a NullPointerException if str is null
* @draft ICU 2.4
*/
public StringTokenizer(String str, UnicodeSet delim)
{
@ -168,6 +169,7 @@ public final class StringTokenizer implements Enumeration
* @param returndelims flag indicating whether to return the delimiters
* as tokens.
* @exception throws a NullPointerException if str is null
* @draft ICU 2.4
*/
public StringTokenizer(String str, String delim, boolean returndelims)
{
@ -202,6 +204,7 @@ public final class StringTokenizer implements Enumeration
* @param str a string to be parsed.
* @param delim the delimiters.
* @exception throws a NullPointerException if str is null
* @draft ICU 2.4
*/
public StringTokenizer(String str, String delim)
{
@ -218,6 +221,7 @@ public final class StringTokenizer implements Enumeration
* <p>Delimiter characters themselves will not be treated as tokens.</p>
* @param str a string to be parsed
* @exception throws a NullPointerException if str is null
* @draft ICU 2.4
*/
public StringTokenizer(String str)
{
@ -234,6 +238,7 @@ public final class StringTokenizer implements Enumeration
* @return <code>true</code> if and only if there is at least one token
* in the string after the current position; <code>false</code>
* otherwise.
* @draft ICU 2.4
*/
public boolean hasMoreTokens()
{
@ -245,6 +250,7 @@ public final class StringTokenizer implements Enumeration
* @return the next token from this string tokenizer.
* @exception NoSuchElementException if there are no more tokens in
* this tokenizer's string.
* @draft ICU 2.4
*/
public String nextToken()
{
@ -316,6 +322,7 @@ public final class StringTokenizer implements Enumeration
* @return the next token, after switching to the new delimiter set.
* @exception NoSuchElementException if there are no more tokens in
* this tokenizer's string.
* @draft ICU 2.4
*/
public String nextToken(String delim)
{
@ -339,6 +346,7 @@ public final class StringTokenizer implements Enumeration
* @return the next token, after switching to the new delimiter set.
* @exception NoSuchElementException if there are no more tokens in
* this tokenizer's string.
* @draft ICU 2.4
*/
public String nextToken(UnicodeSet delim)
{
@ -358,6 +366,7 @@ public final class StringTokenizer implements Enumeration
* @return <code>true</code> if there are more tokens;
* <code>false</code> otherwise.
* @see #hasMoreTokens()
* @draft ICU 2.4
*/
public boolean hasMoreElements()
{
@ -373,6 +382,7 @@ public final class StringTokenizer implements Enumeration
* @exception NoSuchElementException if there are no more tokens in
* this tokenizer's string.
* @see #nextToken()
* @draft ICU 2.4
*/
public Object nextElement()
{
@ -386,6 +396,7 @@ public final class StringTokenizer implements Enumeration
* @return the number of tokens remaining in the string using the
* current delimiter set.
* @see #nextToken()
* @draft ICU 2.4
*/
public int countTokens()
{