private boolean match(String pattern, char escape, CharSequence search, MatchMode mode) throws ExpressionEvaluationException { Pattern patternRegex = null; switch (mode) { case LIKE: patternRegex = LIKE_TO_REGEX.translate(pattern, escape); break; case SIMILAR: patternRegex = SIMILAR_TO_REGEX.translate(pattern, escape); break; case REGEX: patternRegex = MatchCriteria.getPattern(pattern, pattern, 0); break; default: throw new AssertionError(); } Matcher matcher = patternRegex.matcher(search); return matcher.find(); }
private boolean match(String pattern, char escape, CharSequence search, MatchMode mode) throws ExpressionEvaluationException { Pattern patternRegex = null; switch (mode) { case LIKE: patternRegex = LIKE_TO_REGEX.translate(pattern, escape); break; case SIMILAR: patternRegex = SIMILAR_TO_REGEX.translate(pattern, escape); break; case REGEX: patternRegex = MatchCriteria.getPattern(pattern, pattern, 0); break; default: throw new AssertionError(); } Matcher matcher = patternRegex.matcher(search); return matcher.find(); }
private boolean match(String pattern, char escape, CharSequence search, MatchMode mode) throws ExpressionEvaluationException { Pattern patternRegex = null; switch (mode) { case LIKE: patternRegex = LIKE_TO_REGEX.translate(pattern, escape); break; case SIMILAR: patternRegex = SIMILAR_TO_REGEX.translate(pattern, escape); break; case REGEX: patternRegex = MatchCriteria.getPattern(pattern, pattern, 0); break; default: throw new AssertionError(); } Matcher matcher = patternRegex.matcher(search); return matcher.find(); }
public Pattern translate(String pattern, char escape) throws ExpressionEvaluationException { List<?> key = Arrays.asList(pattern, escape); Pattern result = null; synchronized (cache) { result = cache.get(key); } if (result == null) { String newPattern = getPatternString(pattern, escape); result = getPattern(newPattern, pattern, flags); synchronized (cache) { cache.put(key, result); } } return result; }
public Pattern translate(String pattern, char escape) throws ExpressionEvaluationException { List<?> key = Arrays.asList(pattern, escape); Pattern result = null; synchronized (cache) { result = cache.get(key); } if (result == null) { String newPattern = getPatternString(pattern, escape); result = getPattern(newPattern, pattern, flags); synchronized (cache) { cache.put(key, result); } } return result; }
public Pattern translate(String pattern, char escape) throws ExpressionEvaluationException { List<?> key = Arrays.asList(pattern, escape); Pattern result = null; synchronized (cache) { result = cache.get(key); } if (result == null) { String newPattern = getPatternString(pattern, escape); result = getPattern(newPattern, pattern, flags); synchronized (cache) { cache.put(key, result); } } return result; }