Mercurial > dive4elements > river
changeset 9170:9b2e46090099
tkh cast exception fix
gigantic refactoring 2
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -18,7 +18,7 @@ /** * @author Domenico Nardi Tironi */ -public abstract class AbstractCalculationExportableResult<RESULTS extends AbstractCalculationResults> extends AbstractCalculationResult { +public abstract class AbstractCalculationExportableResult<RESULTS extends AbstractCalculationResults<?>> extends AbstractCalculationResult { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationListResults.java Thu Jun 21 10:41:55 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ -package org.dive4elements.river.artifacts.common; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.math.DoubleRange; -import org.dive4elements.river.artifacts.model.Calculation; -import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; - -/** - * @author Gernot Belger - */ -public abstract class AbstractCalculationListResults<RESULT extends AbstractCalculationResult> extends AbstractCalculationResults { - - private static final long serialVersionUID = 1L; - - private final List<RESULT> results = new ArrayList<>(); - - public AbstractCalculationListResults(final String calcModeLabel, final String user, final RiverInfo river, final DoubleRange calcRange) { - super(calcModeLabel, user, river, calcRange); - } - - public final void addResult(final RESULT result, final Calculation problems) { - /* we assume error reporting was already done in this case */ - if (result == null) - return; - - if (result.isEmpty()) { - problems.addProblem("abstractsinfocalculationresults.emptyResult", result.getLabel()); - return; - } - - this.results.add(result); - } - - public final List<RESULT> getResults() { - return Collections.unmodifiableList(this.results); - } - -} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -10,17 +10,23 @@ package org.dive4elements.river.artifacts.common; import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.apache.commons.lang.math.DoubleRange; +import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger */ -public abstract class AbstractCalculationResults implements Serializable { +public abstract class AbstractCalculationResults<RESULT extends AbstractCalculationResult> implements Serializable { private static final long serialVersionUID = 1L; + private final List<RESULT> results = new ArrayList<>(); + private final String calcModeLabel; private final String user; @@ -51,4 +57,23 @@ public final DoubleRange getCalcRange() { return this.calcRange; } + + //// COPY FROM AbtractCalculationListResults -> further refactoring necessary? + public final void addResult(final RESULT result, final Calculation problems) { + /* we assume error reporting was already done in this case */ + if (result == null) + return; + + if (result.isEmpty()) { + problems.addProblem("abstractsinfocalculationresults.emptyResult", result.getLabel()); + return; + } + + this.results.add(result); + } + + public final List<RESULT> getResults() { + return Collections.unmodifiableList(this.results); + } + } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCommonListExporter.java Thu Jun 21 10:41:55 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ -package org.dive4elements.river.artifacts.common; - -import java.util.Collection; - -import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; - -import au.com.bytecode.opencsv.CSVWriter; - -/** - * @author Gernot Belger - */ -public abstract class AbstractCommonListExporter<RESULT extends AbstractCalculationResult, RESULTS extends AbstractCalculationListResults<RESULT>> extends AbstractCommonExporter<RESULTS> { - - /** The storage that contains the current calculation result. */ - protected static enum ExportMode { - pdf, csv - } - - @Override - protected void doWriteCSVData(final CSVWriter writer, final RESULTS results) { - - getLog().info("writeCSVData"); - - /* write as csv */ - writeCSVGlobalMetadata(writer, results); - - writer.writeNext(new String[] { "" }); // break line HERE to avoid redundance - final RiverInfo river = results.getRiver(); - // FIXME :with comment if not first result - writeCSVHeader(writer, results, river); - writer.writeNext(new String[] { "" }); // break line HERE to avoid redundance - - for (final RESULT result : results.getResults()) { - writeCSVResult(writer, results, result); - writer.writeNext(new String[] { "" }); // break line HERE after each resultset - } - } - - protected abstract void writeCSVHeader(final CSVWriter writer, final RESULTS results, final RiverInfo river); - - /** - * Add metadata that is once written to the top of the file. - */ - protected abstract void writeCSVGlobalMetadata(final CSVWriter writer, final RESULTS results); - - private final void writeCSVResult(final CSVWriter writer, final RESULTS results, final RESULT result) { - - writeCSVResultMetadata(writer, results, result); - // wenn resultsmetadata null sind!? keine neue zeile - // writer.writeNext(new String[] { "" }); // break line in den Implementationen, - // weil es sein kann, dass KEINE ResultMetadata geschrieben werden; dann wäre eine Leerzeile überflüssig - - /* now the value rows */ - final Collection<ResultRow> rows = result.getRows(); - for (final ResultRow row : rows) - writeCSVRow(writer, results, result, row); - } - - /** - * Add metadata that is written once per result set. - */ - protected abstract void writeCSVResultMetadata(CSVWriter writer, RESULTS results, RESULT result); - - protected void writeCSVRow(final CSVWriter writer, final RESULTS results, final RESULT result, final ResultRow row) { - getLog().debug("writeCSVFlowDepthRow"); - - final String[] formattedRow = formatCSVRow(results, row); - writer.writeNext(formattedRow); - } - - protected final String[] formatCSVRow(final RESULTS results, final ResultRow row) { - return formatRow(results, row, ExportMode.csv); - } - - protected final MetaAndTableJRDataSource createJRData() { - - /* fetch calculation results */ - final RESULTS results = getResults(); - - final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource(); - - addJRMetaData(source, results); - - for (final RESULT result : results.getResults()) - addJRTableData(source, results, result); - - return source; - } - - protected abstract void addJRMetaData(final MetaAndTableJRDataSource source, final RESULTS results); - - private void addJRTableData(final MetaAndTableJRDataSource source, final RESULTS results, final RESULT result) { - - final Collection<ResultRow> rows = result.getRows(); - - for (final ResultRow row : rows) { - - final String[] formattedRow = formatPDFRow(results, row); - source.addData(formattedRow); - } - } - - protected abstract String[] formatRow(RESULTS results, ResultRow row, ExportMode mode); - - private final String[] formatPDFRow(final RESULTS results, final ResultRow row) { - return formatRow(results, row, ExportMode.pdf); - } -} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,13 +11,13 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger */ -final class CollisionCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<CollisionCalculationResults>> { +final class CollisionCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<CollisionCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionQueryCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionQueryCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,19 +11,19 @@ import java.util.Collection; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; import org.dive4elements.river.artifacts.common.ResultRow; -import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult; /** * Contains the results of a database query of a river bed collision series * * @author Matthias Schäfer */ -public final class CollisionQueryCalculationResult extends AbstractSInfoCalculationResult { +public final class CollisionQueryCalculationResult extends AbstractCalculationResult { private static final long serialVersionUID = 1L; public CollisionQueryCalculationResult(final String label, final Collection<ResultRow> rows) { - super(label, null, rows); + super(label, rows); } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractSInfoCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ -package org.dive4elements.river.artifacts.sinfo.common; - -import java.util.Collection; -import org.dive4elements.river.artifacts.common.AbstractCalculationResult; -import org.dive4elements.river.artifacts.common.ResultRow; -import org.dive4elements.river.artifacts.sinfo.util.WstInfo; - - -/** - * @author Gernot Belger - */ -public abstract class AbstractSInfoCalculationResult extends AbstractCalculationResult { - - private static final long serialVersionUID = 1L; - - private final WstInfo wst; - - public AbstractSInfoCalculationResult(final String label, final WstInfo wst, final Collection< ResultRow> rows) { - super(label, rows); - this.wst = wst; - } - - - public final WstInfo getWst() { - return this.wst; - } -} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractSInfoCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ -package org.dive4elements.river.artifacts.sinfo.common; - - - -import org.apache.commons.lang.math.DoubleRange; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; - -import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; - -/** - * @author Gernot Belger - */ -public abstract class AbstractSInfoCalculationResults<RESULT extends AbstractSInfoCalculationResult> extends AbstractCalculationListResults<RESULT> { - - private static final long serialVersionUID = 1L; - - //TODO: einen sinnvollen Grund finden, warum es diese Klasse noch geben muss, oder LÖSCHEN! - public AbstractSInfoCalculationResults(final String calcModeLabel, final String user, final RiverInfo river, final DoubleRange calcRange) { - super(calcModeLabel, user, river, calcRange); //TODO: Split! - } - -} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -12,6 +12,8 @@ import java.util.Collection; import java.util.List; +import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.common.ResultRow; import org.dive4elements.river.artifacts.sinfo.tkhcalculation.SoilKind; import org.dive4elements.river.artifacts.sinfo.util.WstInfo; @@ -21,15 +23,17 @@ /** * @author Gernot Belger */ -public abstract class AbstractTkhCalculationResult extends AbstractSInfoCalculationResult { + +public abstract class AbstractTkhCalculationResult<RESULTS extends AbstractCalculationResults<?>> extends AbstractCalculationExportableResult<RESULTS> { private static final long serialVersionUID = 1L; private final boolean hasTkh; + private final WstInfo wst; public AbstractTkhCalculationResult(final String label, final WstInfo wst, final boolean hasTkh, final Collection<ResultRow> rows) { - super(label, wst, rows); - + super(label, rows); + this.wst = wst; this.hasTkh = hasTkh; } @@ -100,4 +104,8 @@ return new double[][] { adjustedX.toNativeArray(), adjustedY.toNativeArray() }; } + + public final WstInfo getWst() { + return this.wst; // TODO: Meta-Data export hier hin + } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultFacet.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultFacet.java Thu Jun 21 14:32:11 2018 +0200 @@ -13,8 +13,8 @@ import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; import org.dive4elements.river.artifacts.common.AbstractCalculationResult; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.model.DataFacet; import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; @@ -32,8 +32,8 @@ // required for clone operation deepCopy() } - public SInfoResultFacet(final int idx, final String name, final String description, final String yAxisLabelKey, final ComputeType type, final String stateId, - final String hash) { + public SInfoResultFacet(final int idx, final String name, final String description, final String yAxisLabelKey, final ComputeType type, + final String stateId, final String hash) { super(idx, name, description, type, hash, stateId); this.metaData.put("X", "sinfo.chart.km.xaxis.label"); this.metaData.put("Y", yAxisLabelKey); @@ -47,7 +47,7 @@ final CalculationResult res = (CalculationResult) flys.compute(context, this.hash, this.stateId, this.type, false); - final AbstractCalculationListResults<AbstractCalculationResult> data = (AbstractCalculationListResults<AbstractCalculationResult>) res.getData(); + final AbstractCalculationResults<AbstractCalculationResult> data = (AbstractCalculationResults<AbstractCalculationResult>) res.getData(); return data.getResults().get(this.index); }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -14,12 +14,11 @@ import java.util.Collection; import java.util.List; -import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.common.ExportContextCSV; import org.dive4elements.river.artifacts.common.GeneralResultType; import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; import org.dive4elements.river.artifacts.common.ResultRow; +import org.dive4elements.river.artifacts.sinfo.common.AbstractTkhCalculationResult; import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.sinfo.util.WstInfo; @@ -29,25 +28,26 @@ * * @author Gernot Belger */ -final class FloodDurationCalculationResult extends AbstractCalculationExportableResult { +final class FloodDurationCalculationResult extends AbstractTkhCalculationResult<FloodDurationCalculationResults> { private static final long serialVersionUID = 1L; private final int waterlevelCount; // TODO: ggf 2 verschiedene Result-Klassen? - private final WstInfo wstInfo; + // private final WstInfo wstInfo; private final int maxWaterlevelPdf = 3; private enum ExportMode { pdf, csv } - public FloodDurationCalculationResult(final String label, final WstInfo wstInfo, final Collection<ResultRow> rows, final int waterlevelCount) { - super(label, rows); + public FloodDurationCalculationResult(final String label, final WstInfo wstInfo, final Collection<ResultRow> rows, final boolean hasTkh, + final int waterlevelCount) { + super(label, wstInfo, hasTkh, rows); this.waterlevelCount = waterlevelCount; - this.wstInfo = wstInfo; + // this.wstInfo = wstInfo; } @Override - public void writeCSVHeader(final ExportContextCSV exportContextCSV, final AbstractCalculationResults results, final RiverInfo river) { + public void writeCSVHeader(final ExportContextCSV exportContextCSV, final FloodDurationCalculationResults results, final RiverInfo river) { final Collection<String> header = new ArrayList<>(99); @@ -79,23 +79,22 @@ } @Override - protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV, final AbstractCalculationResults results) { + protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV, final FloodDurationCalculationResults results) { - exportContextCSV.writeCSVWaterlevelMetadata(this.wstInfo); // TODO: Abweichend vom Allgemeinen werden hier andere Felder benötigt bei den - // Wasserspiegellagen + exportContextCSV.writeCSVWaterlevelMetadata(super.getWst()); // -> export in super? -> TODO exportContextCSV.writeBlankLine(); // writer.writeNext(new String[] { "" }); // break line } @Override - protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final AbstractCalculationResults results, final ResultRow row) { + protected String[] formatCSVRow(final ExportContextCSV exportContextCSV, final FloodDurationCalculationResults results, final ResultRow row) { // TODO Auto-generated method stub return formatRow(exportContextCSV, results, row, ExportMode.csv); } @Override - protected String[] formatPDFRow(final ExportContextCSV exportContextCSV, final AbstractCalculationResults results, final ResultRow row) { + protected String[] formatPDFRow(final ExportContextCSV exportContextCSV, final FloodDurationCalculationResults results, final ResultRow row) { return formatRow(exportContextCSV, results, row, ExportMode.pdf); } @@ -109,7 +108,8 @@ } @Override - protected void addJRTableHeader(final ExportContextCSV exportContextCSV, final MetaAndTableJRDataSource source, final AbstractCalculationResults results) { + protected void addJRTableHeader(final ExportContextCSV exportContextCSV, final MetaAndTableJRDataSource source, + final FloodDurationCalculationResults results) { /* column headings */ exportContextCSV.addJRMetadata(source, "station_header", GeneralResultType.station); exportContextCSV.addJRMetadata(source, "riverside_header", SInfoResultType.riverside); @@ -149,7 +149,8 @@ return this.waterlevelCount; } - private String[] formatRow(final ExportContextCSV exportContextCSV, final AbstractCalculationResults results, final ResultRow row, final ExportMode mode) { + private String[] formatRow(final ExportContextCSV exportContextCSV, final FloodDurationCalculationResults results, final ResultRow row, + final ExportMode mode) { final Collection<String> lines = new ArrayList<>(99);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,13 +11,13 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger */ -final class FloodDurationCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<FloodDurationCalculationResults>> { +final class FloodDurationCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<FloodDurationCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Thu Jun 21 14:32:11 2018 +0200 @@ -45,8 +45,9 @@ calculateResultRow(8888.888); calculateResultRow(99); calculateResultRow(77); + final boolean hasTkh = false; // TODO tkh richtig machen, oder anderen result-Type wählen als super-klasse für FloodDurationCalculationResult - final FloodDurationCalculationResult result = new FloodDurationCalculationResult(label, wstInfo, this.rows, 4); + final FloodDurationCalculationResult result = new FloodDurationCalculationResult(label, wstInfo, this.rows, false, 4); final RiverInfo riverInfo = new RiverInfo(this.riverInfoProvider.getRiver());
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/InfrastructureQueryCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/InfrastructureQueryCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,19 +11,19 @@ import java.util.Collection; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; import org.dive4elements.river.artifacts.common.ResultRow; -import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult; /** * Contains the results of a database query of a river infrastructure series * * @author Matthias Schäfer */ -public final class InfrastructureQueryCalculationResult extends AbstractSInfoCalculationResult { +public final class InfrastructureQueryCalculationResult extends AbstractCalculationResult { private static final long serialVersionUID = 1L; public InfrastructureQueryCalculationResult(final String label, final Collection<ResultRow> rows) { - super(label, null, rows); + super(label, rows); } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Thu Jun 21 14:32:11 2018 +0200 @@ -111,8 +111,8 @@ final DischargeValuesFinder dischargeProvider = DischargeValuesFinder.fromKms(wstKms); final River river = riverInfoProvider.getRiver(); - final TkhCalculator tkhCalculator = TkhCalculator.buildTkhCalculator(useTkh, problems, label, river, calcRange, waterlevelProvider, - dischargeProvider, bedHeight); + final TkhCalculator tkhCalculator = TkhCalculator.buildTkhCalculator(useTkh, problems, label, river, calcRange, waterlevelProvider, dischargeProvider, + bedHeight); final FlowDepthCalculator calculator = new FlowDepthCalculator(riverInfoProvider, wspLabel, bedHeight, tkhCalculator); return calculator.execute(label, wstInfo, calcRange);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -12,11 +12,11 @@ import java.util.ArrayList; import java.util.Collection; -import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; import org.dive4elements.river.artifacts.common.ExportContextCSV; import org.dive4elements.river.artifacts.common.GeneralResultType; import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; import org.dive4elements.river.artifacts.common.ResultRow; +import org.dive4elements.river.artifacts.sinfo.common.AbstractTkhCalculationResult; import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; @@ -27,7 +27,8 @@ * * @author Gernot Belger */ -final class FlowDepthCalculationResult extends AbstractCalculationExportableResult<FlowDepthCalculationResults> { + +final class FlowDepthCalculationResult extends AbstractTkhCalculationResult<FlowDepthCalculationResults> { private static final long serialVersionUID = 1L; @@ -38,16 +39,13 @@ private static final String JASPER_FILE = "/jasper/templates/sinfo.flowdepth.jrxml"; // TODO use jrxml-path all over the project private final BedHeightInfo sounding; - private final WstInfo wst; - private final boolean hasTkh; public FlowDepthCalculationResult(final String label, final WstInfo wst, final BedHeightInfo sounding, final boolean hasTkh, final Collection<ResultRow> rows) { - super(label, rows); + super(label, wst, hasTkh, rows); this.sounding = sounding; - this.wst = wst; - this.hasTkh = hasTkh; + } public BedHeightInfo getSounding() { @@ -87,7 +85,7 @@ exportContextCSV.writeBlankLine();// .writeNext(new String[] { "" }); // break line - exportContextCSV.writeCSVWaterlevelMetadata(this.wst); + exportContextCSV.writeCSVWaterlevelMetadata(super.getWst()); // TODO move to super exportContextCSV.writeBlankLine();// .writeNext(new String[] { "" }); // break line @@ -126,10 +124,6 @@ exportContextPDF.addJRMetadata(source, "location_header", SInfoResultType.location); } - public boolean hasTkh() { - return this.hasTkh; - } - private String[] formatRow(final ExportMode mode, final ExportContextCSV exportContextCSV, final FlowDepthCalculationResults results, final ResultRow row) { final Collection<String> lines = new ArrayList<>(11);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,13 +11,14 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger */ -final class FlowDepthCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<FlowDepthCalculationResults>> { + +final class FlowDepthCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<FlowDepthCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -13,13 +13,13 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger */ -final class FlowDepthDevelopmentCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<FlowDepthDevelopmentCalculationResults>> { +final class FlowDepthDevelopmentCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<FlowDepthDevelopmentCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,13 +11,13 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger */ -final class FlowDepthMinMaxCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<FlowDepthMinMaxCalculationResults>> { +final class FlowDepthMinMaxCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<FlowDepthMinMaxCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedchannel/PredefinedChannelQueryCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedchannel/PredefinedChannelQueryCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,19 +11,19 @@ import java.util.Collection; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; import org.dive4elements.river.artifacts.common.ResultRow; -import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult; /** * Contains the results of a database query of a river channel width series * * @author Matthias Schäfer */ -public final class PredefinedChannelQueryCalculationResult extends AbstractSInfoCalculationResult { +public final class PredefinedChannelQueryCalculationResult extends AbstractCalculationResult { private static final long serialVersionUID = 1L; public PredefinedChannelQueryCalculationResult(final String label, final Collection<ResultRow> rows) { - super(label, null, rows); + super(label, rows); } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefineddepthevol/PredefinedDepthEvolQueryCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefineddepthevol/PredefinedDepthEvolQueryCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,19 +11,19 @@ import java.util.Collection; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; import org.dive4elements.river.artifacts.common.ResultRow; -import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult; /** * Contains the results of a database query of a depth evolution series * * @author Matthias Schäfer */ -public final class PredefinedDepthEvolQueryCalculationResult extends AbstractSInfoCalculationResult { +public final class PredefinedDepthEvolQueryCalculationResult extends AbstractCalculationResult { private static final long serialVersionUID = 1L; public PredefinedDepthEvolQueryCalculationResult(final String label, final Collection<ResultRow> rows) { - super(label, null, rows); + super(label, rows); } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthQueryCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthQueryCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,19 +11,19 @@ import java.util.Collection; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; import org.dive4elements.river.artifacts.common.ResultRow; -import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult; /** * Contains the results of a database query of a tkh series * * @author Matthias Schäfer */ -public final class PredefinedFlowDepthQueryCalculationResult extends AbstractSInfoCalculationResult { +public final class PredefinedFlowDepthQueryCalculationResult extends AbstractCalculationResult { private static final long serialVersionUID = 1L; public PredefinedFlowDepthQueryCalculationResult(final String label, final Collection<ResultRow> rows) { - super(label, null, rows); + super(label, rows); } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedtkh/PredefinedTkhQueryCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedtkh/PredefinedTkhQueryCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,19 +11,20 @@ import java.util.Collection; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; import org.dive4elements.river.artifacts.common.ResultRow; -import org.dive4elements.river.artifacts.sinfo.common.AbstractTkhCalculationResult; /** * Contains the results of a database query of a tkh series * * @author Matthias Schäfer */ -final class PredefinedTkhQueryCalculationResult extends AbstractTkhCalculationResult { +class PredefinedTkhQueryCalculationResult extends AbstractCalculationResult { private static final long serialVersionUID = 1L; public PredefinedTkhQueryCalculationResult(final String label, final Collection<ResultRow> rows) { - super(label, null, true, rows); + super(label, rows); } + } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculationResult.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculationResult.java Thu Jun 21 14:32:11 2018 +0200 @@ -12,11 +12,11 @@ import java.util.ArrayList; import java.util.Collection; -import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; import org.dive4elements.river.artifacts.common.ExportContextCSV; import org.dive4elements.river.artifacts.common.GeneralResultType; import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; import org.dive4elements.river.artifacts.common.ResultRow; +import org.dive4elements.river.artifacts.sinfo.common.AbstractTkhCalculationResult; import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.sinfo.util.WstInfo; @@ -26,21 +26,18 @@ * * @author Gernot Belger */ -final class TkhCalculationResult extends AbstractCalculationExportableResult<TkhCalculationResults> { +final class TkhCalculationResult extends AbstractTkhCalculationResult<TkhCalculationResults> { private static final long serialVersionUID = 1L; private static final String JASPER_FILE = "/jasper/templates/sinfo.tkh.jrxml"; - private final boolean hasTkh; - private final WstInfo wst; private enum ExportMode { pdf, csv } public TkhCalculationResult(final String label, final WstInfo wst, final boolean hasTkh, final Collection<ResultRow> rows) { - super(label, rows); - this.hasTkh = hasTkh; - this.wst = wst; + super(label, wst, hasTkh, rows); + } @Override @@ -68,7 +65,7 @@ @Override protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV, final TkhCalculationResults results) { - exportContextCSV.writeCSVWaterlevelMetadata(this.wst); + exportContextCSV.writeCSVWaterlevelMetadata(super.getWst());// TODO: move to super exportContextCSV.writeBlankLine(); }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,13 +11,13 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger */ -final class TkhCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<TkhCalculationResults>> { +final class TkhCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<TkhCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,14 +11,14 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Domenico Nardi Tironi * */ -final class InundationDurationCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<InundationDurationCalculationResults>> { +final class InundationDurationCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<InundationDurationCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,14 +11,14 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Domenico Nardi Tironi * */ -final class SalixLineCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<SalixLineCalculationResults>> { +final class SalixLineCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<SalixLineCalculationResults>> { private static final long serialVersionUID = 1L;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResults.java Thu Jun 21 10:41:55 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResults.java Thu Jun 21 14:32:11 2018 +0200 @@ -11,14 +11,14 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; -import org.dive4elements.river.artifacts.common.AbstractCalculationListResults; +import org.dive4elements.river.artifacts.common.AbstractCalculationResults; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Domenico Nardi Tironi * */ -final class VegetationZonesCalculationResults extends AbstractCalculationListResults<AbstractCalculationExportableResult<VegetationZonesCalculationResults>> { +final class VegetationZonesCalculationResults extends AbstractCalculationResults<AbstractCalculationExportableResult<VegetationZonesCalculationResults>> { private static final long serialVersionUID = 1L;