[PATCH] (issue1448) Make sq time intervals distinct only for non epoch loads
Wald Commits
scm-commit at wald.intevation.org
Fri Jun 19 16:35:17 CEST 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1434724513 -7200
# Node ID 69b0a71b4845a36f0b4100314e05eae340f0a7d1
# Parent c4654863108d5c3237156726f6e4bcdac8bfaf21
(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.
diff -r c4654863108d -r 69b0a71b4845 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java
--- 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);
}
});
diff -r c4654863108d -r 69b0a71b4845 artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java Mon Jun 08 17:39:51 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java Fri Jun 19 16:35:13 2015 +0200
@@ -85,15 +85,13 @@
log.debug("Requested type: " + type + " with sq_ti_id: " + sq_ti_id);
Collection <Load> loads;
if (type.equals("sq_time_intervals")) {
- loads = allLoadData.findUniqueTimeIntervalLoads(fromD, toD);
+ loads = allLoadData.findDistinctSQTimeIntervalNonEpochLoads(fromD, toD);
for (Iterator<Load> it = loads.iterator(); it.hasNext();) {
/* Skip loads without time interval for this info type. */
Load cur = it.next();
if (cur.getSQRelationTimeIntervalId() == null) {
it.remove();
- } else if (cur.isEpoch()) {
- it.remove();
}
}
} else {
More information about the Dive4Elements-commits
mailing list