Mercurial > dive4elements > river
changeset 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 | c4654863108d |
children | 5b4bd0680160 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
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); } });
--- 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 {