Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixResult.java @ 9801:1d7a72a50183 3.2.x tip
Assume Compose V2, consistently
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 Nov 2023 10:14:13 +0100 |
parents | 0a5239a1e46e |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3729
diff
changeset
|
9 package org.dive4elements.river.artifacts.model.fixings; |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
9726 | 11 import org.apache.logging.log4j.Logger; |
12 import org.apache.logging.log4j.LogManager; | |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3729
diff
changeset
|
13 import org.dive4elements.river.artifacts.model.Parameters; |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3729
diff
changeset
|
15 import org.dive4elements.river.utils.KMIndex; |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import java.io.Serializable; |
6877
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
18 import java.util.Collection; |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
19 import java.util.Date; |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
20 import java.util.TreeMap; |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
21 import java.util.TreeSet; |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public class FixResult |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 implements Serializable |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 { |
6877
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
26 private static Logger log = |
9726 | 27 LogManager.getLogger(FixResult.class); |
6877
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
28 |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 protected Parameters parameters; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 protected KMIndex<QWD []> referenced; |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3450
diff
changeset
|
31 protected KMIndex<QWI []> outliers; |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 public FixResult() { |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 public FixResult( |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 Parameters parameters, |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 KMIndex<QWD []> referenced, |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3450
diff
changeset
|
39 KMIndex<QWI []> outliers |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 ) { |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 this.parameters = parameters; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 this.referenced = referenced; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 this.outliers = outliers; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 public KMIndex<QWD []> getReferenced() { |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 return referenced; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 public void setReferenced(KMIndex<QWD []> referenced) { |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 this.referenced = referenced; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 |
6877
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
54 public void makeReferenceEventsDatesUnique() { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
55 DateUniqueMaker dum = new DateUniqueMaker(); |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
56 for (KMIndex.Entry<QWD []> entry: referenced) { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
57 for (QWD ref: entry.getValue()) { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
58 dum.makeUnique(ref); |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
59 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
60 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
61 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
62 |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
63 public Collection<Integer> getReferenceEventsIndices() { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
64 TreeMap<Date, Integer> dates = new TreeMap<Date, Integer>(); |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
65 for (KMIndex.Entry<QWD []> entry: referenced) { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
66 for (QWD value: entry.getValue()) { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
67 dates.put(value.date, value.index); |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
68 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
69 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
70 return dates.values(); |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
71 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
72 |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
73 public void remapReferenceIndicesToRank() { |
6891
8efef772a488
FixA: Remapped indices of analysis periods, too. Needs testing!
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6877
diff
changeset
|
74 RankRemapper remapper = new RankRemapper(); |
8efef772a488
FixA: Remapped indices of analysis periods, too. Needs testing!
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6877
diff
changeset
|
75 for (Integer idx: getReferenceEventsIndices()) { |
8efef772a488
FixA: Remapped indices of analysis periods, too. Needs testing!
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6877
diff
changeset
|
76 remapper.toMap(idx); |
6877
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
77 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
78 for (KMIndex.Entry<QWD []> entry: referenced) { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
79 for (QWD value: entry.getValue()) { |
6891
8efef772a488
FixA: Remapped indices of analysis periods, too. Needs testing!
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6877
diff
changeset
|
80 remapper.remap(value); |
6877
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
81 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
82 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
83 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
84 |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
85 public Collection<Date> getReferenceEventsDates() { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
86 TreeSet<Date> dates = new TreeSet<Date>(); |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
87 for (KMIndex.Entry<QWD []> entry: referenced) { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
88 for (QWD qwd: entry.getValue()) { |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
89 dates.add(qwd.date); |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
90 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
91 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
92 return dates; |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
93 } |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
94 |
2d96d8240e3e
FixA: Make dates of analysis periods unique, too. TODO: Remap the indices like the reference interval.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
95 |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3450
diff
changeset
|
96 public KMIndex<QWI []> getOutliers() { |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 return outliers; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3450
diff
changeset
|
100 public void setOutliers(KMIndex<QWI []> outliers) { |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 this.outliers = outliers; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 public Parameters getParameters() { |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 return parameters; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 public void setParameters(Parameters parameters) { |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 this.parameters = parameters; |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 } |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |