[PATCH 3 of 4] (issue1754) Simplify code to handle a>b cases
Wald Commits
scm-commit at wald.intevation.org
Mon Mar 30 19:29:39 CEST 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1427736521 -7200
# Node ID 5f60bd7c4b4222df2155018686706ea914a4314e
# Parent 8e5c026216fd7eaef87883b92816e2485ecd0123
(issue1754) Simplify code to handle a>b cases.
diff -r 8e5c026216fd -r 5f60bd7c4b42 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Mon Mar 30 19:27:11 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Mon Mar 30 19:28:41 2015 +0200
@@ -37,23 +37,12 @@
this.river = access.getRiverName();
this.heightIds = access.extractHeightIds(context);
- double from = access.getFrom();
- double to = access.getTo();
- double start;
- double end;
-
- if ((!Double.isNaN(from) && !Double.isNaN(to)) && from > to) {
- log.debug("Reordering range.");
- start = to;
- end = from;
- } else {
- start = from;
- end = to;
- }
+ double from = access.getFrom(true);
+ double to = access.getTo(true);
BedDiffYearResult [] results = new BedDiffYearResult[heightIds.length];
for (int i = 0; i < heightIds.length; i++) {
- BedHeightData [] pair = getHeightPair(heightIds[i], start, end);
+ BedHeightData [] pair = getHeightPair(heightIds[i], from, to);
if (pair[0].getYear() == null || pair[1].getYear() == null) {
addProblem("beddiff.missing.year");
}
diff -r 8e5c026216fd -r 5f60bd7c4b42 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java Mon Mar 30 19:27:11 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WDifferencesState.java Mon Mar 30 19:28:41 2015 +0200
@@ -194,10 +194,8 @@
WINFOArtifact winfo = (WINFOArtifact) artifact;
String id = getID();
RangeAccess rangeAccess = new RangeAccess(artifact);
- double from = rangeAccess.getFrom();
- double to = rangeAccess.getTo();
- double start;
- double end;
+ double from = rangeAccess.getFrom(true);
+ double to = rangeAccess.getTo(true);
// Load the Artifacts/facets that we want to subtract and display.
// Expected format is:
// [42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;0]#[1231f2-....]
@@ -207,15 +205,6 @@
log.debug("Difference from: " + from + " to: " + to);
/* Check if we need to obtain the data in a different order */
- if ((!Double.isNaN(from) && !Double.isNaN(to)) && from > to) {
- log.debug("Reordering range.");
- start = to;
- end = from;
- } else {
- start = from;
- end = to;
- }
-
// Validate the Data-Strings.
for (String s: datas) {
if (!WaterlevelSelectState.isValueValid(s)) {
@@ -233,9 +222,9 @@
// e.g.:
// 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1
WKms minuendWKms = getWKms(StringUtil.unbracket(datas[i+0]),
- context, start, end);
+ context, from, to);
WKms subtrahendWKms = getWKms(StringUtil.unbracket(datas[i+1]),
- context, start, end);
+ context, from, to);
String facetName = "diff ()";
String minName = "min";
More information about the Dive4Elements-commits
mailing list