Created
October 14, 2019 07:28
-
-
Save gregw/707fe300cc02b780cef9d10154780c89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static boolean combine(IncludeExcludeSet<Entry, String> names, String name, IncludeExcludeSet<Entry, URI> locations, Supplier<URI> location) | |
{ | |
// check the name set | |
Boolean byName = names.isIncludedAndNotExcluded(name); | |
// If we excluded by name, then no match | |
if (Boolean.FALSE == byName) | |
return false; | |
// check the location set | |
URI uri = location.get(); | |
Boolean byLocation = uri == null ? null : locations.isIncludedAndNotExcluded(uri); | |
// If we excluded by location or couldn't check location exclusion, then no match | |
if (Boolean.FALSE == byLocation || (locations.hasExcludes() && uri == null)) | |
return false; | |
// If there are includes, then we must be included to match. | |
if (names.hasIncludes() || locations.hasIncludes()) | |
return byName == Boolean.TRUE || byLocation == Boolean.TRUE; | |
// Otherwise there are no includes and it was not excluded, so match | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment