# HG changeset patch # User Tom Gottfried # Date 1409144514 -7200 # Node ID 52504fc2cd588646911ad248bac09c503d4ea2c1 # Parent 8eeb4b717dcae1f71e5744da57d2a761c6312eec Calculate all single years in given interval but only once. diff -r 8eeb4b717dca -r 52504fc2cd58 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java Tue Aug 26 17:21:42 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java Wed Aug 27 15:01:54 2014 +0200 @@ -253,7 +253,10 @@ SedimentDensity sd = getSedimentDensity(); - for (int year: years) { + int min = Math.min(years[0], years[1]); + int max = Math.max(years[0], years[1]); + + for (int year = min; year <= max; ++year) { Value.Filter filter = new And(notEpochs) .add(new TimeRangeIntersects(year)); String period = Integer.toString(year); @@ -277,6 +280,9 @@ sldr.addFraction(sldrf); } + + // Do not give single year twice + if (min == max) break; } // TODO: Generate messages for missing fractions. return new CalculationResult(sldr, this);