MCPcopy Create free account
hub / github.com/crossoverJie/JCSprout / search

Method search

src/main/java/com/crossoverjie/actual/Search.java:141–180  ·  view source on GitHub ↗
(String keyWord)

Source from the content-addressed store, hash-verified

139 }
140
141 public static boolean search(String keyWord){
142 boolean result = false ;
143 if (null == keyWord || keyWord.trim().equals("")){
144 return result ;
145 }
146
147 //做一次完整匹配
148 String whole = ALL_MAP.get(keyWord) ;
149 if (whole != null){
150 return true ;
151 }
152
153 char[] wordChars = keyWord.toCharArray() ;
154
155 for (int i = 0; i < wordChars.length; i++) {
156 char wordChar = wordChars[i] ;
157
158 if (46 != (int)wordChar){
159 continue ;
160 }
161
162 for (char dic : dictionary) {
163 wordChars[i] = dic ;
164 boolean search = search(String.valueOf(wordChars));
165
166 if (search){
167 return search ;
168 }
169
170 String value = ALL_MAP.get(String.valueOf(wordChars));
171 if (value != null){
172 return true ;
173 }
174 }
175
176 }
177
178
179 return result ;
180 }
181
182
183 public static void addWord(String word){

Callers 1

mainMethod · 0.95

Calls 1

getMethod · 0.65

Tested by

no test coverage detected