| 125 | size_t DartsDict::KeyMaxLength() const { return maxLength; } |
| 126 | |
| 127 | Optional<const DictEntry*> DartsDict::Match(const char* word, |
| 128 | size_t len) const { |
| 129 | if (len > maxLength) { |
| 130 | return Optional<const DictEntry*>::Null(); |
| 131 | } |
| 132 | if (internal->legacyArray64 != nullptr) { |
| 133 | int val = Legacy64ExactMatch(internal->legacyArray64, word, len); |
| 134 | if (val != -1) { |
| 135 | return Optional<const DictEntry*>(lexicon->At(static_cast<size_t>(val))); |
| 136 | } |
| 137 | return Optional<const DictEntry*>::Null(); |
| 138 | } |
| 139 | Darts::DoubleArray& dict = *internal->doubleArray; |
| 140 | Darts::DoubleArray::result_pair_type result; |
| 141 | dict.exactMatchSearch(word, result, len); |
| 142 | if (result.value != -1) { |
| 143 | return Optional<const DictEntry*>( |
| 144 | lexicon->At(static_cast<size_t>(result.value))); |
| 145 | } |
| 146 | return Optional<const DictEntry*>::Null(); |
| 147 | } |
| 148 | |
| 149 | Optional<const DictEntry*> DartsDict::MatchPrefix(const char* word, |
| 150 | size_t len) const { |
nothing calls this directly
no test coverage detected