Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/model/Gauge.java @ 6327:447ed3dee890
Backend: removed scale factor from min/max value determination of gauge Ws.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 13 Jun 2013 13:12:48 +0200 |
parents | 4c3ccf2b0304 |
children | a895eb07a7dc |
comparison
equal
deleted
inserted
replaced
6326:5c880567a020 | 6327:447ed3dee890 |
---|---|
37 @Table(name = "gauges") | 37 @Table(name = "gauges") |
38 public class Gauge | 38 public class Gauge |
39 implements Serializable, Comparable<Gauge> | 39 implements Serializable, Comparable<Gauge> |
40 { | 40 { |
41 private static final Logger log = Logger.getLogger(Gauge.class); | 41 private static final Logger log = Logger.getLogger(Gauge.class); |
42 | |
43 public static final int DEFAULT_SCALE = 100; | |
44 | 42 |
45 public static final int MASTER_DISCHARGE_TABLE = 0; | 43 public static final int MASTER_DISCHARGE_TABLE = 0; |
46 | 44 |
47 private Integer id; | 45 private Integer id; |
48 private String name; | 46 private String name; |
171 this.dischargeTables = dischargeTables; | 169 this.dischargeTables = dischargeTables; |
172 } | 170 } |
173 | 171 |
174 | 172 |
175 /** | 173 /** |
176 * Returns min and max W values of this gauge based with a DEFAULT_SCALE. | |
177 * | |
178 * @return min and max W value of this gauge [min,max]. | |
179 */ | |
180 public double[] determineMinMaxW() { | |
181 return determineMinMaxW(DEFAULT_SCALE); | |
182 } | |
183 | |
184 | |
185 /** | |
186 * Returns min and max W values of this gauge. | 174 * Returns min and max W values of this gauge. |
187 * | 175 * |
188 * @return the min and max W value of this gauge [min,max]. | 176 * @return the min and max W value of this gauge [min,max]. |
189 */ | 177 */ |
190 public double[] determineMinMaxW(int scale) { | 178 public double[] determineMinMaxW() { |
191 Session session = SessionHolder.HOLDER.get(); | 179 Session session = SessionHolder.HOLDER.get(); |
192 | 180 |
193 List<DischargeTable> tables = getDischargeTables(); | 181 List<DischargeTable> tables = getDischargeTables(); |
194 DischargeTable dischargeTable = null; | 182 DischargeTable dischargeTable = null; |
195 | 183 |
219 | 207 |
220 BigDecimal a = (BigDecimal)result[0]; | 208 BigDecimal a = (BigDecimal)result[0]; |
221 BigDecimal b = (BigDecimal)result[1]; | 209 BigDecimal b = (BigDecimal)result[1]; |
222 | 210 |
223 return a != null && b != null | 211 return a != null && b != null |
224 ? new double [] { a.doubleValue()*scale, b.doubleValue()*scale } | 212 ? new double [] { a.doubleValue(), b.doubleValue() } |
225 : null; | 213 : null; |
226 } | 214 } |
227 | 215 |
228 @OneToMany | 216 @OneToMany |
229 @JoinColumn(name = "gauge_id") | 217 @JoinColumn(name = "gauge_id") |