[Schmitzm-commits] r2160 - in trunk: schmitzm-core/src/main/java/de/schmitzm/regex schmitzm-jfree-gt/src/test/java/de/schmitzm/jfree/testing

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Sat Dec 8 23:34:46 CET 2012


Author: alfonx
Date: 2012-12-08 23:34:46 +0100 (Sat, 08 Dec 2012)
New Revision: 2160

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java
   trunk/schmitzm-jfree-gt/src/test/java/de/schmitzm/jfree/testing/JFTestingUtil.java
Log:
RegexCache cleaned up

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 22:30:00 UTC (rev 2159)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java	2012-12-08 22:34:46 UTC (rev 2160)
@@ -52,10 +52,6 @@
 	 */
 	private static final int CACHE_VALUES_TO_RESULT_MAX_REGEX_LENGTH = 10000;
 
-	// private final ConcurrentLRUCache<String, ThreadLocal<Matcher>> matchersCache = new ConcurrentLRUCache<String,
-	// ThreadLocal<Matcher>>(
-	// 60000, 40000);
-
 	private static RegexCache singletonInstance;
 
 	private final ConcurrentLRUCache<String, Pattern> patternCache = new ConcurrentLRUCache<String, Pattern>(110000,
@@ -80,28 +76,7 @@
 	 * angeforderd, wird zuerst {@link Matcher#reset(CharSequence)} ausgeführt.
 	 */
 	public final Matcher getMatcher(final String regex, final String text) {
-
-		// if (!matcherCacheEnabled) {
 		return getPattern(regex).matcher(text);
-		// }
-		//
-		// ThreadLocal<Matcher> threadLocal = matchersCache.get(regex);
-		//
-		// if (threadLocal == null) {
-		//
-		// threadLocal = new ThreadLocal<Matcher>() {
-		//
-		// @Override
-		// protected Matcher initialValue() {
-		// return getPattern(regex).matcher("");
-		// }
-		// };
-		// matchersCache.put(regex, threadLocal);
-		//
-		// return threadLocal.get();
-		// }
-		//
-		// return threadLocal.get().reset(text);
 	}
 
 	/**
@@ -168,19 +143,11 @@
 	String ERKENNE_REGEX_RX = "[\\[\\]()?\\\\+{}^$]";
 
 	public boolean looksLikeRegex(final String suchString) {
-		// Kein Matches hier verwenden!
+		// Kein "Matches()" hier verwenden sonst StackOverflow
 		// return matches(ERKENNE_REGEX_RX, regex);
 		return result(ERKENNE_REGEX_RX, suchString) != null;
 	}
 
-	// public final boolean matches(final String regex, final Object object) {
-	// if (object == null)
-	// return false;
-	// final String value = object instanceof String ? (String) object : object.toString();
-	//
-	// return result(regex, value) != null;
-	// }
-
 	/**
 	 * Will throw java exceptions when pattern won't compile.
 	 * 
@@ -231,13 +198,6 @@
 		return resultsCache.getStats();
 	}
 
-	// /**
-	// * Liefert die aktuellen Statistiken des ResultsCache
-	// */
-	// public Stats getMatcherCacheStats() {
-	// return matchersCache.getStats();
-	// }
-
 	/**
 	 * Liefert die aktuellen Statistiken des PatternCache
 	 */
@@ -281,11 +241,6 @@
 			patternCache.clear();
 			patternCache.destroy();
 		}
-
-		// if (matchersCache != null) {
-		// matchersCache.clear();
-		// matchersCache.destroy();
-		// }
 	}
 
 	public void report(PrintStream out) {
@@ -294,16 +249,10 @@
 				+ cStats.getCumulativeLookups() + " Misses=" + cStats.getCumulativeMisses() + " currentSize="
 				+ cStats.getCurrentSize());
 
-		// cStats = getMatcherCacheStats();
-		// out.println("MatcherCacheStats: Hits=" + cStats.getCumulativeHits() + " Lookups="
-		// + cStats.getCumulativeLookups() + " Misses=" + cStats.getCumulativeMisses() + " currentSize="
-		// + cStats.getCurrentSize());
-
 		cStats = getResultsCacheStats();
 		out.println("ResultsCacheStats: Hits=" + cStats.getCumulativeHits() + " Lookups="
 				+ cStats.getCumulativeLookups() + " Misses=" + cStats.getCumulativeMisses() + " currentSize="
 				+ cStats.getCurrentSize());
-
 	}
 
 	/**

Modified: trunk/schmitzm-jfree-gt/src/test/java/de/schmitzm/jfree/testing/JFTestingUtil.java
===================================================================
--- trunk/schmitzm-jfree-gt/src/test/java/de/schmitzm/jfree/testing/JFTestingUtil.java	2012-12-08 22:30:00 UTC (rev 2159)
+++ trunk/schmitzm-jfree-gt/src/test/java/de/schmitzm/jfree/testing/JFTestingUtil.java	2012-12-08 22:34:46 UTC (rev 2160)
@@ -5,6 +5,9 @@
 
 import de.schmitzm.testing.TestingUtil;
 
+/**
+ * JFreeChart Testing-Util Klasse
+ */
 public class JFTestingUtil extends TestingUtil {
 
 	public static void testGui(JFreeChart chart, String frameTitle)



More information about the Schmitzm-commits mailing list