Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java @ 9094:5488166d32ee
Fixed: major performance bug in tkh calculation leads to many river requests
author | gernotbelger |
---|---|
date | Fri, 25 May 2018 15:41:51 +0200 |
parents | fb9430250899 |
children | ae3565385e6a |
comparison
equal
deleted
inserted
replaced
9093:280c5b44f219 | 9094:5488166d32ee |
---|---|
151 return null; | 151 return null; |
152 } | 152 } |
153 | 153 |
154 final Collection<ResultRow> rows = new ArrayList<>(); | 154 final Collection<ResultRow> rows = new ArrayList<>(); |
155 | 155 |
156 final String waterlevelLabel = descBuilder.getDesc(wkms); | |
157 | |
156 for (final Double stationDbl : allStations) { | 158 for (final Double stationDbl : allStations) { |
157 | 159 |
158 final double station = stationDbl; | 160 final double station = stationDbl; |
159 | 161 |
160 /* find the right calculator (i.e. bed height) depending on station, there should only be one maximal */ | 162 /* find the right calculator (i.e. bed height) depending on station, there should only be one maximal */ |
162 if (tkhCalculator == null) | 164 if (tkhCalculator == null) |
163 continue; | 165 continue; |
164 | 166 |
165 final ResultRow row = ResultRow.create(); | 167 final ResultRow row = ResultRow.create(); |
166 | 168 |
167 row.putValue(SInfoResultType.waterlevelLabel, descBuilder.getDesc(wkms)); | 169 row.putValue(SInfoResultType.waterlevelLabel, waterlevelLabel); |
168 row.putValue(SInfoResultType.gaugeLabel, riverInfoProvider.findGauge(station)); | 170 row.putValue(SInfoResultType.gaugeLabel, riverInfoProvider.findGauge(station)); |
169 row.putValue(SInfoResultType.location, riverInfoProvider.getLocation(station)); | 171 row.putValue(SInfoResultType.location, riverInfoProvider.getLocation(station)); |
170 | 172 |
171 if (tkhCalculator.calculateTkh(station, row)) | 173 if (tkhCalculator.calculateTkh(station, row)) |
172 rows.add(row); | 174 rows.add(row); |