/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(String object) { return regex.matches(object); } }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(String object) { return regex.matches(object); } }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(String object) { return regex.matches(object); } }
/** * @see org.dihedron.commons.reflection.ReflectorFilter#matches(java.lang.reflect.Member) */ @Override public boolean matches(T member) { return regex.matches(member.getName()); } }
/** * Checks whether a resource complies with the filter criteria. */ public boolean accept(File dir, String name) { boolean result = regex.matches(name); logger.debug("checked resource '{}', result is {}", name, result); return result; }
/** * @see org.dihedron.commons.reflection.ReflectorFilter#matches(java.lang.reflect.Member) */ @Override public boolean matches(T member) { return regex.matches(member.getName()); } }
/** * @see org.dihedron.commons.reflection.ReflectorFilter#matches(java.lang.reflect.Member) */ @Override public boolean matches(T member) { return regex.matches(member.getName()); } }
/** * @see org.dihedron.patterns.cache.Storage#list(org.dihedron.core.regex.Regex) */ @Override public String[] list(Regex regex) { if(regex != null && !resources.isEmpty()) { List<String> matches = new ArrayList<>(); for(String resource : resources) { if(regex.matches(resource)) { matches.add(resource); } } return matches.toArray(new String[matches.size()]); } return null; }
/** * @see org.dihedron.patterns.cache.Storage#delete(org.dihedron.core.regex.Regex) */ @Override public void delete(Regex regex) { Set<String> resources = new HashSet<String>(contents.keySet()); for (String resource : resources) { if(regex.matches(resource)){ logger.debug("removing resource '{}'", resource); Streams.safelyClose(contents.get(resource)); contents.remove(resource); } } }
/** * @see org.dihedron.patterns.cache.Storage#list(org.dihedron.core.regex.Regex) */ @Override public String[] list(Regex regex) { List<String> matched = new ArrayList<String>(); if(regex != null) { for (String resource : contents.keySet()) { if(regex.matches(resource)) { logger.trace("regular expression matches input string '{}'", resource); matched.add(resource); } } } else { matched.addAll(contents.keySet()); } return matched.toArray(new String[0]); }
/** * Performs the actual file-system visit, matching files against the given * pattern as it goes and storing matching ones in the given list. * * @see * java.nio.file.SimpleFileVisitor#visitFile(java.lang.Object, java.nio.file.attribute.BasicFileAttributes) */ @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { Path name = path.getFileName(); if(regex.matches(name.toString())) { logger.trace("file found: {} -> {}", path.getParent(), name); files.add(path.toFile()); } return FileVisitResult.CONTINUE; } }
/** * @see org.dihedron.patterns.cache.Storage#list(org.dihedron.core.regex.Regex) */ @Override public String[] list(Regex regex) { if(regex == null) { logger.debug("returning full list of storage contents"); return index.keySet().toArray(new String[0]); } else { logger.debug("returning list of resources matching /{}/", regex); List<String> matched = new ArrayList<String>(); for(String key : index.keySet()) { if(regex.matches(key)) { matched.add(key); } } return matched.toArray(new String[0]); } }
if(Strings.isValid(value)) { Regex regex = new Regex(COLOR_REGEX, false); if(regex.matches(value.trim())) { int r = -1, g = -1, b = -1; String[] matches = regex.getAllMatches(value).get(0);