Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.uberfire.io.regex;
 
 import java.net.URI;
 
 import  org.uberfire.java.nio.file.Path;
 
 import static org.uberfire.commons.validation.Preconditions.*;
 
public final class AntPathMatcher {
    private static org.uberfire.commons.regex.util.AntPathMatcher matcher = new org.uberfire.commons.regex.util.AntPathMatcher();
    public static boolean filterfinal Collection<Stringincludes,
                                  final Collection<Stringexcludes,
                                  final Path path ) {
        checkNotNull"includes"includes );
        checkNotNull"excludes"excludes );
        checkNotNull( "path"path );
        if ( includes.isEmpty() && excludes.isEmpty() ) {
            return true;
        } else if ( includes.isEmpty() ) {
            return !( excludesexcludespath ) );
        } else if ( excludes.isEmpty() ) {
            return includesincludespath );
        }
        return includesincludespath ) && !( excludesexcludespath ) );
    }
    public static boolean filterfinal Collection<Stringincludes,
                                  final Collection<Stringexcludes,
                                  final URI uri ) {
        checkNotNull"includes"includes );
        checkNotNull"excludes"excludes );
        checkNotNull"uri"uri );
        if ( includes.isEmpty() && excludes.isEmpty() ) {
            return true;
        } else if ( includes.isEmpty() ) {
            return !( excludesexcludesuri ) );
        } else if ( excludes.isEmpty() ) {
            return includesincludesuri );
        }
        return includesincludesuri ) && !( excludesexcludesuri ) );
    }
    public static boolean includesfinal Collection<Stringpatterns,
                                    final Path path ) {
        checkNotNull"patterns"patterns );
        checkNotNull( "path"path );
        return matchespatternspath );
    }
    public static boolean includesfinal Collection<Stringpatterns,
                                    final URI uri ) {
        checkNotNull"patterns"patterns );
        checkNotNull"uri"uri );
        return matchespatternsuri );
    }
    public static boolean excludesfinal Collection<Stringpatterns,
                                    final URI uri ) {
        checkNotNull"patterns"patterns );
        checkNotNull"uri"uri );
        return matchespatternsuri );
    }
    public static boolean excludesfinal Collection<Stringpatterns,
                                    final Path path ) {
        checkNotNull"patterns"patterns );
        checkNotNull( "path"path );
        return matchespatternspath );
    }
    private static boolean matchesfinal Collection<Stringpatterns,
                                    final Path path ) {
        return matchespatternspath.toUri() );
    }
    private static boolean matchesfinal Collection<Stringpatterns,
                                    final URI uri ) {
        for ( final String pattern : patterns ) {
            if ( .match( patternuri.toString() ) ) {
                return true;
            }
        }
        return false;
    }
New to GrepCode? Check out our FAQ X