comparison artifacts/src/main/java/org/dive4elements/river/artifacts/access/HistoricalDischargeAccess.java @ 5914:1058b3436dad

D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 07 May 2013 17:32:33 +0200
parents 59ff03ff48f1
children af13ceeba52a
comparison
equal deleted inserted replaced
5913:37a0f4f7c54f 5914:1058b3436dad
15 15
16 16
17 public class HistoricalDischargeAccess extends RiverAccess { 17 public class HistoricalDischargeAccess extends RiverAccess {
18 18
19 public static enum EvaluationMode { 19 public static enum EvaluationMode {
20 W, Q 20 W(0), Q(1);
21
22 private final int mode;
23
24 EvaluationMode(int mode) {
25 this.mode = mode;
26 }
27
28 public int getMode() {
29 return mode;
30 }
21 } 31 }
22 32
23 public static final String DATA_EVALUATION_TIME = "year_range"; 33 public static final String DATA_EVALUATION_TIME = "year_range";
24 public static final String DATA_EVALUATION_MODE = "historical_mode"; 34 public static final String DATA_EVALUATION_MODE = "historical_mode";
25 public static final String DATA_INPUT_VALUES = "historical_values"; 35 public static final String DATA_INPUT_VALUES = "historical_values";
36 public static final String DATA_REFERENCE_GAUGE = "reference_gauge";
26 37
27 private Timerange evaluationTimerange; 38 private Timerange evaluationTimerange;
28 private EvaluationMode evaluationMode; 39 private EvaluationMode evaluationMode;
29 40
30 private double[] qs; 41 private double[] qs;
31 private double[] ws; 42 private double[] ws;
43
44 private Long officialGaugeNumber;
32 45
33 public HistoricalDischargeAccess(D4EArtifact artifact) { 46 public HistoricalDischargeAccess(D4EArtifact artifact) {
34 super(artifact); 47 super(artifact);
35 } 48 }
36 49
49 } 62 }
50 63
51 return evaluationMode; 64 return evaluationMode;
52 } 65 }
53 66
67
54 /** 68 /**
55 * This method returns the time range specified by <i>year_range</i> 69 * This method returns the time range specified by <i>year_range</i>
56 * parameter. This parameter has to be a string that consists of two long 70 * parameter. This parameter has to be a string that consists of two long
57 * values (time millis since 1970) separated by a ';'. 71 * values (time millis since 1970) separated by a ';'.
58 * 72 *
65 if (startend != null && startend.length > 1) { 79 if (startend != null && startend.length > 1) {
66 Date start = new Date(startend[0]); 80 Date start = new Date(startend[0]);
67 Date end = new Date(startend[1]); 81 Date end = new Date(startend[1]);
68 82
69 evaluationTimerange = new Timerange(start, end); 83 evaluationTimerange = new Timerange(start, end);
84 evaluationTimerange.sort();
70 } 85 }
71 } 86 }
72 87
73 return evaluationTimerange; 88 return evaluationTimerange;
74 } 89 }
112 } 127 }
113 } 128 }
114 129
115 return ws; 130 return ws;
116 } 131 }
132
133 public Long getOfficialGaugeNumber() {
134 if (officialGaugeNumber == null) {
135 officialGaugeNumber = getLong(DATA_REFERENCE_GAUGE);
136 }
137 return officialGaugeNumber;
138 }
117 } 139 }

http://dive4elements.wald.intevation.org