Class Trie
- Direct Known Subclasses:
CharTrie
A trie is a kind of compressed, serializable table of values associated with Unicode code points (0..0x10ffff).
This class defines the basic structure of a trie and provides methods to retrieve the offsets to the actual data.
Data will be the form of an array of basic types, char or int.
The actual data format will have to be specified by the user in the inner static interface com.adobe.agl.impl.Trie.DataManipulate.
This trie implementation is optimized for getting offset while walking forward through a UTF-16 string. Therefore, the simplest and fastest access macros are the fromLead() and fromOffsetTrail() methods. The fromBMP() method are a little more complicated; they get offsets even for lead surrogate codepoints, while the fromLead() method get special "folded" offsets for lead surrogate code units if there is relevant data associated with them. From such a folded offsets, an offset needs to be extracted to supply to the fromOffsetTrail() methods. To handle such supplementary codepoints, some offset information are kept in the data.
Methods in com.adobe.agl.impl.Trie.DataManipulate are called to retrieve that offset from the folded value for the lead surrogate unit.
For examples of use, see com.adobe.agl.impl.CharTrie or com.adobe.agl.impl.IntTrie.
- Since:
- release 2.1, Jan 01 2002
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCharacter data in com.ibm.impl.Trie have different user-specified format for different purposes. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the argument Trie has the same data as this Trie.intGets the serialized data file size of the Trie.final booleanDetermines if this trie has a linear latin 1 array
-
Method Details
-
isLatin1Linear
public final boolean isLatin1Linear()Determines if this trie has a linear latin 1 array- Returns:
- true if this trie has a linear latin 1 array, false otherwise
-
equals
Checks if the argument Trie has the same data as this Trie. Attributes are checked but not the index data. -
getSerializedDataSize
public int getSerializedDataSize()Gets the serialized data file size of the Trie. This is used during trie data reading for size checking purposes.- Returns:
- size size of serialized trie data file in terms of the number of bytes
-