comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/HistoricalDischargeAccess.java @ 4233:d952372e7083

Added getQs() and getWs() to HistoricalDischargeAccess class and added some Javadoc to its methods.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 24 Oct 2012 08:04:20 +0200
parents b3aa91e45010
children b195fede1c3b
comparison
equal deleted inserted replaced
4232:b3aa91e45010 4233:d952372e7083
11 public static enum EvaluationMode { 11 public static enum EvaluationMode {
12 W, Q 12 W, Q
13 } 13 }
14 14
15 public static final String DATA_EVALUATION_TIME = "year_range"; 15 public static final String DATA_EVALUATION_TIME = "year_range";
16 public static final String DATA_EVALUATION_MODE = "historical_mode";
17 public static final String DATA_INPUT_VALUES = "historical_values";
16 18
17 private Timerange evaluationTimerange; 19 private Timerange evaluationTimerange;
18 private EvaluationMode evaluationMode; 20 private EvaluationMode evaluationMode;
21
22 private double[] qs;
23 private double[] ws;
19 24
20 public HistoricalDischargeAccess(FLYSArtifact artifact) { 25 public HistoricalDischargeAccess(FLYSArtifact artifact) {
21 super(artifact); 26 super(artifact);
22 } 27 }
23 28
29 /**
30 * This method returns the evaluation mode. The evaluation mode W is set, if
31 * the <b>DATA_EVALUATION_MODE</b> is 0. Otherwise, the evaluation mode Q is
32 * set.
33 *
34 * @return EvaluationMode.W if the parameter <i>historical_mode</i> is set
35 * to 0, otherwise EvaluationMode.Q.
36 */
24 public EvaluationMode getEvaluationMode() { 37 public EvaluationMode getEvaluationMode() {
25 if (evaluationMode == null) { 38 if (evaluationMode == null) {
26 int mode = getInteger("historical_mode"); 39 int mode = getInteger(DATA_EVALUATION_MODE);
27 evaluationMode = mode == 0 ? EvaluationMode.W : EvaluationMode.Q; 40 evaluationMode = mode == 0 ? EvaluationMode.W : EvaluationMode.Q;
28 } 41 }
29 42
30 return evaluationMode; 43 return evaluationMode;
31 } 44 }
32 45
46 /**
47 * This method returns the time range specified by <i>year_range</i>
48 * parameter. This parameter has to be a string that consists of two long
49 * values (time millis since 1970) separated by a ';'.
50 *
51 * @return the evaluation time range specified by <i>year_range</i>.
52 */
33 public Timerange getEvaluationTimerange() { 53 public Timerange getEvaluationTimerange() {
34 if (evaluationTimerange == null) { 54 if (evaluationTimerange == null) {
35 long[] startend = getLongArray(DATA_EVALUATION_TIME); 55 long[] startend = getLongArray(DATA_EVALUATION_TIME);
36 56
37 if (startend != null && startend.length > 1) { 57 if (startend != null && startend.length > 1) {
42 } 62 }
43 } 63 }
44 64
45 return evaluationTimerange; 65 return evaluationTimerange;
46 } 66 }
67
68 /**
69 * This method returns the input Q values if the evaluation mode Q is set.
70 * Otherwise, this method will return a double array of length 0. The values
71 * returned by this method are extracted from string parameter
72 * <i>historical_values</i>.
73 *
74 * @return the input Q values or a double array of length 0.
75 */
76 public double[] getQs() {
77 if (qs == null) {
78 if (getEvaluationMode() == EvaluationMode.Q) {
79 qs = getDoubleArray(DATA_INPUT_VALUES);
80 }
81 else {
82 qs = new double[0];
83 }
84 }
85
86 return qs;
87 }
88
89 /**
90 * This method returns the input W values if the evaluation mode W is set.
91 * Otherwise, this method will return a double array of length 0. The values
92 * returned by this method are extracted from string parameter
93 * <i>historical_values</i>.
94 *
95 * @return the input W values or a double array of length 0.
96 */
97 public double[] getWs() {
98 if (ws == null) {
99 if (getEvaluationMode() == EvaluationMode.W) {
100 ws = getDoubleArray(DATA_INPUT_VALUES);
101 }
102 else {
103 ws = new double[0];
104 }
105 }
106
107 return ws;
108 }
47 } 109 }

http://dive4elements.wald.intevation.org