optimization csize
This commit is contained in:
parent
c322bbd53b
commit
989720ffaa
1 changed files with 5 additions and 7 deletions
|
@ -870,13 +870,14 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
|
||||||
}
|
}
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (; j < cities.size(); j++) {
|
int csize = cities.size();
|
||||||
|
for (; j < csize; j++) {
|
||||||
City c = cities.get(j);
|
City c = cities.get(j);
|
||||||
if (c.getType() != CityType.CITY && c.getType() != CityType.TOWN) {
|
if (c.getType() != CityType.CITY && c.getType() != CityType.TOWN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
progress.startTask(Messages.getString("IndexCreator.SERIALIZING_ADRESS"), j + ((cities.size() - j) / 100 + 1)); //$NON-NLS-1$
|
progress.startTask(Messages.getString("IndexCreator.SERIALIZING_ADRESS"), j + ((csize - j) / 100 + 1)); //$NON-NLS-1$
|
||||||
|
|
||||||
Map<String, Set<Street>> postcodes = new TreeMap<String, Set<Street>>();
|
Map<String, Set<Street>> postcodes = new TreeMap<String, Set<Street>>();
|
||||||
boolean writeCities = true;
|
boolean writeCities = true;
|
||||||
|
@ -891,7 +892,7 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
|
||||||
|
|
||||||
// write cities and after villages
|
// write cities and after villages
|
||||||
writer.startCityIndexes(false);
|
writer.startCityIndexes(false);
|
||||||
for (int i = 0; i < cities.size(); i++) {
|
for (int i = 0; i < csize; i++) {
|
||||||
City c = cities.get(i);
|
City c = cities.get(i);
|
||||||
List<City> listSuburbs = null;
|
List<City> listSuburbs = null;
|
||||||
for (City suburb : suburbs) {
|
for (City suburb : suburbs) {
|
||||||
|
@ -904,7 +905,7 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
|
||||||
}
|
}
|
||||||
if (writeCities) {
|
if (writeCities) {
|
||||||
progress.progress(1);
|
progress.progress(1);
|
||||||
} else if ((cities.size() - i) % 100 == 0) {
|
} else if ((csize - i) % 100 == 0) {
|
||||||
progress.progress(1);
|
progress.progress(1);
|
||||||
}
|
}
|
||||||
if (writeCities && c.getType() != CityType.CITY && c.getType() != CityType.TOWN) {
|
if (writeCities && c.getType() != CityType.CITY && c.getType() != CityType.TOWN) {
|
||||||
|
@ -1166,7 +1167,4 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
|
||||||
stat.close();
|
stat.close();
|
||||||
return cities;
|
return cities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue