Class Trie

  • Direct Known Subclasses:
    CharTrie

    public abstract class Trie
    extends java.lang.Object

    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:
    CharTrie, IntTrie
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Trie.DataManipulate
      Character data in com.ibm.impl.Trie have different user-specified format for different purposes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)
      Checks if the argument Trie has the same data as this Trie.
      int getSerializedDataSize()
      Gets the serialized data file size of the Trie.
      boolean isLatin1Linear()
      Determines if this trie has a linear latin 1 array
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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

        public boolean equals​(java.lang.Object other)
        Checks if the argument Trie has the same data as this Trie. Attributes are checked but not the index data.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - Trie to check
        Returns:
        true if the argument Trie has the same data as this Trie, false otherwise
      • 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