Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java @ 7605:f51c943c707a
(issue1560) Fix off by one error in ATWriter causing the last value to be omitted.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 27 Nov 2013 17:17:54 +0100 |
parents | 3ac657d60e60 |
children | e4606eae8ea5 |
comparison
equal
deleted
inserted
replaced
7604:05549a84ee83 | 7605:f51c943c707a |
---|---|
168 // constant function | 168 // constant function |
169 qFunc = new PolynomialFunction(new double [] { minQ }); | 169 qFunc = new PolynomialFunction(new double [] { minQ }); |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 double [] ws = new double[bounds[1]-bounds[0]]; | 173 /* example: bounds[0] = 0 |
174 * bounds[1] = 5 -> we need to store 6 values.*/ | |
175 | |
176 double [] ws = new double[bounds[1]-bounds[0] + 1]; | |
174 double [] qs = new double[ws.length]; | 177 double [] qs = new double[ws.length]; |
175 | 178 |
176 for (int i = 0; i < ws.length; ++i) { | 179 for (int i = 0; i < ws.length; i++) { |
177 int idx = bounds[0]+i; | 180 int idx = bounds[0]+i; |
178 ws[i] = wq.getW(idx); | 181 ws[i] = wq.getW(idx); |
179 qs[i] = wq.getQ(idx); | 182 qs[i] = wq.getQ(idx); |
180 } | 183 } |
181 | 184 |
211 logger.debug("rest: " + rest); | 214 logger.debug("rest: " + rest); |
212 logger.debug("maxW: " + maxW); | 215 logger.debug("maxW: " + maxW); |
213 } | 216 } |
214 | 217 |
215 int col = 0; | 218 int col = 0; |
216 for (int w = startW; w < maxW; w++) { | 219 for (int w = startW; w <= maxW; w++) { |
217 if (col == 0) { | 220 if (col == 0) { |
218 out.printf(Locale.US, "%8d", w); | 221 out.printf(Locale.US, "%8d", w); |
219 } | 222 } |
220 | 223 |
221 if (w < minW) { | 224 if (w < minW) { |