Class UnicodeEmojiSequences.Node

java.lang.Object
opennlp.tools.util.normalizer.UnicodeEmojiSequences.Node
Enclosing class:
UnicodeEmojiSequences

private static final class UnicodeEmojiSequences.Node extends Object
A trie node: the code points that may follow, and whether a sequence ends here. The children are kept as parallel arrays sorted by code point, so a lookup is a binary search over primitives without boxing.
  • Field Details

    • NO_KEYS

      private static final int[] NO_KEYS
    • NO_CHILDREN

      private static final UnicodeEmojiSequences.Node[] NO_CHILDREN
    • keys

      private int[] keys
    • children

      private UnicodeEmojiSequences.Node[] children
    • size

      private int size
    • terminal

      private boolean terminal
  • Constructor Details

    • Node

      private Node()
  • Method Details

    • child

      private UnicodeEmojiSequences.Node child(int codePoint)
      Returns the child for a code point, or null if none.
      Parameters:
      codePoint - The code point to look up.
      Returns:
      the child for a code point, or null if none
    • addSequence

      private void addSequence(String sequence)
      Adds one sequence below this node, which is the root of the trie.
      Parameters:
      sequence - The hex code points of the sequence, separated by whitespace.
      Throws:
      IllegalArgumentException - Thrown if the sequence is empty or a code point is malformed.
    • childOrAdd

      private UnicodeEmojiSequences.Node childOrAdd(int codePoint)
      Returns the child for a code point, added if it did not exist.
      Parameters:
      codePoint - The code point to look up or add.
      Returns:
      the child for a code point, added if it did not exist