@Override public int minLength() { return next.minLength(); }
/** Create a new instance. */ private SeqMatcher(Matcher... matchers) { this.matchers = matchers; int min = 0; for (Matcher matcher : matchers) { min += matcher.minLength(); } this.minLength = min; }
@Override public int minLength() { return min * repeated.minLength(); }
/** Create a new instance. */ private SeqMatcher(Matcher... matchers) { this.matchers = matchers; int min = 0; for (Matcher matcher : matchers) { min += matcher.minLength(); } this.minLength = min; }
@Override public int minLength() { return min * repeated.minLength(); }
@Override public int minLength() { return next.minLength(); }
@Override public int minLength() { return pattern.length() + next.minLength(); }
@Override public int minLength() { return pattern.length() + next.minLength(); }
final int end = start + length; if (repeated instanceof AnyMatcher) { final int stop = end - next.minLength(); for (int pos = start; pos >= 0 && pos <= stop; ++pos) { int p = next.matches(str, pos, end - pos); final int stop = end - next.minLength(); int pos = start; while (pos >= 0 && pos <= stop) {
final int end = start + length; if (repeated instanceof AnyMatcher) { final int stop = end - next.minLength(); for (int pos = start; pos >= 0 && pos <= stop; ++pos) { int p = next.matches(str, pos, end - pos); final int stop = end - next.minLength(); int pos = start; while (pos >= 0 && pos <= stop) {
@Override public int matches(String str, int start, int length) { if (next == TrueMatcher.INSTANCE) { int pos = indexOf(str, start); return pos >= 0 ? pos + pattern.length() : Constants.NO_MATCH; } else if (next == EndMatcher.INSTANCE) { return endsWith(str, start) ? length : Constants.NO_MATCH; } else { final int end = start + length; final int stop = end - next.minLength(); int pos = start; while (pos >= 0 && pos <= stop) { pos = indexOf(str, pos); if (pos >= 0) { int s = pos + pattern.length(); int p = next.matches(str, s, end - s); if (p >= 0) { return p; } ++pos; } } return Constants.NO_MATCH; } }
@Override public int matches(String str, int start, int length) { if (next == TrueMatcher.INSTANCE) { int pos = indexOf(str, start); return pos >= 0 ? pos + pattern.length() : Constants.NO_MATCH; } else if (next == EndMatcher.INSTANCE) { return endsWith(str, start) ? length : Constants.NO_MATCH; } else { final int end = start + length; final int stop = end - next.minLength(); int pos = start; while (pos >= 0 && pos <= stop) { pos = indexOf(str, pos); if (pos >= 0) { int s = pos + pattern.length(); int p = next.matches(str, s, end - s); if (p >= 0) { return p; } ++pos; } } return Constants.NO_MATCH; } }