changeset 4842:97a0fa4dff8e

Use isDebugEnabled() in S/Q Measurement factory.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 23 Jan 2013 17:36:18 +0100
parents ad0990a82ab8
children 88014b9852d0
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Wed Jan 23 17:32:30 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Wed Jan 23 17:36:18 2013 +0100
@@ -371,7 +371,9 @@
 
     protected static Measurement processSameDate(List<Measurement> measurements) {
         int N = measurements.size();
-        if (N > 0) {
+
+        boolean debug = log.isDebugEnabled();
+        if (debug && N > 0) {
             log.debug("process same date for Q: " + measurements.get(0).Q());
         }
         if (N == 1) {
@@ -403,7 +405,9 @@
                     double distNext = next.get("UFERABST");
                     current.set("EFFWIDTH", 0.5*(distNext - distPrev));
                 }
-                log.debug("effective width: " + current.get("EFFWIDTH"));
+                if (debug) {
+                    log.debug("effective width: " + current.get("EFFWIDTH"));
+                }
             }
         }
 
@@ -427,11 +431,13 @@
             sumCoarseF += scale*coarseF;
             sumGravelF += scale*gravelF;
             sumNorm    += scale;
-            log.debug("fractions - s: " +
-                sandF + " c: " +
-                coarseF + " g: " + 
-                gravelF);
-            log.debug("scale: " + scale + " = " + effWidth + " * " + gt);
+            if (debug) {
+                log.debug("fractions - s: " +
+                    sandF + " c: " +
+                    coarseF + " g: " + 
+                    gravelF);
+                log.debug("scale: " + scale + " = " + effWidth + " * " + gt);
+            }
         }
 
         Map<String, Object> data =
@@ -444,7 +450,12 @@
         m.set("BL_S", sumNorm*sumSandF);
         m.set("BL_G", sumNorm*sumGravelF);
         m.set("BL_C", sumNorm*sumCoarseF);
-        log.debug("BL_S: " + m.get("BL_S") + " BL_G: " + m.get("BL_G") + " BL_C: " + m.get("BL_C"));
+        if (debug) {
+            log.debug(
+                "BL_S: " + m.get("BL_S") +
+                " BL_G: " + m.get("BL_G") + 
+                " BL_C: " + m.get("BL_C"));
+        }
         return m;
     }
 

http://dive4elements.wald.intevation.org