| 289 | // ========================================================= |
| 290 | |
| 291 | private boolean match(Trie t, int idIndex, int myIndex, boolean submatch) { |
| 292 | int mySize = depth + 1; |
| 293 | if (myIndex == mySize && idIndex == t.size()) { |
| 294 | return true; |
| 295 | } else if(idIndex == t.size()) { |
| 296 | return submatch; |
| 297 | } else if (myIndex == mySize) { |
| 298 | return false; |
| 299 | } |
| 300 | |
| 301 | String myComponent = get(myIndex); |
| 302 | if (myComponent.equals("*")) { |
| 303 | return match(t, idIndex + 1, myIndex + 1, submatch); |
| 304 | } else if (myComponent.equals("**")) { |
| 305 | myIndex++; |
| 306 | for (int i = idIndex; i <= t.size(); ++i) { |
| 307 | if (match(t, i, myIndex, submatch)) { |
| 308 | return true; |
| 309 | } |
| 310 | } |
| 311 | return false; |
| 312 | } else { |
| 313 | return myComponent.equals(t.get(idIndex)) |
| 314 | && match(t, idIndex + 1, myIndex + 1, submatch); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | private static final int binarySearch(final Trie[] children, final int nchildren, final String key) { |
| 319 | int low = 0; |