Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java @ 8580:d9f038b8e2ce
(issue1753) Format S with only up to three fractional digits
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 16 Mar 2015 14:37:30 +0100 |
parents | 4eb1a3c71579 |
children | 5210e1dd303e |
comparison
equal
deleted
inserted
replaced
8579:b058b4f153d3 | 8580:d9f038b8e2ce |
---|---|
256 | 256 |
257 NumberFormat sqAFormatter = Formatter.getSQRelationA(context); | 257 NumberFormat sqAFormatter = Formatter.getSQRelationA(context); |
258 NumberFormat sqBFormatter = Formatter.getSQRelationB(context); | 258 NumberFormat sqBFormatter = Formatter.getSQRelationB(context); |
259 NumberFormat fThreeFormatter = Formatter.getFormatter(context, 3, 3); | 259 NumberFormat fThreeFormatter = Formatter.getFormatter(context, 3, 3); |
260 NumberFormat fTwoFormatter = Formatter.getFormatter(context, 2, 2); | 260 NumberFormat fTwoFormatter = Formatter.getFormatter(context, 2, 2); |
261 NumberFormat fZeroThreeFormatter = Formatter.getFormatter(context, 0, 3); | |
261 NumberFormat fZeroFormatter = Formatter.getFormatter(context, 0, 0); | 262 NumberFormat fZeroFormatter = Formatter.getFormatter(context, 0, 0); |
262 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, | 263 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, |
263 Resources.getLocale(context.getMeta())); | 264 Resources.getLocale(context.getMeta())); |
264 | 265 |
265 for (int i = 0; i < SQResult.NUMBER_FRACTIONS; ++i) { | 266 for (int i = 0; i < SQResult.NUMBER_FRACTIONS; ++i) { |
300 r2, // 6 | 301 r2, // 6 |
301 t, // 7 | 302 t, // 7 |
302 o, // 8 | 303 o, // 8 |
303 c_duan, // 9 | 304 c_duan, // 9 |
304 c_ferguson, // 10 | 305 c_ferguson, // 10 |
305 sqAFormatter.format(sq.getS()), | 306 fZeroThreeFormatter.format(sq.getS()), |
306 fZeroFormatter.format(sq.getQ()), | 307 fZeroFormatter.format(sq.getQ()), |
307 df.format(sq.getDate()) | 308 df.format(sq.getDate()) |
308 }); | 309 }); |
309 } | 310 } |
310 } else { | 311 } else { |
343 } | 344 } |
344 | 345 |
345 protected SQMeasurementsJRDataSource createMeasurementJRData() { | 346 protected SQMeasurementsJRDataSource createMeasurementJRData() { |
346 SQMeasurementsJRDataSource source = new SQMeasurementsJRDataSource(); | 347 SQMeasurementsJRDataSource source = new SQMeasurementsJRDataSource(); |
347 NumberFormat fZeroFormatter = Formatter.getFormatter(context, 0, 0); | 348 NumberFormat fZeroFormatter = Formatter.getFormatter(context, 0, 0); |
348 NumberFormat fEightFormatter = Formatter.getFormatter(context, 0, 8); | 349 NumberFormat fZeroThreeFormatter = Formatter.getFormatter(context, 0, 3); |
349 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, | 350 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, |
350 Resources.getLocale(context.getMeta())); | 351 Resources.getLocale(context.getMeta())); |
351 | 352 |
352 for (SQResult [] results: data) { | 353 for (SQResult [] results: data) { |
353 for (SQResult result: results) { | 354 for (SQResult result: results) { |
355 String name = result.getFractionName(i); | 356 String name = result.getFractionName(i); |
356 SQFractionResult fraction = result.getFraction(i); | 357 SQFractionResult fraction = result.getFraction(i); |
357 for (SQ sq: fraction.getMeasurements()) { | 358 for (SQ sq: fraction.getMeasurements()) { |
358 source.addData(new String[] { | 359 source.addData(new String[] { |
359 name, | 360 name, |
360 fEightFormatter.format(sq.getS()), | 361 fZeroThreeFormatter.format(sq.getS()), |
361 fZeroFormatter.format(sq.getQ()), | 362 fZeroFormatter.format(sq.getQ()), |
362 df.format(sq.getDate()), | 363 df.format(sq.getDate()), |
363 null | 364 null |
364 }); | 365 }); |
365 } | 366 } |
366 for (int j = 0; j < fraction.numIterations(); j++) { | 367 for (int j = 0; j < fraction.numIterations(); j++) { |
367 for (SQ sq: fraction.getOutliers(j)) { | 368 for (SQ sq: fraction.getOutliers(j)) { |
368 source.addData(new String[] { | 369 source.addData(new String[] { |
369 name, | 370 name, |
370 fEightFormatter.format(sq.getS()), | 371 fZeroThreeFormatter.format(sq.getS()), |
371 fZeroFormatter.format(sq.getQ()), | 372 fZeroFormatter.format(sq.getQ()), |
372 df.format(sq.getDate()), | 373 df.format(sq.getDate()), |
373 Integer.toString(j + 1) | 374 Integer.toString(j + 1) |
374 }); | 375 }); |
375 } | 376 } |