Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java @ 3647:421d1b0576b8
Removed deprecated method.
flys-artifacts/trunk@5370 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 07 Sep 2012 09:10:32 +0000 |
parents | 3e1149adc8b9 |
children | db6bb4c1f41f |
comparison
equal
deleted
inserted
replaced
3646:3e1149adc8b9 | 3647:421d1b0576b8 |
---|---|
28 "from MainValue where gauge=:gauge"); | 28 "from MainValue where gauge=:gauge"); |
29 query.setParameter("gauge", gauge); | 29 query.setParameter("gauge", gauge); |
30 | 30 |
31 return query.list(); | 31 return query.list(); |
32 } | 32 } |
33 | |
34 | |
35 /** | |
36 * Returns an array of [days, qs] necessary to create duration curves. | |
37 * | |
38 * @param gauge The selected gauge. | |
39 * @deprecated | |
40 * | |
41 * @return a 2dim array of [days, qs] where days is an int[] and qs is | |
42 * an double[]. | |
43 */ | |
44 @Deprecated | |
45 public static Object[] getDurationCurveData(Gauge gauge) { | |
46 Session session = SessionHolder.HOLDER.get(); | |
47 | |
48 Query query = session.createQuery( | |
49 "select cast(nmv.name as integer) as days, mv.value as q " + | |
50 "from MainValue as mv " + | |
51 "join mv.mainValue as nmv " + | |
52 "join nmv.type mvt " + | |
53 "where mvt.name = 'D' and mv.gauge.id = :gauge_id " + | |
54 "order by days"); | |
55 | |
56 query.setParameter("gauge_id", gauge.getId()); | |
57 | |
58 List<Object> results = query.list(); | |
59 int[] days = new int[results.size()]; | |
60 double[] qs = new double[results.size()]; | |
61 | |
62 int idx = 0; | |
63 | |
64 for (Object obj: results) { | |
65 Object[] arr = (Object[]) obj; | |
66 | |
67 try { | |
68 int day = ((Integer) arr[0]).intValue(); | |
69 double q = ((BigDecimal) arr[1]).doubleValue(); | |
70 | |
71 days[idx] = day; | |
72 qs[idx++] = q; | |
73 } | |
74 catch (NumberFormatException nfe) { | |
75 logger.warn(nfe, nfe); | |
76 } | |
77 } | |
78 | |
79 return new Object[] { days, qs }; | |
80 } | |
81 } | 33 } |
82 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 34 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |