Interface CharTrie


public interface CharTrie
Interface for a data retrieval tree (trie) of characters.
  • Method Summary

    Modifier and Type
    Method
    Description
    static CharTrie
    copyOf(Set<String> set, boolean ignoreCase)
    Creates a new CharTrie from the provided set.
    default int
    match(char[] str)
    Searches for the longest matching string in the trie that matches the provided string.
    int
    match(char[] str, int startIndex, int endIndex)
    Searches for the longest matching string in the trie that matches the provided string.
    default int
    Searches for the longest matching string in the trie that matches the provided string.
    int
    match(CharSequence str, int startIndex, int endIndex)
    Searches for the longest matching string in the trie that matches the provided string.
  • Method Details

    • match

      default int match(CharSequence str)
      Searches for the longest matching string in the trie that matches the provided string.
      Parameters:
      str - a string in the form of a CharSequence
      Returns:
      the length of the longest matching string, or 0 if no string matches
    • match

      default int match(char[] str)
      Searches for the longest matching string in the trie that matches the provided string.
      Parameters:
      str - a string in the form of a char array
      Returns:
      the length of the longest matching string, or 0 if no string matches
    • match

      int match(CharSequence str, int startIndex, int endIndex)
      Searches for the longest matching string in the trie that matches the provided string.
      Parameters:
      str - a string
      startIndex - start index (inclusive)
      endIndex - end index (exclusive)
      Returns:
      the length of the longest matching string, or 0 if no string matches
    • match

      int match(char[] str, int startIndex, int endIndex)
      Searches for the longest matching string in the trie that matches the provided string.
      Parameters:
      str - a string
      startIndex - start index (inclusive)
      endIndex - end index (exclusive)
      Returns:
      the length of the longest matching string, or 0 if no string matches
    • copyOf

      static CharTrie copyOf(Set<String> set, boolean ignoreCase)
      Creates a new CharTrie from the provided set.
      Parameters:
      set - a set of strings
      ignoreCase - whether the CharTrie shall ignore the case of the characters
      Returns:
      a new CharTrie instance