[PATCH] Minor cleanup and bugfix concerning number formatters

Wald Commits scm-commit at wald.intevation.org
Thu Jun 28 13:14:51 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1530184484 -7200
# Node ID 3931e8741f53c9a878b61cc0c555686a7ccb5059
# Parent  b3c11c5fdbd5c67b42edd7f30695ca1d92237a6e
Minor cleanup and bugfix concerning number formatters

diff -r b3c11c5fdbd5 -r 3931e8741f53 artifacts/src/main/java/org/dive4elements/river/artifacts/common/ExportContextCSV.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/ExportContextCSV.java	Thu Jun 28 10:47:08 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/ExportContextCSV.java	Thu Jun 28 13:14:44 2018 +0200
@@ -50,11 +50,11 @@
 
     private static final String CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL_ORIGINAL = "sinfo.export.flow_depth.csv.meta.header.sounding.elevationmodel.original";
 
-    private static NumberFormat qFormat = null;
+    private NumberFormat qFormat = null;
 
-    private static NumberFormat flowDepthFormat = null;
+    private NumberFormat flowDepthFormat = null;
 
-    private NumberFormat kmFormat;
+    private NumberFormat kmFormat = null;
 
     /** The CallContext object. */
     private final CallContext context;
@@ -83,7 +83,6 @@
 
     public void writeBlankLine() {
         writeCSVLine(new String[] { "" });
-
     }
 
     // *** CUSTOM STUFF that is used multiple times ***///
@@ -110,7 +109,7 @@
         source.addMetaData(key, type.getPdfHeader(this.context.getMeta()));
     }
 
-    public final void writeCSVGlobalMetadataDefaults(final AbstractCalculationResults results) {
+    public final void writeCSVGlobalMetadataDefaults(final AbstractCalculationResults<?> results) {
         // TODO: results as member
         final String calcModeLabel = results.getCalcModeLabel();
         final RiverInfo river = results.getRiver();
@@ -165,27 +164,27 @@
     // copy from AbstractExporter TODO merge with ExportContextPDF
     protected NumberFormat getKmFormatter() {
 
-        if (this.kmFormat == null) {
+        if (this.kmFormat == null)
             this.kmFormat = Formatter.getWaterlevelKM(this.context);
-        }
+
         return this.kmFormat;
     }
 
     public void addJRMetadata(final MetaAndTableJRDataSource source, final String key, final String msg) {
         source.addMetaData(key, msg);
-
     }
 
     public NumberFormat getQFormatter() {
-        if (this.qFormat == null) {
+        if (this.qFormat == null)
             this.qFormat = Formatter.getWaterlevelQ(this.context);
-        }
+
         return this.qFormat;
     }
 
     public final NumberFormat getFlowDepthFormatter() {
         if (this.flowDepthFormat == null)
             this.flowDepthFormat = Formatter.getFlowDepth(this.context);
+
         return this.flowDepthFormat;
     }
 
@@ -231,7 +230,6 @@
 
     public String msgPdf(final SInfoResultType type) {
         return type.getPdfHeader(this.context.getMeta());
-
     }
 
     public void writeTitleForTabs(final String tabTitleMsg, final int colSize) {


More information about the Dive4Elements-commits mailing list