Class ByteTrieOfFewIgnoreCase
- java.lang.Object
-
- ch.randelshofer.fastdoubleparser.bte.ByteTrieOfFewIgnoreCase
-
- All Implemented Interfaces:
ByteTrie
final class ByteTrieOfFewIgnoreCase extends java.lang.Object implements ByteTrie
A trie for testing if a String is contained in a set of Strings.This trie is a directed acyclic graph. The trie contains UTF-8 encoded characters.
Given: the strings: "NaN" in latin alphabet, "інф" in cyrillic alphabet. The latin alphabet is encoded with one byte per character. The cyrillic alphabet is encoded with 2 bytes per character. "NAN" upper case bytes: { 0x4e, 0x41, 0x4e } "nan" lower case bytes: { 0x6e, 0x61, 0x6e } "ІНФ" upper case bytes: { 0xd0, 0x86, 0xd0, 0x9d, 0xd0, 0xa4 } "інф" lower case bytes: { 0xd1, 0x96, 0xd0, 0xbd, 0xd1, 0x84 } The trie will have the following structure: root [0xd0, 0xd1, 'N'0x4e,'n'0x6e] ┌───────┘ │ └─────┬─┘ ↓ │ ↓ node ['І'0x86] ↓ node ['A'0x41,'a'0x61] │ node ['і'0x96] └───┬───┘ └─┬─────────────┘ ↓ ↓ node ['N'0x4e,'n'0x6e] node [0xd0] ┌────────────┴─┐ ↓ ↓ node ['Н'0x9d] node ['н'0xbd] └─┬─────────────┘ ↓ node [0xd0, 0xd1] ┌──────────────┘ ┌───┘ ↓ ↓ node ['Ф'0xa4] node ['ф'0x84]
-
-
Field Summary
Fields Modifier and Type Field Description private ByteTrieNoderoot
-
Constructor Summary
Constructors Constructor Description ByteTrieOfFewIgnoreCase(java.util.Set<java.lang.String> set)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidadd(java.lang.String str)intmatch(byte[] str, int startIndex, int endIndex)Searches for the longest matching string in the trie that matches the provided string.
-
-
-
Field Detail
-
root
private ByteTrieNode root
-
-
Method Detail
-
add
private void add(java.lang.String str)
-
match
public int match(byte[] str, int startIndex, int endIndex)Description copied from interface:ByteTrieSearches for the longest matching string in the trie that matches the provided string.
-
-