2 *******************************************************************************
\r
3 * Copyright (C) 1996-2004, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
8 package com.ibm.icu.lang;
\r
10 import com.ibm.icu.lang.UCharacterEnums.ECharacterCategory;
\r
13 * Enumerated Unicode category types from the UnicodeData.txt file.
\r
14 * Used as return results from <a href=UCharacter.html>UCharacter</a>
\r
15 * Equivalent to icu's UCharCategory.
\r
16 * Refer to <a href="http://www.unicode.org/Public/UNIDATA/UCD.html">
\r
17 * Unicode Consortium</a> for more information about UnicodeData.txt.
\r
19 * <em>NOTE:</em> the UCharacterCategory values are <em>not</em> compatible with
\r
20 * those returned by java.lang.Character.getType. UCharacterCategory values
\r
21 * match the ones used in ICU4C, while java.lang.Character type
\r
22 * values, though similar, skip the value 17.</p>
\r
24 * This class is not subclassable
\r
26 * @author Syn Wee Quek
\r
30 public final class UCharacterCategory implements ECharacterCategory
\r
33 * Gets the name of the argument category
\r
34 * @param category to retrieve name
\r
35 * @return category name
\r
38 public static String toString(int category)
\r
41 case UPPERCASE_LETTER :
\r
42 return "Letter, Uppercase";
\r
43 case LOWERCASE_LETTER :
\r
44 return "Letter, Lowercase";
\r
45 case TITLECASE_LETTER :
\r
46 return "Letter, Titlecase";
\r
47 case MODIFIER_LETTER :
\r
48 return "Letter, Modifier";
\r
50 return "Letter, Other";
\r
51 case NON_SPACING_MARK :
\r
52 return "Mark, Non-Spacing";
\r
53 case ENCLOSING_MARK :
\r
54 return "Mark, Enclosing";
\r
55 case COMBINING_SPACING_MARK :
\r
56 return "Mark, Spacing Combining";
\r
57 case DECIMAL_DIGIT_NUMBER :
\r
58 return "Number, Decimal Digit";
\r
59 case LETTER_NUMBER :
\r
60 return "Number, Letter";
\r
62 return "Number, Other";
\r
63 case SPACE_SEPARATOR :
\r
64 return "Separator, Space";
\r
65 case LINE_SEPARATOR :
\r
66 return "Separator, Line";
\r
67 case PARAGRAPH_SEPARATOR :
\r
68 return "Separator, Paragraph";
\r
70 return "Other, Control";
\r
72 return "Other, Format";
\r
74 return "Other, Private Use";
\r
76 return "Other, Surrogate";
\r
77 case DASH_PUNCTUATION :
\r
78 return "Punctuation, Dash";
\r
79 case START_PUNCTUATION :
\r
80 return "Punctuation, Open";
\r
81 case END_PUNCTUATION :
\r
82 return "Punctuation, Close";
\r
83 case CONNECTOR_PUNCTUATION :
\r
84 return "Punctuation, Connector";
\r
85 case OTHER_PUNCTUATION :
\r
86 return "Punctuation, Other";
\r
88 return "Symbol, Math";
\r
89 case CURRENCY_SYMBOL :
\r
90 return "Symbol, Currency";
\r
91 case MODIFIER_SYMBOL :
\r
92 return "Symbol, Modifier";
\r
94 return "Symbol, Other";
\r
95 case INITIAL_PUNCTUATION :
\r
96 return "Punctuation, Initial quote";
\r
97 case FINAL_PUNCTUATION :
\r
98 return "Punctuation, Final quote";
\r
100 return "Unassigned";
\r
103 // private constructor -----------------------------------------------
\r
106 * Private constructor to prevent initialisation
\r
108 private UCharacterCategory()
\r