Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java @ 8363:3508d625092f
wUnit might be null.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 02 Oct 2014 09:42:12 +0200 |
parents | 839032ac1523 |
children | 4de385d58a3e |
comparison
equal
deleted
inserted
replaced
8362:839032ac1523 | 8363:3508d625092f |
---|---|
163 log.debug("ComputedDischargeCurveExporter.writeCSVHeader"); | 163 log.debug("ComputedDischargeCurveExporter.writeCSVHeader"); |
164 | 164 |
165 RangeAccess access = new RangeAccess((D4EArtifact)master); | 165 RangeAccess access = new RangeAccess((D4EArtifact)master); |
166 double[] km = access.getLocations(); | 166 double[] km = access.getLocations(); |
167 // If we are not at gauge (cm) use the river unit | 167 // If we are not at gauge (cm) use the river unit |
168 String realUnit = wUnit.equals("cm") ? "cm" : riverUnit; | 168 String realUnit = "cm".equals(wUnit) ? "cm" : riverUnit; |
169 String header = | 169 String header = |
170 msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] {realUnit}); | 170 msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] {realUnit}); |
171 | 171 |
172 writer.writeNext(new String[] { | 172 writer.writeNext(new String[] { |
173 header, | 173 header, |
180 * Returns the number formatter for W values. | 180 * Returns the number formatter for W values. |
181 * | 181 * |
182 * @return the number formatter for W values. | 182 * @return the number formatter for W values. |
183 */ | 183 */ |
184 protected NumberFormat getWFormatter() { | 184 protected NumberFormat getWFormatter() { |
185 if (wUnit.equals("cm")) { | 185 if ("cm".equals(wUnit)) { |
186 return Formatter.getFormatter(context, 0, 0); | 186 return Formatter.getFormatter(context, 0, 0); |
187 } | 187 } |
188 return Formatter.getComputedDischargeW(context); | 188 return Formatter.getComputedDischargeW(context); |
189 } | 189 } |
190 | 190 |
252 Locale locale = Resources.getLocale(meta); | 252 Locale locale = Resources.getLocale(meta); |
253 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale); | 253 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale); |
254 | 254 |
255 source.addMetaData("date", df.format(new Date())); | 255 source.addMetaData("date", df.format(new Date())); |
256 | 256 |
257 source.addMetaData("wUnit", wUnit.equals("cm") ? "cm" : riverUnit); | 257 source.addMetaData("wUnit", "cm".equals(wUnit) ? "cm" : riverUnit); |
258 | 258 |
259 RangeAccess rangeAccess = new RangeAccess(flys); | 259 RangeAccess rangeAccess = new RangeAccess(flys); |
260 double[] kms = rangeAccess.getKmRange(); | 260 double[] kms = rangeAccess.getKmRange(); |
261 source.addMetaData("range", | 261 source.addMetaData("range", |
262 Formatter.getCalculationKm(context.getMeta()).format(kms[0])); | 262 Formatter.getCalculationKm(context.getMeta()).format(kms[0])); |