Package com.ibm.icu.impl
Class UPropertyAliases
- java.lang.Object
-
- com.ibm.icu.impl.UPropertyAliases
-
public final class UPropertyAliases extends java.lang.Object
Wrapper for the pnames.icu binary data file. This data file is imported from icu4c. It contains property and property value aliases from the UCD files PropertyAliases.txt and PropertyValueAliases.txt. The file is built by the icu4c tool genpname. It must be an ASCII big-endian file to be usable in icu4j. This class performs two functions. (1) It can import the flat binary data into usable objects. (2) It provides an API to access the tree of objects. Needless to say, this class is tightly coupled to the binary format of icu4c's pnames.icu file. Each time a UPropertyAliases is constructed, the pnames.icu file is read, parsed, and data structures assembled. Clients should create one singleton instance and cache it.- Since:
- ICU 2.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
UPropertyAliases.IsAcceptable
-
Field Summary
Fields Modifier and Type Field Description private byte[]
bytesTries
private static int
DATA_FORMAT
static UPropertyAliases
INSTANCE
private static UPropertyAliases.IsAcceptable
IS_ACCEPTABLE
private static int
IX_BYTE_TRIES_OFFSET
private static int
IX_NAME_GROUPS_OFFSET
private static int
IX_RESERVED3_OFFSET
private static int
IX_VALUE_MAPS_OFFSET
private java.lang.String
nameGroups
private int[]
valueMaps
-
Constructor Summary
Constructors Modifier Constructor Description private
UPropertyAliases()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
asciiToLowercase(int c)
static int
compare(java.lang.String stra, java.lang.String strb)
Compare two property names, returning <0, 0, or >0.private boolean
containsName(BytesTrie trie, java.lang.CharSequence name)
private int
findProperty(int property)
private int
findPropertyValueNameGroup(int valueMapIndex, int value)
private java.lang.String
getName(int nameGroupsIndex, int nameIndex)
int
getPropertyEnum(java.lang.CharSequence alias)
Returns a property enum given one of its property names.java.lang.String
getPropertyName(int property, int nameChoice)
Returns a property name given a property enum.private int
getPropertyOrValueEnum(int bytesTrieOffset, java.lang.CharSequence alias)
int
getPropertyValueEnum(int property, java.lang.CharSequence alias)
Returns a value enum given a property enum and one of its value names.int
getPropertyValueEnumNoThrow(int property, java.lang.CharSequence alias)
Returns a value enum given a property enum and one of its value names.java.lang.String
getPropertyValueName(int property, int value, int nameChoice)
Returns a value name given a property enum and a value enum.private void
load(java.nio.ByteBuffer bytes)
-
-
-
Field Detail
-
IX_VALUE_MAPS_OFFSET
private static final int IX_VALUE_MAPS_OFFSET
- See Also:
- Constant Field Values
-
IX_BYTE_TRIES_OFFSET
private static final int IX_BYTE_TRIES_OFFSET
- See Also:
- Constant Field Values
-
IX_NAME_GROUPS_OFFSET
private static final int IX_NAME_GROUPS_OFFSET
- See Also:
- Constant Field Values
-
IX_RESERVED3_OFFSET
private static final int IX_RESERVED3_OFFSET
- See Also:
- Constant Field Values
-
valueMaps
private int[] valueMaps
-
bytesTries
private byte[] bytesTries
-
nameGroups
private java.lang.String nameGroups
-
IS_ACCEPTABLE
private static final UPropertyAliases.IsAcceptable IS_ACCEPTABLE
-
DATA_FORMAT
private static final int DATA_FORMAT
- See Also:
- Constant Field Values
-
INSTANCE
public static final UPropertyAliases INSTANCE
-
-
Method Detail
-
load
private void load(java.nio.ByteBuffer bytes) throws java.io.IOException
- Throws:
java.io.IOException
-
findProperty
private int findProperty(int property)
-
findPropertyValueNameGroup
private int findPropertyValueNameGroup(int valueMapIndex, int value)
-
getName
private java.lang.String getName(int nameGroupsIndex, int nameIndex)
-
asciiToLowercase
private static int asciiToLowercase(int c)
-
containsName
private boolean containsName(BytesTrie trie, java.lang.CharSequence name)
-
getPropertyName
public java.lang.String getPropertyName(int property, int nameChoice)
Returns a property name given a property enum. Multiple names may be available for each property; the nameChoice selects among them.
-
getPropertyValueName
public java.lang.String getPropertyValueName(int property, int value, int nameChoice)
Returns a value name given a property enum and a value enum. Multiple names may be available for each value; the nameChoice selects among them.
-
getPropertyOrValueEnum
private int getPropertyOrValueEnum(int bytesTrieOffset, java.lang.CharSequence alias)
-
getPropertyEnum
public int getPropertyEnum(java.lang.CharSequence alias)
Returns a property enum given one of its property names. If the property name is not known, this method returns UProperty.UNDEFINED.
-
getPropertyValueEnum
public int getPropertyValueEnum(int property, java.lang.CharSequence alias)
Returns a value enum given a property enum and one of its value names.
-
getPropertyValueEnumNoThrow
public int getPropertyValueEnumNoThrow(int property, java.lang.CharSequence alias)
Returns a value enum given a property enum and one of its value names. Does not throw.- Returns:
- value enum, or UProperty.UNDEFINED if not defined for that property
-
compare
public static int compare(java.lang.String stra, java.lang.String strb)
Compare two property names, returning <0, 0, or >0. The comparison is that described as "loose" matching in the Property*Aliases.txt files.
-
-