Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/AnalysisPeriod.java @ 9415:9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
The facets also put the valid station range into their xml-metadata
author | gernotbelger |
---|---|
date | Thu, 16 Aug 2018 16:27:53 +0200 |
parents | af13ceeba52a |
children |
comparison
equal
deleted
inserted
replaced
9414:096f151a0a9f | 9415:9744ce3c3853 |
---|---|
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 | 10 |
11 import java.io.Serializable; | |
12 | |
11 import org.dive4elements.river.artifacts.model.DateRange; | 13 import org.dive4elements.river.artifacts.model.DateRange; |
12 | 14 |
13 import java.io.Serializable; | 15 public class AnalysisPeriod implements Serializable { |
14 | 16 |
15 public class AnalysisPeriod | 17 private static final long serialVersionUID = 1L; |
16 implements Serializable | 18 |
17 { | 19 private DateRange dateRange; |
18 protected DateRange dateRange; | 20 |
19 protected QWD [] qwds; | 21 private QWD[] qSectorAverages; |
20 protected QWD [] qSectorAverages; | 22 |
21 protected double [] qSectorStdDevs; | 23 private double[] qSectorStdDevs; |
24 | |
25 private double maxQ; | |
22 | 26 |
23 public AnalysisPeriod() { | 27 public AnalysisPeriod() { |
24 } | 28 } |
25 | 29 |
26 public AnalysisPeriod(DateRange dateRange) { | 30 public AnalysisPeriod(final DateRange dateRange, final QWD[] qSectorAverages, final double[] qSectorStdDevs, final double maxQ) { |
27 this.dateRange = dateRange; | 31 this.dateRange = dateRange; |
28 } | |
29 | |
30 public AnalysisPeriod(DateRange dateRange, QWD [] qwds) { | |
31 this(dateRange); | |
32 this.dateRange = dateRange; | |
33 this.qwds = qwds; | |
34 } | |
35 | |
36 public AnalysisPeriod( | |
37 DateRange dateRange, | |
38 QWD [] qwds, | |
39 QWD [] qSectorAverages, | |
40 double [] qSectorStdDevs | |
41 ) { | |
42 this(dateRange, qwds); | |
43 this.qSectorAverages = qSectorAverages; | 32 this.qSectorAverages = qSectorAverages; |
44 this.qSectorStdDevs = qSectorStdDevs; | 33 this.qSectorStdDevs = qSectorStdDevs; |
34 this.maxQ = maxQ; | |
45 } | 35 } |
46 | 36 |
47 public DateRange getDateRange() { | 37 public DateRange getDateRange() { |
48 return dateRange; | 38 return this.dateRange; |
49 } | 39 } |
50 | 40 |
51 public void setDateRange(DateRange dateRange) { | 41 public QWD[] getQSectorAverages() { |
52 this.dateRange = dateRange; | 42 return this.qSectorAverages; |
53 } | 43 } |
54 | 44 |
55 public QWD [] getQWDs() { | 45 public QWD getQSectorAverage(final int i) { |
56 return qwds; | 46 return this.qSectorAverages[i]; |
57 } | 47 } |
58 | 48 |
59 public void setQWDs(QWD [] qwds) { | 49 public double getQSectorStdDev(final int i) { |
60 this.qwds = qwds; | 50 return this.qSectorStdDevs[i]; |
61 } | |
62 | |
63 public QWD [] getQSectorAverages() { | |
64 return qSectorAverages; | |
65 } | |
66 | |
67 public void setQSectorAverages(QWD [] qSectorAverages) { | |
68 this.qSectorAverages = qSectorAverages; | |
69 } | |
70 | |
71 public QWD getQSectorAverage(int i) { | |
72 return qSectorAverages[i]; | |
73 } | |
74 | |
75 public double [] getQSectorStdDevs() { | |
76 return qSectorStdDevs; | |
77 } | |
78 | |
79 public void setQSectorStdDevs(double [] qSectorStdDevs) { | |
80 this.qSectorStdDevs = qSectorStdDevs; | |
81 } | |
82 | |
83 public double getQSectorStdDev(int i) { | |
84 return qSectorStdDevs[i]; | |
85 } | 51 } |
86 | 52 |
87 public double getMaxQ() { | 53 public double getMaxQ() { |
88 double maxQ = -Double.MAX_VALUE; | 54 return this.maxQ; |
89 if (qwds != null) { | |
90 for (QWD qwd: qwds) { | |
91 if (qwd.getQ() > maxQ) { | |
92 maxQ = qwd.getQ(); | |
93 } | |
94 } | |
95 } | |
96 if (qSectorAverages != null) { | |
97 for (QWD qwd: qSectorAverages) { | |
98 if (qwd != null && qwd.getQ() > maxQ) { | |
99 maxQ = qwd.getQ(); | |
100 } | |
101 } | |
102 } | |
103 return maxQ; | |
104 } | 55 } |
105 } | 56 } |
106 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |