@Test public void everythingPattern() { WildcardMatchPattern matchPattern = new WildcardMatchPattern("*"); assertThat(matchPattern.match("test1hello2world"), is(true)); assertThat(matchPattern.match("testhelloworld"), is(true)); assertThat(matchPattern.match("test123helloworld"), is(true)); assertThat(matchPattern.match("hello"), is(true)); assertThat(matchPattern.match(""), is(true)); }
@Override public final boolean match(String match) { if (everything) { return true; } int start = 0; int end = match.length(); int index = 0; if (isLeadText) { if (match.startsWith(components[0])) { start = components[0].length(); index = 1; } else { return false; } } int limit = components.length; if (isTrailText) { limit--; if (match.endsWith(components[limit])) { end -= components[limit].length(); } else { return false; } } while (index < limit) { String comp = components[index++]; start = match.indexOf(comp, start); if (start >= 0) { start += comp.length(); if (start > end) { return false; } } else { return false; } } return true; }
WildcardMatchPattern implements IMatchPattern { @Override public final boolean match(String match) { if (everything) { return true; } int start = 0; int end = match.length(); int index = 0; if (isLeadText) { if (match.startsWith(components[0])) { start = components[0].length(); index = 1; } else { return false; } } int limit = components.length; if (isTrailText) { limit--; if (match.endsWith(components[limit])) { end -= components[limit].length(); } else { return false; } } while (index < limit) { String comp = components[index++]; start = match.indexOf(comp, start); if (start >= 0) { start += comp.length(); if (start > end) { return false; } } else { return false; } } return true; } }
WildcardMatchPattern implements IMatchPattern { @Override public final boolean match(String match) { if (everything) { return true; } int start = 0; int end = match.length(); int index = 0; if (isLeadText) { if (match.startsWith(components[0])) { start = components[0].length(); index = 1; } else { return false; } } int limit = components.length; if (isTrailText) { limit--; if (match.endsWith(components[limit])) { end -= components[limit].length(); } else { return false; } } while (index < limit) { String comp = components[index++]; start = match.indexOf(comp, start); if (start >= 0) { start += comp.length(); if (start > end) { return false; } } else { return false; } } return true; } WildcardMatchPattern();  WildcardMatchPattern(final String template); }
WildcardMatchPattern implements IMatchPattern { @Override public final boolean match(String match) { if (everything) { return true; } int start = 0; int end = match.length(); int index = 0; if (isLeadText) { if (match.startsWith(components[0])) { start = components[0].length(); index = 1; } else { return false; } } int limit = components.length; if (isTrailText) { limit--; if (match.endsWith(components[limit])) { end -= components[limit].length(); } else { return false; } } while (index < limit) { String comp = components[index++]; start = match.indexOf(comp, start); if (start >= 0) { start += comp.length(); if (start > end) { return false; } } else { return false; } } return true; } WildcardMatchPattern();  WildcardMatchPattern(final String template); @Override final boolean match(String match); @Override String getPattern(); static boolean isPattern(String txt); @Override int hashCode(); @Override boolean equals(Object obj); }
WildcardMatchPattern implements IMatchPattern { @Override public final boolean match(String match) { if (everything) { return true; } int start = 0; int end = match.length(); int index = 0; if (isLeadText) { if (match.startsWith(components[0])) { start = components[0].length(); index = 1; } else { return false; } } int limit = components.length; if (isTrailText) { limit--; if (match.endsWith(components[limit])) { end -= components[limit].length(); } else { return false; } } while (index < limit) { String comp = components[index++]; start = match.indexOf(comp, start); if (start >= 0) { start += comp.length(); if (start > end) { return false; } } else { return false; } } return true; } WildcardMatchPattern();  WildcardMatchPattern(final String template); @Override final boolean match(String match); @Override String getPattern(); static boolean isPattern(String txt); @Override int hashCode(); @Override boolean equals(Object obj);  }