• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html#License
3 /**
4  *******************************************************************************
5  * Copyright (C) 1996-2004, International Business Machines Corporation and    *
6  * others. All Rights Reserved.                                                *
7  *******************************************************************************
8  */
9 
10 package com.ibm.icu.lang;
11 
12 import com.ibm.icu.lang.UCharacterEnums.ECharacterCategory;
13 
14 /**
15  * Enumerated Unicode category types from the UnicodeData.txt file.
16  * Used as return results from <a href=UCharacter.html>UCharacter</a>
17  * Equivalent to icu's UCharCategory.
18  * Refer to <a href="http://www.unicode.org/Public/UNIDATA/UCD.html">
19  * Unicode Consortium</a> for more information about UnicodeData.txt.
20  * <p>
21  * <em>NOTE:</em> the UCharacterCategory values are <em>not</em> compatible with
22  * those returned by java.lang.Character.getType.  UCharacterCategory values
23  * match the ones used in ICU4C, while java.lang.Character type
24  * values, though similar, skip the value 17.</p>
25  * <p>
26  * This class is not subclassable
27  * </p>
28  * @author Syn Wee Quek
29  * @stable ICU 2.1
30  */
31 
32 public final class UCharacterCategory implements ECharacterCategory
33 {
34     /**
35      * Gets the name of the argument category
36      * @param category to retrieve name
37      * @return category name
38      * @stable ICU 2.1
39      */
toString(int category)40     public static String toString(int category)
41     {
42         switch (category) {
43         case UPPERCASE_LETTER :
44             return "Letter, Uppercase";
45         case LOWERCASE_LETTER :
46             return "Letter, Lowercase";
47         case TITLECASE_LETTER :
48             return "Letter, Titlecase";
49         case MODIFIER_LETTER :
50             return "Letter, Modifier";
51         case OTHER_LETTER :
52             return "Letter, Other";
53         case NON_SPACING_MARK :
54             return "Mark, Non-Spacing";
55         case ENCLOSING_MARK :
56             return "Mark, Enclosing";
57         case COMBINING_SPACING_MARK :
58             return "Mark, Spacing Combining";
59         case DECIMAL_DIGIT_NUMBER :
60             return "Number, Decimal Digit";
61         case LETTER_NUMBER :
62             return "Number, Letter";
63         case OTHER_NUMBER :
64             return "Number, Other";
65         case SPACE_SEPARATOR :
66             return "Separator, Space";
67         case LINE_SEPARATOR :
68             return "Separator, Line";
69         case PARAGRAPH_SEPARATOR :
70             return "Separator, Paragraph";
71         case CONTROL :
72             return "Other, Control";
73         case FORMAT :
74             return "Other, Format";
75         case PRIVATE_USE :
76             return "Other, Private Use";
77         case SURROGATE :
78             return "Other, Surrogate";
79         case DASH_PUNCTUATION :
80             return "Punctuation, Dash";
81         case START_PUNCTUATION :
82             return "Punctuation, Open";
83         case END_PUNCTUATION :
84             return "Punctuation, Close";
85         case CONNECTOR_PUNCTUATION :
86             return "Punctuation, Connector";
87         case OTHER_PUNCTUATION :
88             return "Punctuation, Other";
89         case MATH_SYMBOL :
90             return "Symbol, Math";
91         case CURRENCY_SYMBOL :
92             return "Symbol, Currency";
93         case MODIFIER_SYMBOL :
94             return "Symbol, Modifier";
95         case OTHER_SYMBOL :
96             return "Symbol, Other";
97         case INITIAL_PUNCTUATION :
98             return "Punctuation, Initial quote";
99         case FINAL_PUNCTUATION :
100             return "Punctuation, Final quote";
101         }
102         return "Unassigned";
103     }
104 
105     // private constructor -----------------------------------------------
106     ///CLOVER:OFF
107     /**
108      * Private constructor to prevent initialisation
109      */
UCharacterCategory()110     private UCharacterCategory()
111     {
112     }
113     ///CLOVER:ON
114 }
115