changeset 8616:594b0bbc7011

Clean up bad code from 8614:e7a2234e7c3f
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 25 Mar 2015 18:12:16 +0100
parents 054d1b57ae4a
children b8493c4bdf0c
files artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityExporter.java
diffstat 1 files changed, 16 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- 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)),
+                });
             }
         }
     }

http://dive4elements.wald.intevation.org