Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAnalysisResult.java @ 6999:3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 12 Sep 2013 16:35:07 +0200 |
parents | 8efef772a488 |
children | a3f318347707 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
6998:e96d3f6c7c42 | 6999:3e93f29281bc |
---|---|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.artifacts.model.fixings; | 9 package org.dive4elements.river.artifacts.model.fixings; |
10 | |
11 import gnu.trove.TIntObjectHashMap; | |
10 | 12 |
11 import java.util.Collection; | 13 import java.util.Collection; |
12 import java.util.Date; | 14 import java.util.Date; |
13 import java.util.TreeMap; | 15 import java.util.TreeMap; |
14 import java.util.TreeSet; | 16 import java.util.TreeSet; |
54 return result; | 56 return result; |
55 } | 57 } |
56 | 58 |
57 | 59 |
58 public void makeAnalysisEventsUnique() { | 60 public void makeAnalysisEventsUnique() { |
59 // Actually it would be enough to make dates | 61 TIntObjectHashMap dums = new TIntObjectHashMap(); |
60 // unique in one analysis period but to simplify things | 62 |
61 // we make them unique in all periods. | |
62 DateUniqueMaker dum = new DateUniqueMaker(); | |
63 for (KMIndex.Entry<AnalysisPeriod []> entry: analysisPeriods) { | 63 for (KMIndex.Entry<AnalysisPeriod []> entry: analysisPeriods) { |
64 for (AnalysisPeriod ap: entry.getValue()) { | 64 AnalysisPeriod [] aps = entry.getValue(); |
65 for (int i = 0; i < aps.length; ++i) { | |
66 AnalysisPeriod ap = aps[i]; | |
65 QWD [] qwds = ap.getQWDs(); | 67 QWD [] qwds = ap.getQWDs(); |
66 if (qwds != null) { | 68 if (qwds == null) { |
67 for (QWD qwd: qwds) { | 69 continue; |
68 dum.makeUnique(qwd); | 70 } |
69 } | 71 DateUniqueMaker dum = (DateUniqueMaker)dums.get(i); |
72 if (dum == null) { | |
73 dums.put(i, dum = new DateUniqueMaker()); | |
74 } | |
75 for (QWD qwd: qwds) { | |
76 dum.makeUnique(qwd); | |
70 } | 77 } |
71 } | 78 } |
72 } | 79 } |
73 } | 80 } |
74 | 81 |