Mercurial > dive4elements > river
changeset 7611:a11985bb743f
BedQualityExporter: Refactoring.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 28 Nov 2013 10:13:53 +0100 |
parents | d72459b90397 |
children | 61940bae77b5 |
files | artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityExporter.java |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityExporter.java Thu Nov 28 09:54:21 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityExporter.java Thu Nov 28 10:13:53 2013 +0100 @@ -59,11 +59,8 @@ results = new BedQualityResult[0]; } - @Override - protected void writeCSVData(CSVWriter writer) throws IOException { - // TODO Auto-generated method stub - writeCSVHeader(writer); + private List<double[]> createDataRows() { TDoubleArrayList kms = new TDoubleArrayList(); int cols = 1; for (int i = 0; i < results.length; i++) { @@ -133,12 +130,22 @@ } rows.add(row); } - for (double[] d : rows) { - logger.debug(Arrays.toString(d)); + + return rows; + } + + @Override + protected void writeCSVData(CSVWriter writer) throws IOException { + // TODO Auto-generated method stub + writeCSVHeader(writer); + + NumberFormat nf = Formatter.getFormatter(context, 1, 3); + + for (double[] d : createDataRows()) { + logger.debug("row + " + Arrays.toString(d)); List<String> cells = new ArrayList<String>(d.length); for (int i = 0; i < d.length; i++) { if (!Double.isNaN(d[i])) { - NumberFormat nf = Formatter.getFormatter(context, 1, 3); cells.add(nf.format(d[i])); } else {