Package opennlp.tools.util.normalizer
Class UnicodeEmojiSequences.Node
java.lang.Object
opennlp.tools.util.normalizer.UnicodeEmojiSequences.Node
- Enclosing class:
UnicodeEmojiSequences
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 Summary
FieldsModifier and TypeFieldDescriptionprivate UnicodeEmojiSequences.Node[]private int[]private static final UnicodeEmojiSequences.Node[]private static final int[]private intprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddSequence(String sequence) Adds one sequence below this node, which is the root of the trie.private UnicodeEmojiSequences.Nodechild(int codePoint) Returns the child for a code point, ornullif none.private UnicodeEmojiSequences.NodechildOrAdd(int codePoint) Returns the child for a code point, added if it did not exist.
-
Field Details
-
NO_KEYS
private static final int[] NO_KEYS -
NO_CHILDREN
-
keys
private int[] keys -
children
-
size
private int size -
terminal
private boolean terminal
-
-
Constructor Details
-
Node
private Node()
-
-
Method Details
-
child
Returns the child for a code point, ornullif none.- Parameters:
codePoint- The code point to look up.- Returns:
- the child for a code point, or
nullif none
-
addSequence
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
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
-