[PATCH] Clean up bad code from 8614:e7a2234e7c3f

Wald Commits scm-commit at wald.intevation.org
Wed Mar 25 18:12:20 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1427303536 -3600
# Node ID 594b0bbc7011523c710a6007d4ac4cf3f90511c5
# Parent  054d1b57ae4a6dcf39f71430285f23ef36fd3feb
Clean up bad code from 8614:e7a2234e7c3f

diff -r 054d1b57ae4a -r 594b0bbc7011 artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java	Wed Mar 25 11:41:36 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java	Wed Mar 25 18:12:16 2015 +0100
@@ -107,37 +107,23 @@
                 NumberFormat valF = Formatter.getFlowVelocityValues(context);
                 NumberFormat qF   = Formatter.getFlowVelocityQ(context);
 
-                if (data.getType().equals("main")) {
-                    /* Only a main channel value selected */
-                    writer.writeNext(new String[] {
-                        kmF.format(data.getKM(i)),
-                        valF.format(data.getVMain(i)),
-                        "",
-                        valF.format(data.getTauMain(i)),
-                        qF.format(data.getQ(i)) + "=" + data.getZone(),
-                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
-                    });
-                } else if (data.getType().equals("total")) {
-                    /* Only a total channel value selected */
-                    writer.writeNext(new String[] {
-                        kmF.format(data.getKM(i)),
-                        "",
-                        valF.format(data.getVTotal(i)),
-                        valF.format(data.getTauMain(i)),
-                        qF.format(data.getQ(i)) + "=" + data.getZone(),
-                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
-                    });
-                } else {
-                    /* In this case the type is main_total */
-                    writer.writeNext(new String[] {
-                        kmF.format(data.getKM(i)),
-                        valF.format(data.getVMain(i)),
-                        valF.format(data.getVTotal(i)),
-                        valF.format(data.getTauMain(i)),
-                        qF.format(data.getQ(i)) + "=" + data.getZone(),
-                        RiverUtils.getLocationDescription(flys, data.getKM(i)),
-                    });
+                String vMain = "";
+                String vTotal = "";
+
+                if (data.getType().equals("main") || data.getType().equals("main_total")) {
+                    vMain = valF.format(data.getVMain(i));
                 }
+                if (data.getType().equals("total") || data.getType().equals("main_total")) {
+                    vTotal = valF.format(data.getVTotal(i));
+                }
+                writer.writeNext(new String[] {
+                    kmF.format(data.getKM(i)),
+                    vMain,
+                    vTotal,
+                    valF.format(data.getTauMain(i)),
+                    qF.format(data.getQ(i)) + "=" + data.getZone(),
+                    RiverUtils.getLocationDescription(flys, data.getKM(i)),
+                });
             }
         }
     }


More information about the Dive4Elements-commits mailing list