Class ByteTrieNode


  • final class ByteTrieNode
    extends java.lang.Object
    Represents a node in a ByteTrieOfFew
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteTrieNode()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ByteTrieNode get​(byte ch)
      Gets the child not for the given character, if it exists.
      private int indexOf​(byte ch)
      Returns the index of the specified character in this node.
      ByteTrieNode insert​(byte ch)
      Insert a character into this node if it does not already exist.
      ByteTrieNode insert​(byte ch, ByteTrieNode forcedNode)
      Insert a character into this node if it does not already exist.
      boolean isEnd()  
      void setEnd()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • chars

        private byte[] chars
      • isEnd

        private boolean isEnd
    • Constructor Detail

      • ByteTrieNode

        public ByteTrieNode()
    • Method Detail

      • insert

        public ByteTrieNode insert​(byte ch)
        Insert a character into this node if it does not already exist. Returns the child node corresponding to the char.
        Parameters:
        ch - the character
        Returns:
        the child node corresponding to the char
      • insert

        public ByteTrieNode insert​(byte ch,
                                   ByteTrieNode forcedNode)
        Insert a character into this node if it does not already exist. Forces the node 'forceNode' to be inserted.
        Parameters:
        ch - the character
        forcedNode - the forced node
        Returns:
        the forced node
      • get

        public ByteTrieNode get​(byte ch)
        Gets the child not for the given character, if it exists.
        Parameters:
        ch - the character
        Returns:
        the child node corresponding to the char, or the sentinel node
      • indexOf

        private int indexOf​(byte ch)
        Returns the index of the specified character in this node.
        Parameters:
        ch - the character
        Returns:
        the index or -1
      • setEnd

        public void setEnd()
      • isEnd

        public boolean isEnd()