001: /**
002: *******************************************************************************
003: * Copyright (C) 1996-2004, International Business Machines Corporation and *
004: * others. All Rights Reserved. *
005: *******************************************************************************
006: */package com.ibm.icu.lang;
007:
008: import com.ibm.icu.lang.UCharacterEnums.ECharacterCategory;
009:
010: /**
011: * Enumerated Unicode category types from the UnicodeData.txt file.
012: * Used as return results from <a href=UCharacter.html>UCharacter</a>
013: * Equivalent to icu's UCharCategory.
014: * Refer to <a href="http://www.unicode.org/Public/UNIDATA/UCD.html">
015: * Unicode Consortium</a> for more information about UnicodeData.txt.
016: * <p>
017: * <em>NOTE:</em> the UCharacterCategory values are <em>not</em> compatible with
018: * those returned by java.lang.Character.getType. UCharacterCategory values
019: * match the ones used in ICU4C, while java.lang.Character type
020: * values, though similar, skip the value 17.</p>
021: * <p>
022: * This class is not subclassable
023: * </p>
024: * @author Syn Wee Quek
025: * @stable ICU 2.1
026: */
027:
028: public final class UCharacterCategory implements ECharacterCategory {
029: /**
030: * Gets the name of the argument category
031: * @param category to retrieve name
032: * @return category name
033: * @stable ICU 2.1
034: */
035: public static String toString(int category) {
036: switch (category) {
037: case UPPERCASE_LETTER:
038: return "Letter, Uppercase";
039: case LOWERCASE_LETTER:
040: return "Letter, Lowercase";
041: case TITLECASE_LETTER:
042: return "Letter, Titlecase";
043: case MODIFIER_LETTER:
044: return "Letter, Modifier";
045: case OTHER_LETTER:
046: return "Letter, Other";
047: case NON_SPACING_MARK:
048: return "Mark, Non-Spacing";
049: case ENCLOSING_MARK:
050: return "Mark, Enclosing";
051: case COMBINING_SPACING_MARK:
052: return "Mark, Spacing Combining";
053: case DECIMAL_DIGIT_NUMBER:
054: return "Number, Decimal Digit";
055: case LETTER_NUMBER:
056: return "Number, Letter";
057: case OTHER_NUMBER:
058: return "Number, Other";
059: case SPACE_SEPARATOR:
060: return "Separator, Space";
061: case LINE_SEPARATOR:
062: return "Separator, Line";
063: case PARAGRAPH_SEPARATOR:
064: return "Separator, Paragraph";
065: case CONTROL:
066: return "Other, Control";
067: case FORMAT:
068: return "Other, Format";
069: case PRIVATE_USE:
070: return "Other, Private Use";
071: case SURROGATE:
072: return "Other, Surrogate";
073: case DASH_PUNCTUATION:
074: return "Punctuation, Dash";
075: case START_PUNCTUATION:
076: return "Punctuation, Open";
077: case END_PUNCTUATION:
078: return "Punctuation, Close";
079: case CONNECTOR_PUNCTUATION:
080: return "Punctuation, Connector";
081: case OTHER_PUNCTUATION:
082: return "Punctuation, Other";
083: case MATH_SYMBOL:
084: return "Symbol, Math";
085: case CURRENCY_SYMBOL:
086: return "Symbol, Currency";
087: case MODIFIER_SYMBOL:
088: return "Symbol, Modifier";
089: case OTHER_SYMBOL:
090: return "Symbol, Other";
091: case INITIAL_PUNCTUATION:
092: return "Punctuation, Initial quote";
093: case FINAL_PUNCTUATION:
094: return "Punctuation, Final quote";
095: }
096: return "Unassigned";
097: }
098:
099: // private constructor -----------------------------------------------
100: ///CLOVER:OFF
101: /**
102: * Private constructor to prevent initialisation
103: */
104: private UCharacterCategory() {
105: }
106: ///CLOVER:ON
107: }
|