Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java @ 4357:11cf29eb002c
FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 11:58:11 +0100 |
parents | 487a8cb4a222 |
children |
rev | line source |
---|---|
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.fixings; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
3730
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
3 import java.util.Collection; |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
4 import java.util.Date; |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
5 import java.util.TreeSet; |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
6 |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.model.Parameters; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.utils.KMIndex; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 public class FixAnalysisResult |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3415
diff
changeset
|
12 extends FixResult |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 protected KMIndex<AnalysisPeriod []> analysisPeriods; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 public FixAnalysisResult() { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public FixAnalysisResult( |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 Parameters parameters, |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 KMIndex<QWD []> referenced, |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3612
diff
changeset
|
22 KMIndex<QWI []> outliers, |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 KMIndex<AnalysisPeriod []> analysisPeriods |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 ) { |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3415
diff
changeset
|
25 super(parameters, referenced, outliers); |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 this.analysisPeriods = analysisPeriods; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 public int getUsedSectorsInAnalysisPeriods() { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 int result = 0; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 for (KMIndex.Entry<AnalysisPeriod []> entry: analysisPeriods) { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 for (AnalysisPeriod period: entry.getValue()) { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 for (int i = 0; i < 4; ++i) { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 result |= period.getQSectorAverage(i) != null |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 ? (1 << i) |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 : 0; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 // XXX: Stop early on result == ~(~0 << 4)) ? |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 return result; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
3730
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
44 public Collection<Date> getReferenceEventsDates() { |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
45 TreeSet<Date> dates = new TreeSet<Date>(); |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
46 for (KMIndex.Entry<QWD []> entry: referenced) { |
3730
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
47 QWD [] values = entry.getValue(); |
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
48 for (int i = 0; i < values.length; i++) { |
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
49 dates.add(values[i].date); |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
50 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
51 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
52 return dates; |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
53 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
54 |
3730
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
55 public Collection<Date> getAnalysisEventsDates(int analysisPeriod) { |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
56 TreeSet<Date> dates = new TreeSet<Date>(); |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
57 for (KMIndex.Entry<AnalysisPeriod []> entry: analysisPeriods) { |
3730
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
58 QWD [] qwds = entry.getValue()[analysisPeriod].getQWDs(); |
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
59 if (qwds == null) { |
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
60 continue; |
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
61 } |
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
62 for (int i = 0; i < qwds.length; i++) { |
487a8cb4a222
FixA: Improved robustness and performance in facet generation for dates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3729
diff
changeset
|
63 dates.add(qwds[i].date); |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
64 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
65 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
66 return dates; |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
67 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3450
diff
changeset
|
68 |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 public KMIndex<AnalysisPeriod []> getAnalysisPeriods() { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 return analysisPeriods; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 public void setAnalysisPeriods(KMIndex<AnalysisPeriod []> analysisPeriods) { |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 this.analysisPeriods = analysisPeriods; |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 } |
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |