diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java @ 8750:69b0a71b4845

(issue1448) Make sq time intervals distinct only for non epoch loads Previously it was random if the loads choosen to be part of the distinct sq time interval loads set were epoch loads or not. This led to wrong results beeing removed in the isEpoch check afterwards.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 19 Jun 2015 16:35:13 +0200
parents 301a32bd7045
children d0f2250b5521
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Mon Jun 08 17:39:51 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Fri Jun 19 16:35:13 2015 +0200
@@ -232,6 +232,20 @@
             }
         }
 
+        public void allNonEpochLoads(Collection<Load> loads) {
+            for (List<Value> values: grainFractions) {
+                if (values != null) {
+                    for (Value value: values) {
+                        Load load = value.getLoad();
+                        if (load.isEpoch()) {
+                            continue;
+                        }
+                        loads.add(value.getLoad());
+                    }
+                }
+            }
+        }
+
         public void allOfficialLoads(Collection<Load> loads) {
             for (List<Value> values: grainFractions) {
                 if (values != null) {
@@ -536,13 +550,13 @@
      *
      * This is mainly a convenience function for the SedimentLoadInfoService.
      */
-    public Collection<Load> findUniqueTimeIntervalLoads(double a, double b) {
+    public Collection<Load> findDistinctSQTimeIntervalNonEpochLoads(double a, double b) {
         final TreeSet<Load> loads = new TreeSet<Load>(LOAD_SQ_TI_CMP);
 
         findStations(a, b, new Visitor() {
             @Override
             public void visit(Station station) {
-                station.allLoads(loads);
+                station.allNonEpochLoads(loads);
             }
         });
 

http://dive4elements.wald.intevation.org