Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java @ 1839:c3b44da22a3a
Minor refactoring in preparation of generation of interpolators (WstValueTable) for static WQKms.
flys-artifacts/trunk@3175 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 07 Nov 2011 12:37:41 +0000 |
parents | ae6ace900c07 |
children | eef657302834 |
rev | line source |
---|---|
1722
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import net.sf.ehcache.Cache; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import net.sf.ehcache.Element; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.apache.log4j.Logger; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import org.hibernate.Session; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import org.hibernate.SQLQuery; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import org.hibernate.type.StandardBasicTypes; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.artifacts.model.WKms; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.artifacts.model.WKmsImpl; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.cache.CacheFactory; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.backend.SessionHolder; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 /** |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 * Factory to access ready-made WKms for other (than computed) 'kinds' of |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 * WST-data. |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 */ |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public class WKmsFactory |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 { |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 private static Logger log = Logger.getLogger(WKmsFactory.class); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 /** Query to get km and ws for wst_id and column_pos. */ |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 public static final String SQL_SELECT_WS = |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 "SELECT km, w FROM wst_w_values " + |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 "WHERE wst_id = :wst_id AND column_pos = :column_pos"; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
35 /** Query to get name for wst_id and column_pos. */ |
1726
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
36 public static final String SQL_SELECT_NAME = |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
37 "SELECT name " + |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
38 "FROM wst_columns "+ |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
39 "WHERE wst_id = :wst_id AND position = :column_pos"; |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
40 |
1722
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 private WKmsFactory() { |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 * Get WKms for given column and wst_id, caring about the cache. |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 */ |
1726
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
49 public static WKms getWKms(int column, int wst_id) { |
1722
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 log.debug("WKmsFactory.getWKms"); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 Cache cache = CacheFactory.getCache(StaticWKmsCacheKey.CACHE_NAME); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 StaticWKmsCacheKey cacheKey; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 if (cache != null) { |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 cacheKey = new StaticWKmsCacheKey(wst_id, column); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 Element element = cache.get(cacheKey); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 if (element != null) { |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 log.debug("Got static wst values from cache"); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 return (WKms)element.getValue(); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 else { |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 cacheKey = null; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 |
1726
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
67 WKms values = getWKmsUncached(column, wst_id); |
1722
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 if (values != null && cacheKey != null) { |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 log.debug("Store static wst values in cache."); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 Element element = new Element(cacheKey, values); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 cache.put(element); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 return values; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
78 /** Get name for a WKms. */ |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
79 public static String getWKmsName(int column, int wst_id) { |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
80 log.debug("WKmsFactory.getWKmsName c/" + column + ", wst_id/" + wst_id); |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
81 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
82 String name = null; |
1722
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 Session session = SessionHolder.HOLDER.get(); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 |
1726
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
85 SQLQuery nameQuery = session.createSQLQuery(SQL_SELECT_NAME) |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
86 .addScalar("name", StandardBasicTypes.STRING); |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
87 nameQuery.setInteger("wst_id", wst_id); |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
88 nameQuery.setInteger("column_pos", column); |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
89 |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
90 List<String> names = nameQuery.list(); |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
91 if (names.size() >= 1) { |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
92 name = names.get(0); |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
93 } |
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
94 |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
95 return name; |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
96 } |
1726
e3b9164a85fe
Fetch name of static WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1722
diff
changeset
|
97 |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
98 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
99 /** |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
100 * Get WKms from db. |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
101 * @param column the position columns value |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
102 * @param wst_id database id of the wst |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
103 * @return according WKms. |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
104 */ |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
105 public static WKms getWKmsUncached(int column, int wst_id) { |
1796
ae6ace900c07
Small loop optimization
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1729
diff
changeset
|
106 |
ae6ace900c07
Small loop optimization
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1729
diff
changeset
|
107 if (log.isDebugEnabled()) { |
ae6ace900c07
Small loop optimization
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1729
diff
changeset
|
108 log.debug("WKmsFactory.getWKmsUncached c/" + column + ", wst_id/" + wst_id); |
ae6ace900c07
Small loop optimization
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1729
diff
changeset
|
109 } |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
110 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
111 WKmsImpl wkms = new WKmsImpl(getWKmsName(column, wst_id)); |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
112 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
113 Session session = SessionHolder.HOLDER.get(); |
1722
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_WS) |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 .addScalar("km", StandardBasicTypes.DOUBLE) |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 .addScalar("w", StandardBasicTypes.DOUBLE); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 sqlQuery.setInteger("wst_id", wst_id); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 sqlQuery.setInteger("column_pos", column); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 List<Object []> results = sqlQuery.list(); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 double kms [] = new double[results.size()]; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 double ws [] = new double[results.size()]; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 int lastColumn = Integer.MAX_VALUE; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 |
1796
ae6ace900c07
Small loop optimization
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1729
diff
changeset
|
127 for (int i = 0, N = results.size(); i < N; i++) { |
1722
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 Object[] row = results.get(i); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 wkms.add((Double) row[0], (Double) row[1]); |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 return wkms; |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 } |
fb4fb1c67c35
Added WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |