Package com.ibm.icu.impl
Class UCaseProps
- java.lang.Object
-
- com.ibm.icu.impl.UCaseProps
-
public final class UCaseProps extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
UCaseProps.ContextIterator
Iterator for string case mappings, which need to look at the context (surrounding text) of a given character for conditional mappings.private static class
UCaseProps.IsAcceptable
(package private) static class
UCaseProps.LatinCase
Fast case mapping data for ASCII/Latin.
-
Field Summary
Fields Modifier and Type Field Description private static int
ABOVE
private static int
CLOSURE_MAX_LENGTH
private static java.lang.String
DATA_FILE_NAME
private static java.lang.String
DATA_NAME
private static java.lang.String
DATA_TYPE
private static int
DELTA_SHIFT
private static int
DOT_MASK
static java.lang.StringBuilder
dummyStringBuilder
private static int
EXC_CLOSURE
private static int
EXC_CONDITIONAL_FOLD
private static int
EXC_CONDITIONAL_SPECIAL
private static int
EXC_DELTA
private static int
EXC_DELTA_IS_NEGATIVE
private static int
EXC_DOT_SHIFT
private static int
EXC_DOUBLE_SLOTS
private static int
EXC_FOLD
private static int
EXC_FULL_MAPPINGS
private static int
EXC_LOWER
private static int
EXC_NO_SIMPLE_CASE_FOLDING
private static int
EXC_SENSITIVE
private static int
EXC_SHIFT
private static int
EXC_TITLE
private static int
EXC_UPPER
private static int
EXCEPTION
private java.lang.String
exceptions
private static byte[]
flagsOffset
private static int
FMT
(package private) static int
FOLD_CASE_OPTIONS_MASK
Bit mask for getting just the options from a string compare options word that are relevant for case folding (of a single string or code point).private static int
FULL_LOWER
private static java.lang.String
iDot
private static java.lang.String
iDotAcute
private static java.lang.String
iDotGrave
private static java.lang.String
iDotTilde
(package private) static int
IGNORABLE
private int[]
indexes
static UCaseProps
INSTANCE
private static java.lang.String
iOgonekDot
private static int
IX_EXC_LENGTH
private static int
IX_TOP
private static int
IX_TRIE_SIZE
private static int
IX_UNFOLD_LENGTH
private static java.lang.String
jDot
(package private) static int
LOC_ARMENIAN
static int
LOC_DUTCH
(package private) static int
LOC_GREEK
(package private) static int
LOC_LITHUANIAN
static int
LOC_ROOT
(package private) static int
LOC_TURKISH
static int
LOWER
static int
MAX_STRING_LENGTH
For string case mappings, a single character (a code point) is mapped either to itself (in which case in-place mapping functions do nothing), or to another single code point, or to a string.static int
NONE
private static int
OTHER_ACCENT
private static int
SENSITIVE
private static int
SOFT_DOTTED
static int
TITLE
private Trie2_16
trie
static int
TYPE_MASK
private char[]
unfold
private static int
UNFOLD_ROW_WIDTH
private static int
UNFOLD_ROWS
private static int
UNFOLD_STRING_WIDTH
static int
UPPER
-
Constructor Summary
Constructors Modifier Constructor Description private
UCaseProps()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCaseClosure(int c, UnicodeSet set)
Adds all simple case mappings and the full case folding for c to sa, and also adds special case closure mappings.void
addPropertyStarts(UnicodeSet set)
void
addSimpleCaseClosure(int c, UnicodeSet set)
boolean
addStringCaseClosure(java.lang.String s, UnicodeSet set)
Maps the string to single code points and adds the associated case closure mappings.int
fold(int c, int options)
static int
getCaseLocale(ULocale locale)
private static int
getCaseLocale(java.lang.String language)
Accepts both 2- and 3-letter language subtags.static int
getCaseLocale(java.util.Locale locale)
(package private) static int
getDelta(int props)
int
getDotType(int c)
private static int
getExceptionsOffset(int props)
private int
getSlotValue(int excWord, int index, int excOffset)
private long
getSlotValueAndOffset(int excWord, int index, int excOffset)
(package private) static Trie2_16
getTrie()
int
getType(int c)
private static int
getTypeAndIgnorableFromProps(int props)
(package private) static int
getTypeFromProps(int props)
int
getTypeOrIgnorable(int c)
boolean
hasBinaryProperty(int c, int which)
private static boolean
hasSlot(int flags, int index)
boolean
isCaseSensitive(int c)
private boolean
isFollowedByCasedLetter(UCaseProps.ContextIterator iter, int dir)
private boolean
isFollowedByDotAbove(UCaseProps.ContextIterator iter)
private boolean
isFollowedByMoreAbove(UCaseProps.ContextIterator iter)
private boolean
isPrecededBy_I(UCaseProps.ContextIterator iter)
private boolean
isPrecededBySoftDotted(UCaseProps.ContextIterator iter)
boolean
isSoftDotted(int c)
(package private) static boolean
isUpperOrTitleFromProps(int props)
(package private) static boolean
propsHasException(int props)
private void
readData(java.nio.ByteBuffer bytes)
private static byte
slotOffset(int flags, int index)
private int
strcmpMax(java.lang.String s, int unfoldOffset, int max)
int
toFullFolding(int c, java.lang.Appendable out, int options)
int
toFullLower(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int caseLocale)
Get the full lowercase mapping for c.int
toFullTitle(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int caseLocale)
int
toFullUpper(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int caseLocale)
int
tolower(int c)
int
totitle(int c)
int
toupper(int c)
private int
toUpperOrTitle(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int loc, boolean upperNotTitle)
-
-
-
Field Detail
-
flagsOffset
private static final byte[] flagsOffset
-
MAX_STRING_LENGTH
public static final int MAX_STRING_LENGTH
For string case mappings, a single character (a code point) is mapped either to itself (in which case in-place mapping functions do nothing), or to another single code point, or to a string. Aside from the string contents, these are indicated with a single int value as follows: Mapping to self: Negative values (~self instead of -self to support U+0000) Mapping to another code point: Positive values >MAX_STRING_LENGTH Mapping to a string: The string length (0..MAX_STRING_LENGTH) is returned. Note that the string result may indeed have zero length.- See Also:
- Constant Field Values
-
LOC_ROOT
public static final int LOC_ROOT
- See Also:
- Constant Field Values
-
LOC_TURKISH
static final int LOC_TURKISH
- See Also:
- Constant Field Values
-
LOC_LITHUANIAN
static final int LOC_LITHUANIAN
- See Also:
- Constant Field Values
-
LOC_GREEK
static final int LOC_GREEK
- See Also:
- Constant Field Values
-
LOC_DUTCH
public static final int LOC_DUTCH
- See Also:
- Constant Field Values
-
LOC_ARMENIAN
static final int LOC_ARMENIAN
- See Also:
- Constant Field Values
-
iDot
private static final java.lang.String iDot
- See Also:
- Constant Field Values
-
jDot
private static final java.lang.String jDot
- See Also:
- Constant Field Values
-
iOgonekDot
private static final java.lang.String iOgonekDot
- See Also:
- Constant Field Values
-
iDotGrave
private static final java.lang.String iDotGrave
- See Also:
- Constant Field Values
-
iDotAcute
private static final java.lang.String iDotAcute
- See Also:
- Constant Field Values
-
iDotTilde
private static final java.lang.String iDotTilde
- See Also:
- Constant Field Values
-
FOLD_CASE_OPTIONS_MASK
static final int FOLD_CASE_OPTIONS_MASK
Bit mask for getting just the options from a string compare options word that are relevant for case folding (of a single string or code point). Currently only bit 0 for FOLD_CASE_EXCLUDE_SPECIAL_I. It is conceivable that at some point we might use one more bit for using uppercase sharp s. It is conceivable that at some point we might want the option to use only simple case foldings when operating on strings.- See Also:
- Constant Field Values
-
dummyStringBuilder
public static final java.lang.StringBuilder dummyStringBuilder
-
indexes
private int[] indexes
-
exceptions
private java.lang.String exceptions
-
unfold
private char[] unfold
-
trie
private Trie2_16 trie
-
DATA_NAME
private static final java.lang.String DATA_NAME
- See Also:
- Constant Field Values
-
DATA_TYPE
private static final java.lang.String DATA_TYPE
- See Also:
- Constant Field Values
-
DATA_FILE_NAME
private static final java.lang.String DATA_FILE_NAME
- See Also:
- Constant Field Values
-
FMT
private static final int FMT
- See Also:
- Constant Field Values
-
IX_TRIE_SIZE
private static final int IX_TRIE_SIZE
- See Also:
- Constant Field Values
-
IX_EXC_LENGTH
private static final int IX_EXC_LENGTH
- See Also:
- Constant Field Values
-
IX_UNFOLD_LENGTH
private static final int IX_UNFOLD_LENGTH
- See Also:
- Constant Field Values
-
IX_TOP
private static final int IX_TOP
- See Also:
- Constant Field Values
-
TYPE_MASK
public static final int TYPE_MASK
- See Also:
- Constant Field Values
-
NONE
public static final int NONE
- See Also:
- Constant Field Values
-
LOWER
public static final int LOWER
- See Also:
- Constant Field Values
-
UPPER
public static final int UPPER
- See Also:
- Constant Field Values
-
TITLE
public static final int TITLE
- See Also:
- Constant Field Values
-
IGNORABLE
static final int IGNORABLE
- See Also:
- Constant Field Values
-
EXCEPTION
private static final int EXCEPTION
- See Also:
- Constant Field Values
-
SENSITIVE
private static final int SENSITIVE
- See Also:
- Constant Field Values
-
DOT_MASK
private static final int DOT_MASK
- See Also:
- Constant Field Values
-
SOFT_DOTTED
private static final int SOFT_DOTTED
- See Also:
- Constant Field Values
-
ABOVE
private static final int ABOVE
- See Also:
- Constant Field Values
-
OTHER_ACCENT
private static final int OTHER_ACCENT
- See Also:
- Constant Field Values
-
DELTA_SHIFT
private static final int DELTA_SHIFT
- See Also:
- Constant Field Values
-
EXC_SHIFT
private static final int EXC_SHIFT
- See Also:
- Constant Field Values
-
EXC_LOWER
private static final int EXC_LOWER
- See Also:
- Constant Field Values
-
EXC_FOLD
private static final int EXC_FOLD
- See Also:
- Constant Field Values
-
EXC_UPPER
private static final int EXC_UPPER
- See Also:
- Constant Field Values
-
EXC_TITLE
private static final int EXC_TITLE
- See Also:
- Constant Field Values
-
EXC_DELTA
private static final int EXC_DELTA
- See Also:
- Constant Field Values
-
EXC_CLOSURE
private static final int EXC_CLOSURE
- See Also:
- Constant Field Values
-
EXC_FULL_MAPPINGS
private static final int EXC_FULL_MAPPINGS
- See Also:
- Constant Field Values
-
EXC_DOUBLE_SLOTS
private static final int EXC_DOUBLE_SLOTS
- See Also:
- Constant Field Values
-
EXC_NO_SIMPLE_CASE_FOLDING
private static final int EXC_NO_SIMPLE_CASE_FOLDING
- See Also:
- Constant Field Values
-
EXC_DELTA_IS_NEGATIVE
private static final int EXC_DELTA_IS_NEGATIVE
- See Also:
- Constant Field Values
-
EXC_SENSITIVE
private static final int EXC_SENSITIVE
- See Also:
- Constant Field Values
-
EXC_DOT_SHIFT
private static final int EXC_DOT_SHIFT
- See Also:
- Constant Field Values
-
EXC_CONDITIONAL_SPECIAL
private static final int EXC_CONDITIONAL_SPECIAL
- See Also:
- Constant Field Values
-
EXC_CONDITIONAL_FOLD
private static final int EXC_CONDITIONAL_FOLD
- See Also:
- Constant Field Values
-
FULL_LOWER
private static final int FULL_LOWER
- See Also:
- Constant Field Values
-
CLOSURE_MAX_LENGTH
private static final int CLOSURE_MAX_LENGTH
- See Also:
- Constant Field Values
-
UNFOLD_ROWS
private static final int UNFOLD_ROWS
- See Also:
- Constant Field Values
-
UNFOLD_ROW_WIDTH
private static final int UNFOLD_ROW_WIDTH
- See Also:
- Constant Field Values
-
UNFOLD_STRING_WIDTH
private static final int UNFOLD_STRING_WIDTH
- See Also:
- Constant Field Values
-
INSTANCE
public static final UCaseProps INSTANCE
-
-
Method Detail
-
readData
private final void readData(java.nio.ByteBuffer bytes) throws java.io.IOException
- Throws:
java.io.IOException
-
addPropertyStarts
public final void addPropertyStarts(UnicodeSet set)
-
getExceptionsOffset
private static final int getExceptionsOffset(int props)
-
propsHasException
static final boolean propsHasException(int props)
-
hasSlot
private static final boolean hasSlot(int flags, int index)
-
slotOffset
private static final byte slotOffset(int flags, int index)
-
getSlotValueAndOffset
private final long getSlotValueAndOffset(int excWord, int index, int excOffset)
-
getSlotValue
private final int getSlotValue(int excWord, int index, int excOffset)
-
tolower
public final int tolower(int c)
-
toupper
public final int toupper(int c)
-
totitle
public final int totitle(int c)
-
addCaseClosure
public final void addCaseClosure(int c, UnicodeSet set)
Adds all simple case mappings and the full case folding for c to sa, and also adds special case closure mappings. c itself is not added. For example, the mappings - for s include long s - for sharp s include ss - for k include the Kelvin sign
-
addSimpleCaseClosure
public final void addSimpleCaseClosure(int c, UnicodeSet set)
-
strcmpMax
private final int strcmpMax(java.lang.String s, int unfoldOffset, int max)
-
addStringCaseClosure
public final boolean addStringCaseClosure(java.lang.String s, UnicodeSet set)
Maps the string to single code points and adds the associated case closure mappings. The string is mapped to code points if it is their full case folding string. In other words, this performs a reverse full case folding and then adds the case closure items of the resulting code points. If the string is found and its closure applied, then the string itself is added as well as part of its code points' closure.- Returns:
- true if the string was found
-
getType
public final int getType(int c)
- Returns:
- NONE, LOWER, UPPER, TITLE
-
getTypeOrIgnorable
public final int getTypeOrIgnorable(int c)
- Returns:
- like getType() but also sets IGNORABLE if c is case-ignorable
-
getDotType
public final int getDotType(int c)
- Returns:
- NO_DOT, SOFT_DOTTED, ABOVE, OTHER_ACCENT
-
isSoftDotted
public final boolean isSoftDotted(int c)
-
isCaseSensitive
public final boolean isCaseSensitive(int c)
-
getCaseLocale
public static final int getCaseLocale(java.util.Locale locale)
-
getCaseLocale
public static final int getCaseLocale(ULocale locale)
-
getCaseLocale
private static final int getCaseLocale(java.lang.String language)
Accepts both 2- and 3-letter language subtags.
-
isFollowedByCasedLetter
private final boolean isFollowedByCasedLetter(UCaseProps.ContextIterator iter, int dir)
-
isPrecededBySoftDotted
private final boolean isPrecededBySoftDotted(UCaseProps.ContextIterator iter)
-
isPrecededBy_I
private final boolean isPrecededBy_I(UCaseProps.ContextIterator iter)
-
isFollowedByMoreAbove
private final boolean isFollowedByMoreAbove(UCaseProps.ContextIterator iter)
-
isFollowedByDotAbove
private final boolean isFollowedByDotAbove(UCaseProps.ContextIterator iter)
-
toFullLower
public final int toFullLower(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int caseLocale)
Get the full lowercase mapping for c.- Parameters:
c
- Character to be mapped.iter
- Character iterator, used for context-sensitive mappings. See ContextIterator for details. If iter==null then a context-independent result is returned.out
- If the mapping result is a string, then it is appended to out.caseLocale
- Case locale value from ucase_getCaseLocale().- Returns:
- Output code point or string length, see MAX_STRING_LENGTH.
- See Also:
UCaseProps.ContextIterator
,MAX_STRING_LENGTH
-
toUpperOrTitle
private final int toUpperOrTitle(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int loc, boolean upperNotTitle)
-
toFullUpper
public final int toFullUpper(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int caseLocale)
-
toFullTitle
public final int toFullTitle(int c, UCaseProps.ContextIterator iter, java.lang.Appendable out, int caseLocale)
-
fold
public final int fold(int c, int options)
-
toFullFolding
public final int toFullFolding(int c, java.lang.Appendable out, int options)
-
hasBinaryProperty
public final boolean hasBinaryProperty(int c, int which)
-
getTrie
static Trie2_16 getTrie()
-
getTypeFromProps
static final int getTypeFromProps(int props)
- Returns:
- NONE, LOWER, UPPER, TITLE
-
getTypeAndIgnorableFromProps
private static final int getTypeAndIgnorableFromProps(int props)
- Returns:
- like getTypeFromProps() but also sets IGNORABLE if props indicate case-ignorable
-
isUpperOrTitleFromProps
static final boolean isUpperOrTitleFromProps(int props)
-
getDelta
static final int getDelta(int props)
-
-