[PATCH 2 of 4] BedQualityExporter: Refactoring

Wald Commits scm-commit at wald.intevation.org
Thu Nov 28 10:46:09 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1385630033 -3600
# Node ID a11985bb743fc00fad43e1db29e7375f712b7e59
# Parent  d72459b90397e5ffaf64237f4b697e316284ca3c
BedQualityExporter: Refactoring.

diff -r d72459b90397 -r a11985bb743f artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityExporter.java	Thu Nov 28 09:54:21 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityExporter.java	Thu Nov 28 10:13:53 2013 +0100
@@ -59,11 +59,8 @@
         results = new BedQualityResult[0];
     }
 
-    @Override
-    protected void writeCSVData(CSVWriter writer) throws IOException {
-        // TODO Auto-generated method stub
-        writeCSVHeader(writer);
 
+    private List<double[]> createDataRows() {
         TDoubleArrayList kms = new TDoubleArrayList();
         int cols = 1;
         for (int i = 0; i < results.length; i++) {
@@ -133,12 +130,22 @@
             }
             rows.add(row);
         }
-        for (double[] d : rows) {
-            logger.debug(Arrays.toString(d));
+
+        return rows;
+    }
+
+    @Override
+    protected void writeCSVData(CSVWriter writer) throws IOException {
+        // TODO Auto-generated method stub
+        writeCSVHeader(writer);
+
+        NumberFormat nf = Formatter.getFormatter(context, 1, 3);
+
+        for (double[] d : createDataRows()) {
+            logger.debug("row + " + Arrays.toString(d));
             List<String> cells = new ArrayList<String>(d.length);
             for (int i = 0; i < d.length; i++) {
                 if (!Double.isNaN(d[i])) {
-                    NumberFormat nf = Formatter.getFormatter(context, 1, 3);
                     cells.add(nf.format(d[i]));
                 }
                 else {


More information about the Dive4elements-commits mailing list