Class CharTrieOfFewIgnoreCase

java.lang.Object
ch.randelshofer.fastdoubleparser.chr.CharTrieOfFewIgnoreCase
All Implemented Interfaces:
CharTrie

final class CharTrieOfFewIgnoreCase extends Object implements CharTrie
A trie for testing if a String is contained in a set of Strings.

This trie is a directed acyclic graph.

    Given: the strings: "NaN", "Inf"
    The trie will have the following structure:

    root ['N','n', 'I','i']
           │   │    │   │
           │   │    └─┬─┘
           │   │      └─→ node ['N','n']
           │   │                 │   │
           │   │                 └─┬─┘
           └─┬─┘                   └─→ node ['F','f']
             └─→ node ['A','a']
                        │   │
                        └─┬─┘
                          └─→ node ['N','N']
  • Field Details

  • Constructor Details

    • CharTrieOfFewIgnoreCase

      public CharTrieOfFewIgnoreCase(Set<String> set)
  • Method Details

    • add

      private void add(String str)
    • match

      public int match(char[] str, int startIndex, int endIndex)
      Description copied from interface: CharTrie
      Searches for the longest matching string in the trie that matches the provided string.
      Specified by:
      match in interface CharTrie
      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

      public int match(CharSequence str, int startIndex, int endIndex)
      Description copied from interface: CharTrie
      Searches for the longest matching string in the trie that matches the provided string.
      Specified by:
      match in interface CharTrie
      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