private boolean matches(int matcherIdx, String path, int startIncl, int endExcl, boolean assumeDirectory, boolean pathMatch) { IMatcher matcher = matchers.get(matcherIdx); final boolean matches = matcher.matches(path, startIncl, endExcl); if (!matches || !pathMatch || matcherIdx < matchers.size() - 1 || !(matcher instanceof AbstractMatcher)) { return matches; } return assumeDirectory || !((AbstractMatcher) matcher).dirOnly; }
/** * Returns <code>true</code> if a match was made. * * @param relativeTarget * Name pattern of the file, relative to the base directory of * this rule * @param isDirectory * Whether the target file is a directory or not * @return True if a match was made. */ public boolean isMatch(String relativeTarget, boolean isDirectory) { if (relativeTarget == null) return false; if (relativeTarget.length() == 0) return false; boolean match = matcher.matches(relativeTarget, isDirectory, true); return match; }
/** * Returns true if a match was made. <br> * This function does NOT return the actual ignore status of the target! * Please consult {@link #getResult()} for the negation status. The actual * ignore status may be true or false depending on whether this rule is an * ignore rule or a negation rule. * * @param path * Name pattern of the file, relative to the base directory of * this rule * @param directory * Whether the target file is a directory or not * @param pathMatch * {@code true} if the match is for the full path: see * {@link IMatcher#matches(String, int, int)} * @return True if a match was made. This does not necessarily mean that the * target is ignored. Call {@link #getResult() getResult()} for the * result. * @since 4.11 */ public boolean isMatch(String path, boolean directory, boolean pathMatch) { if (path == null) return false; if (path.length() == 0) return false; boolean match = matcher.matches(path, directory, pathMatch); return match; }
private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { Collections.sort(tags, TAG_TIE_BREAKER); return Optional.of(tags.get(0)); } else { // Find the first tag that matches in the stream of all tags // filtered by matchers ordered by tie break order Stream<Ref> matchingTags = Stream.empty(); for (IMatcher matcher : matchers) { Stream<Ref> m = tags.stream().filter( tag -> matcher.matches(tag.getName(), false, false)); matchingTags = Stream.of(matchingTags, m).flatMap(i -> i); } return matchingTags.sorted(TAG_TIE_BREAKER).findFirst(); } }
boolean matches(int matcherIdx, String path, int startIncl, int endExcl, boolean assumeDirectory) { IMatcher matcher = matchers.get(matcherIdx); return matcher.matches(path, startIncl, endExcl, assumeDirectory); } }
@Override public boolean isMatch(@NotNull String name, boolean isDir) { return matcher.matches(name, isDir, true); }
@Override public boolean isMatch(@NotNull String name, boolean isDir) { return matcher.matches(name, isDir); }
private boolean matches(int matcherIdx, String path, int startIncl, int endExcl, boolean assumeDirectory, boolean pathMatch) { IMatcher matcher = matchers.get(matcherIdx); final boolean matches = matcher.matches(path, startIncl, endExcl); if (!matches || !pathMatch || matcherIdx < matchers.size() - 1 || !(matcher instanceof AbstractMatcher)) { return matches; } return assumeDirectory || !((AbstractMatcher) matcher).dirOnly; }
private boolean matches(int matcherIdx, String path, int startIncl, int endExcl, boolean assumeDirectory, boolean pathMatch) { IMatcher matcher = matchers.get(matcherIdx); final boolean matches = matcher.matches(path, startIncl, endExcl); if (!matches || !pathMatch || matcherIdx < matchers.size() - 1 || !(matcher instanceof AbstractMatcher)) { return matches; } return assumeDirectory || !((AbstractMatcher) matcher).dirOnly; }
/** * Returns <code>true</code> if a match was made. * * @param relativeTarget * Name pattern of the file, relative to the base directory of * this rule * @param isDirectory * Whether the target file is a directory or not * @return True if a match was made. */ public boolean isMatch(String relativeTarget, boolean isDirectory) { if (relativeTarget == null) return false; if (relativeTarget.length() == 0) return false; boolean match = matcher.matches(relativeTarget, isDirectory); return match; }
/** * Returns <code>true</code> if a match was made. * * @param relativeTarget * Name pattern of the file, relative to the base directory of * this rule * @param isDirectory * Whether the target file is a directory or not * @return True if a match was made. */ public boolean isMatch(String relativeTarget, boolean isDirectory) { if (relativeTarget == null) return false; if (relativeTarget.length() == 0) return false; boolean match = matcher.matches(relativeTarget, isDirectory, true); return match; }
/** * Returns true if a match was made. <br> * This function does NOT return the actual ignore status of the target! * Please consult {@link #getResult()} for the negation status. The actual * ignore status may be true or false depending on whether this rule is an * ignore rule or a negation rule. * * @param path Name pattern of the file, relative to the base directory of * this rule * @param directory Whether the target file is a directory or not * @param pathMatch {@code true} if the match is for the full path: see * {@link IMatcher#matches(String, int, int)} * @return True if a match was made. This does not necessarily mean that the * target is ignored. Call {@link #getResult() getResult()} for the * result. * @since 4.11 */ public boolean isMatch(String path, boolean directory, boolean pathMatch) { if (path == null) return false; if (path.length() == 0) return false; boolean match = matcher.matches(path, directory, pathMatch); return match; }
/** * Returns true if a match was made. <br> * This function does NOT return the actual ignore status of the target! * Please consult {@link #getResult()} for the negation status. The actual * ignore status may be true or false depending on whether this rule is an * ignore rule or a negation rule. * * @param path * Name pattern of the file, relative to the base directory of * this rule * @param directory * Whether the target file is a directory or not * @return True if a match was made. This does not necessarily mean that the * target is ignored. Call {@link #getResult() getResult()} for the * result. */ public boolean isMatch(String path, boolean directory) { if (path == null) return false; if (path.length() == 0) return false; boolean match = matcher.matches(path, directory); return match; }
/** * Returns true if a match was made. <br> * This function does NOT return the actual ignore status of the target! * Please consult {@link #getResult()} for the negation status. The actual * ignore status may be true or false depending on whether this rule is an * ignore rule or a negation rule. * * @param path * Name pattern of the file, relative to the base directory of * this rule * @param directory * Whether the target file is a directory or not * @param pathMatch * {@code true} if the match is for the full path: see * {@link IMatcher#matches(String, int, int)} * @return True if a match was made. This does not necessarily mean that the * target is ignored. Call {@link #getResult() getResult()} for the * result. * @since 4.11 */ public boolean isMatch(String path, boolean directory, boolean pathMatch) { if (path == null) return false; if (path.length() == 0) return false; boolean match = matcher.matches(path, directory, pathMatch); return match; }
private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { Collections.sort(tags, TAG_TIE_BREAKER); return Optional.of(tags.get(0)); } else { // Find the first tag that matches in the stream of all tags // filtered by matchers ordered by tie break order Stream<Ref> matchingTags = Stream.empty(); for (IMatcher matcher : matchers) { Stream<Ref> m = tags.stream().filter( tag -> matcher.matches(tag.getName(), false, false)); matchingTags = Stream.of(matchingTags, m).flatMap(i -> i); } return matchingTags.sorted(TAG_TIE_BREAKER).findFirst(); } }