comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java @ 3730:487a8cb4a222

FixA: Improved robustness and performance in facet generation for dates. flys-artifacts/trunk@5403 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 08 Sep 2012 14:42:16 +0000
parents e727e3ebdf85
children
comparison
equal deleted inserted replaced
3729:e727e3ebdf85 3730:487a8cb4a222
1 package de.intevation.flys.artifacts.model.fixings; 1 package de.intevation.flys.artifacts.model.fixings;
2 2
3 import java.util.Collection;
3 import java.util.Date; 4 import java.util.Date;
4 import java.util.TreeSet; 5 import java.util.TreeSet;
5 6
6 import de.intevation.flys.artifacts.model.Parameters; 7 import de.intevation.flys.artifacts.model.Parameters;
7 8
38 } 39 }
39 } 40 }
40 return result; 41 return result;
41 } 42 }
42 43
43 public TreeSet<Date> getReferenceEventsDates() { 44 public Collection<Date> getReferenceEventsDates() {
44 TreeSet<Date> dates = new TreeSet<Date>(); 45 TreeSet<Date> dates = new TreeSet<Date>();
45 for (KMIndex.Entry<QWD []> entry: referenced) { 46 for (KMIndex.Entry<QWD []> entry: referenced) {
46 for (int i = 0; i < entry.getValue().length; i++) { 47 QWD [] values = entry.getValue();
47 QWD qwd = entry.getValue()[i]; 48 for (int i = 0; i < values.length; i++) {
48 dates.add(qwd.date); 49 dates.add(values[i].date);
49 } 50 }
50 } 51 }
51 return dates; 52 return dates;
52 } 53 }
53 54
54 public TreeSet<Date> getAnalysisEventsDates(int analysisPeriod) { 55 public Collection<Date> getAnalysisEventsDates(int analysisPeriod) {
55 TreeSet<Date> dates = new TreeSet<Date>(); 56 TreeSet<Date> dates = new TreeSet<Date>();
56 for (KMIndex.Entry<AnalysisPeriod []> entry: analysisPeriods) { 57 for (KMIndex.Entry<AnalysisPeriod []> entry: analysisPeriods) {
57 AnalysisPeriod period = entry.getValue()[analysisPeriod]; 58 QWD [] qwds = entry.getValue()[analysisPeriod].getQWDs();
58 for (int i = 0; i < period.qwds.length; i++) { 59 if (qwds == null) {
59 QWD qwd = period.qwds[i]; 60 continue;
60 dates.add(qwd.date); 61 }
62 for (int i = 0; i < qwds.length; i++) {
63 dates.add(qwds[i].date);
61 } 64 }
62 } 65 }
63 return dates; 66 return dates;
64 } 67 }
65 68

http://dive4elements.wald.intevation.org