Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java @ 7919:868f55932fe6
Removed serverside path for bed height epochs.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 06 Jun 2014 16:59:16 +0200 |
parents | 1aba75321441 |
children | b5cba2690347 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Fri Jun 06 16:47:48 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Fri Jun 06 16:59:16 2014 +0200 @@ -29,7 +29,6 @@ Logger.getLogger(BedDiffCalculation.class); protected String river; - protected String yearEpoch; protected int [][] heightIds; public BedDiffCalculation() { @@ -39,7 +38,6 @@ logger.info("BedDiffCalculation.calculate"); String river = access.getRiverName(); - String yearEpoch = access.getYearEpoch(); int [][] heightIds = access.extractHeightIds(context); if (river == null) { @@ -47,13 +45,8 @@ addProblem("minfo.missing.river"); } - if (yearEpoch == null) { - addProblem("minfo.missing.year_epoch"); - } - if (!hasProblems()) { this.river = river; - this.yearEpoch = yearEpoch; this.heightIds = heightIds; return internalCalculate(); } @@ -62,7 +55,6 @@ } private CalculationResult internalCalculate() { - BedDiffYearResult [] results = new BedDiffYearResult[heightIds.length]; for (int i = 0; i < heightIds.length; i++) { @@ -70,21 +62,6 @@ results[i] = calculateYearDifference(pair); } return new CalculationResult(results, this); - // Currently epochs are handled like single years. To handle epochs - // uncomment the follwing code and use an if-clause in the code above. -/* - if (yearEpoch.equals("epoch")) { - BedDiffEpochResult [] results = new BedDiffEpochResult[heightIds.length]; - - for (int i = 0; i < heightIds.length; i++) { - BedHeight[] pair = getHeightPair(heightIds[i], "epoch"); - results[i] = calculateEpochDifference(pair); - } - return new CalculationResult(results, this); - } - - return new CalculationResult(); - */ } /** Get two BedHeights from factory. */ @@ -95,36 +72,6 @@ }; } - private BedDiffEpochResult calculateEpochDifference(BedHeightData[] pair) { - - BedHeightData bh1 = pair[0]; - BedHeightData bh2 = pair[1]; - - TDoubleArrayList stations = bh1.getStations(); - int size = stations.size(); - - TDoubleArrayList diffRes = new TDoubleArrayList(size); - TDoubleArrayList kms = new TDoubleArrayList(size); - TDoubleArrayList heights1 = new TDoubleArrayList(size); - TDoubleArrayList heights2 = new TDoubleArrayList(size); - - for (int i = 0; i < size; i++) { - double station = stations.getQuick(i); - double h1 = bh1.getHeight(station); - double h2 = bh2.getHeight(station); - double hDiff = h1 - h2; - if (!Double.isNaN(hDiff)) { - diffRes.add(hDiff); - kms.add(station); - heights1.add(h1); - heights2.add(h2); - } - } - Date start = ((BedHeightEpochData)bh1).getStart(); - Date end = ((BedHeightEpochData)bh2).getEnd(); - return new BedDiffEpochResult(kms, diffRes, heights1, heights2, start, end); - } - private BedDiffYearResult calculateYearDifference(BedHeightData[] pair) { logger.debug("BedDiffCalculation.calculateYearDifference"); BedHeightSingleData s1 = (BedHeightSingleData) pair[0];