1 |
package dk.daoas.daoadresseservice; |
package dk.daoas.daoadresseservice; |
2 |
|
|
3 |
import java.sql.SQLException; |
import java.sql.SQLException; |
4 |
|
import java.text.SimpleDateFormat; |
5 |
import java.util.ArrayList; |
import java.util.ArrayList; |
6 |
import java.util.Collections; |
import java.util.Collections; |
7 |
|
import java.util.Date; |
8 |
import java.util.HashMap; |
import java.util.HashMap; |
9 |
import java.util.HashSet; |
import java.util.HashSet; |
10 |
import java.util.List; |
import java.util.List; |
14 |
|
|
15 |
import dk.daoas.daoadresseservice.AddressUtils.SplitResult; |
import dk.daoas.daoadresseservice.AddressUtils.SplitResult; |
16 |
import dk.daoas.daoadresseservice.beans.Address; |
import dk.daoas.daoadresseservice.beans.Address; |
17 |
|
import dk.daoas.daoadresseservice.beans.DataStatisticsBean; |
18 |
import dk.daoas.daoadresseservice.beans.ExtendedBean; |
import dk.daoas.daoadresseservice.beans.ExtendedBean; |
19 |
import dk.daoas.daoadresseservice.beans.HundredePctBean; |
import dk.daoas.daoadresseservice.beans.HundredePctBean; |
20 |
import dk.daoas.daoadresseservice.beans.SearchResult; |
import dk.daoas.daoadresseservice.beans.SearchResult; |
30 |
|
|
31 |
private Map<String,Long> helperCache; |
private Map<String,Long> helperCache; |
32 |
|
|
33 |
|
private DataStatisticsBean stats = new DataStatisticsBean(); |
34 |
|
|
35 |
|
|
36 |
public SearchResult search(String postnrStr, String adresse) { |
public SearchResult search(String postnrStr, String adresse) { |
264 |
long stop = System.currentTimeMillis(); |
long stop = System.currentTimeMillis(); |
265 |
System.out.println("Build, stage3 elapsed: " + (stop-start3) ); |
System.out.println("Build, stage3 elapsed: " + (stop-start3) ); |
266 |
System.out.println("Build -- Gathering statistics"); |
System.out.println("Build -- Gathering statistics"); |
267 |
|
|
|
int direkteCount = 0; |
|
|
int extendedCount = 0; |
|
|
int hundredePctCount = 0; |
|
|
int ikkeDaekketCount = 0; |
|
|
|
|
268 |
for (Address addr : alleAdresser) { |
for (Address addr : alleAdresser) { |
269 |
switch (addr.daekningsType) { |
switch (addr.daekningsType) { |
270 |
case DAEKNING_DIREKTE: |
case DAEKNING_DIREKTE: |
271 |
direkteCount++; |
stats.direkteCount++; |
272 |
break; |
break; |
273 |
case DAEKNING_UDVIDET: |
case DAEKNING_UDVIDET: |
274 |
extendedCount++; |
stats.extendedCount++; |
275 |
break; |
break; |
276 |
case DAEKNING_100PCT: |
case DAEKNING_100PCT: |
277 |
hundredePctCount++; |
stats.hundredePctCount++; |
278 |
break; |
break; |
279 |
default: |
default: |
280 |
ikkeDaekketCount++; |
stats.ikkeDaekketCount++; |
281 |
} |
} |
282 |
} |
} |
283 |
|
|
284 |
|
|
285 |
System.out.println("Build: direkteCount: " + direkteCount); |
stats.elapsed = stop-start1; |
286 |
System.out.println("Build: extendedCount: " + extendedCount); |
stats.buildTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( new Date() ); |
287 |
System.out.println("Build: hundredePctCount: " + hundredePctCount); |
|
288 |
System.out.println("Build: ikkeDaekketCount: " + ikkeDaekketCount); |
System.out.println("Build: direkteCount: " + stats.direkteCount); |
289 |
|
System.out.println("Build: extendedCount: " + stats.extendedCount); |
290 |
|
System.out.println("Build: hundredePctCount: " + stats.hundredePctCount); |
291 |
|
System.out.println("Build: ikkeDaekketCount: " + stats.ikkeDaekketCount); |
292 |
|
|
293 |
System.out.println("Build: Total Elapsed: " + (stop-start1) ); |
System.out.println("Build: Total Elapsed: " + (stop-start1) ); |
294 |
System.out.println("Build Completed"); |
System.out.println("Build Completed"); |
295 |
|
|
296 |
} |
} |
297 |
|
|
298 |
|
public DataStatisticsBean getStatistics() { |
299 |
|
return stats; |
300 |
|
} |
301 |
|
|
302 |
|
public void clear() { |
303 |
|
searchPostnrVejnavnGadeid.clear(); |
304 |
|
searchGadeidentAdresser.clear(); |
305 |
|
alleAdresser.clear(); |
306 |
|
helperCache.clear(); |
307 |
|
} |
308 |
|
|
309 |
|
|
310 |
private String calculateExtendedDaoRoute(ExtendedBean eb, Address orgAddress, Address targetAddress) { |
private String calculateExtendedDaoRoute(ExtendedBean eb, Address orgAddress, Address targetAddress) { |
311 |
|
|