Java Code Examples for com.ibm.icu.lang.UProperty#CASE_SENSITIVE

The following examples show how to use com.ibm.icu.lang.UProperty#CASE_SENSITIVE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UCaseProps.java    From fitnotifications with Apache License 2.0 4 votes vote down vote up
public final boolean hasBinaryProperty(int c, int which) {
    switch(which) {
    case UProperty.LOWERCASE:
        return LOWER==getType(c);
    case UProperty.UPPERCASE:
        return UPPER==getType(c);
    case UProperty.SOFT_DOTTED:
        return isSoftDotted(c);
    case UProperty.CASE_SENSITIVE:
        return isCaseSensitive(c);
    case UProperty.CASED:
        return NONE!=getType(c);
    case UProperty.CASE_IGNORABLE:
        return (getTypeOrIgnorable(c)>>2)!=0;
    /*
     * Note: The following Changes_When_Xyz are defined as testing whether
     * the NFD form of the input changes when Xyz-case-mapped.
     * However, this simpler implementation of these properties,
     * ignoring NFD, passes the tests.
     * The implementation needs to be changed if the tests start failing.
     * When that happens, optimizations should be used to work with the
     * per-single-code point ucase_toFullXyz() functions unless
     * the NFD form has more than one code point,
     * and the property starts set needs to be the union of the
     * start sets for normalization and case mappings.
     */
    case UProperty.CHANGES_WHEN_LOWERCASED:
        dummyStringBuilder.setLength(0);
        return toFullLower(c, null, dummyStringBuilder, ULocale.ROOT, rootLocCache)>=0;
    case UProperty.CHANGES_WHEN_UPPERCASED:
        dummyStringBuilder.setLength(0);
        return toFullUpper(c, null, dummyStringBuilder, ULocale.ROOT, rootLocCache)>=0;
    case UProperty.CHANGES_WHEN_TITLECASED:
        dummyStringBuilder.setLength(0);
        return toFullTitle(c, null, dummyStringBuilder, ULocale.ROOT, rootLocCache)>=0;
    /* case UProperty.CHANGES_WHEN_CASEFOLDED: -- in UCharacterProperty.java */
    case UProperty.CHANGES_WHEN_CASEMAPPED:
        dummyStringBuilder.setLength(0);
        return
            toFullLower(c, null, dummyStringBuilder, ULocale.ROOT, rootLocCache)>=0 ||
            toFullUpper(c, null, dummyStringBuilder, ULocale.ROOT, rootLocCache)>=0 ||
            toFullTitle(c, null, dummyStringBuilder, ULocale.ROOT, rootLocCache)>=0;
    default:
        return false;
    }
}
 
Example 2
Source File: UCaseProps.java    From trekarta with GNU General Public License v3.0 4 votes vote down vote up
public final boolean hasBinaryProperty(int c, int which) {
    switch(which) {
    case UProperty.LOWERCASE:
        return LOWER==getType(c);
    case UProperty.UPPERCASE:
        return UPPER==getType(c);
    case UProperty.SOFT_DOTTED:
        return isSoftDotted(c);
    case UProperty.CASE_SENSITIVE:
        return isCaseSensitive(c);
    case UProperty.CASED:
        return NONE!=getType(c);
    case UProperty.CASE_IGNORABLE:
        return (getTypeOrIgnorable(c)>>2)!=0;
    /*
     * Note: The following Changes_When_Xyz are defined as testing whether
     * the NFD form of the input changes when Xyz-case-mapped.
     * However, this simpler implementation of these properties,
     * ignoring NFD, passes the tests.
     * The implementation needs to be changed if the tests start failing.
     * When that happens, optimizations should be used to work with the
     * per-single-code point ucase_toFullXyz() functions unless
     * the NFD form has more than one code point,
     * and the property starts set needs to be the union of the
     * start sets for normalization and case mappings.
     */
    case UProperty.CHANGES_WHEN_LOWERCASED:
        dummyStringBuilder.setLength(0);
        return toFullLower(c, null, dummyStringBuilder, LOC_ROOT)>=0;
    case UProperty.CHANGES_WHEN_UPPERCASED:
        dummyStringBuilder.setLength(0);
        return toFullUpper(c, null, dummyStringBuilder, LOC_ROOT)>=0;
    case UProperty.CHANGES_WHEN_TITLECASED:
        dummyStringBuilder.setLength(0);
        return toFullTitle(c, null, dummyStringBuilder, LOC_ROOT)>=0;
    /* case UProperty.CHANGES_WHEN_CASEFOLDED: -- in UCharacterProperty.java */
    case UProperty.CHANGES_WHEN_CASEMAPPED:
        dummyStringBuilder.setLength(0);
        return
            toFullLower(c, null, dummyStringBuilder, LOC_ROOT)>=0 ||
            toFullUpper(c, null, dummyStringBuilder, LOC_ROOT)>=0 ||
            toFullTitle(c, null, dummyStringBuilder, LOC_ROOT)>=0;
    default:
        return false;
    }
}