[Schmitzm-commits] r2154 - trunk/schmitzm-core/src/main/java/de/schmitzm/regex

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Sat Dec 8 22:30:21 CET 2012


Author: alfonx
Date: 2012-12-08 22:30:21 +0100 (Sat, 08 Dec 2012)
New Revision: 2154

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java
Log:
KEY_STRING_TRENNER als Constante..

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java	2012-12-08 17:06:18 UTC (rev 2153)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java	2012-12-08 21:30:21 UTC (rev 2154)
@@ -19,6 +19,8 @@
 
 public class RegexCache {
 
+	private static final String KEY_STRING_TRENNER = ":*:";
+
 	final static Logger log = Logger.getLogger(RegexCache.class);
 
 	/**
@@ -127,9 +129,6 @@
 			return false;
 		final String value = object instanceof String ? (String) object : object.toString();
 
-		// Matcher m = getMatcher(regex, value);
-		// return m.find();
-
 		return result(regex, value) != null;
 	}
 
@@ -152,12 +151,14 @@
 				|| value.length() > CACHE_VALUES_TO_RESULT_MAX_VALUE_LENGTH
 				|| regex.length() < CACHE_VALUES_TO_RESULT_MIN_REGEX_LENGTH
 				|| regex.length() > CACHE_VALUES_TO_RESULT_MAX_REGEX_LENGTH) {
+			
 			final Matcher m = getMatcher(regex, value);
 			final boolean found = m.find();
-			return found ? m.toMatchResult() : null;
+			MatchResult matchResult = found ? m.toMatchResult() : null;
+			return matchResult;
 		}
 
-		final String key = regex + ":*:" + value;
+		final String key = regex + KEY_STRING_TRENNER + value;
 		MyMatchResult mResult = resultsCache.get(key);
 		if (mResult == null) {
 			// final Matcher xm = pattern.matcher(value);



More information about the Schmitzm-commits mailing list