comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java @ 1796:ae6ace900c07

Small loop optimization flys-artifacts/trunk@3119 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 31 Oct 2011 10:01:08 +0000
parents 2e5ebdeb8af9
children eef657302834
comparison
equal deleted inserted replaced
1795:fe7f9264a2ed 1796:ae6ace900c07
101 * @param column the position columns value 101 * @param column the position columns value
102 * @param wst_id database id of the wst 102 * @param wst_id database id of the wst
103 * @return according WKms. 103 * @return according WKms.
104 */ 104 */
105 public static WKms getWKmsUncached(int column, int wst_id) { 105 public static WKms getWKmsUncached(int column, int wst_id) {
106 log.debug("WKmsFactory.getWKmsUncached c/" + column + ", wst_id/" + wst_id); 106
107 if (log.isDebugEnabled()) {
108 log.debug("WKmsFactory.getWKmsUncached c/" + column + ", wst_id/" + wst_id);
109 }
107 110
108 WKmsImpl wkms = new WKmsImpl(getWKmsName(column, wst_id)); 111 WKmsImpl wkms = new WKmsImpl(getWKmsName(column, wst_id));
109 112
110 Session session = SessionHolder.HOLDER.get(); 113 Session session = SessionHolder.HOLDER.get();
111 SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_WS) 114 SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_WS)
119 double kms [] = new double[results.size()]; 122 double kms [] = new double[results.size()];
120 double ws [] = new double[results.size()]; 123 double ws [] = new double[results.size()];
121 124
122 int lastColumn = Integer.MAX_VALUE; 125 int lastColumn = Integer.MAX_VALUE;
123 126
124 for (int i = 0; i < results.size(); i++) { 127 for (int i = 0, N = results.size(); i < N; i++) {
125 Object[] row = results.get(i); 128 Object[] row = results.get(i);
126 wkms.add((Double) row[0], (Double) row[1]); 129 wkms.add((Double) row[0], (Double) row[1]);
127 } 130 }
128 131
129 return wkms; 132 return wkms;

http://dive4elements.wald.intevation.org