diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java index c4154a6923..1bc2922d32 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java @@ -133,7 +133,8 @@ public class BinaryInspector { BinaryIndexPart part = indexes[c].getIndexes().get(i); if(part instanceof MapIndex){ List roots = ((MapIndex) part).getRoots(); - for(int j=0; j toSkip = new ArrayList(); int newL = 0; int tagAndFieldSize = CodedOutputStream.computeTagSize(OsmandOdb.OsmAndMapIndex.LEVELS_FIELD_NUMBER) + 4; - for(int j=0; j l = new ArrayList(); int first = 0; - while(first < n.size()){ + int nsize = n.size(); + while(first < nsize){ if(n.get(first) != null){ break; } first++; } - int last = n.size() - 1; + int last = nsize - 1; while (last >= 0) { if (n.get(last) != null) { break; @@ -54,7 +55,8 @@ public class MapAlgorithms { } simplifyDouglasPeucker(n, zoom, epsilon, l, first, last); w.addNode(n.get(first)); - for (int i = 0; i < l.size(); i++) { + int lsize = l.size(); + for (int i = 0; i < lsize; i++) { w.addNode(n.get(l.get(i))); } if (cycle) { @@ -99,7 +101,6 @@ public class MapAlgorithms { public static boolean isClockwiseWay(Way w){ return isClockwiseWay(Collections.singletonList(w)); - } public static boolean isClockwiseWay(List ways){ @@ -120,12 +121,13 @@ public class MapAlgorithms { for(Way w : ways){ List ns = w.getNodes(); int startInd = 0; - if(firstWay && ns.size() > 0){ + int nssize = ns.size(); + if(firstWay && nssize > 0){ prev = ns.get(0); startInd = 1; firstWay = false; } - for(int i = startInd; i < ns.size();i++) { + for(int i = startInd; i < nssize;i++) { Node next = ns.get(i); double rlon = ray_intersect_lon(prev, next, lat, lon); if(rlon != - 360d){ @@ -161,8 +163,6 @@ public class MapAlgorithms { } return clockwiseSum >= 0; - - } // try to intersect from left to right @@ -194,8 +194,5 @@ public class MapAlgorithms { } } } - } - - -} +} \ No newline at end of file diff --git a/DataExtractionOSM/src/net/osmand/data/TransportRoute.java b/DataExtractionOSM/src/net/osmand/data/TransportRoute.java index adfc872e92..be20d49f26 100644 --- a/DataExtractionOSM/src/net/osmand/data/TransportRoute.java +++ b/DataExtractionOSM/src/net/osmand/data/TransportRoute.java @@ -8,7 +8,6 @@ import net.osmand.osm.MapUtils; import net.osmand.osm.Relation; import net.osmand.osm.Way; - public class TransportRoute extends MapObject { private List ways; private List forwardStops = new ArrayList(); @@ -85,14 +84,14 @@ public class TransportRoute extends MapObject { public int getAvgBothDistance(){ int d = 0; - for(int i=1; i< backwardStops.size(); i++){ + int bSsize = backwardStops.size(); + int fSsize = forwardStops.size(); + for(int i=1; i< bSsize; i++){ d += MapUtils.getDistance(backwardStops.get(i-1).getLocation(), backwardStops.get(i).getLocation()); } - for(int i=1; i< forwardStops.size(); i++){ + for(int i=1; i< fSsize; i++){ d += MapUtils.getDistance(forwardStops.get(i-1).getLocation(), forwardStops.get(i).getLocation()); } return d; } - - -} +} \ No newline at end of file diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java index 0f6b42a89e..58bce4cbba 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java @@ -834,13 +834,14 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{ } int j = 0; - for (; j < cities.size(); j++) { + int csize = cities.size(); + for (; j < csize; j++) { City c = cities.get(j); if (c.getType() != CityType.CITY && c.getType() != CityType.TOWN) { 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> postcodes = new TreeMap>(); boolean writeCities = true; @@ -855,7 +856,7 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{ // write cities and after villages writer.startCityIndexes(false); - for (int i = 0; i < cities.size(); i++) { + for (int i = 0; i < csize; i++) { City c = cities.get(i); List listSuburbs = null; for (City suburb : suburbs) { @@ -868,7 +869,7 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{ } if (writeCities) { progress.progress(1); - } else if ((cities.size() - i) % 100 == 0) { + } else if ((csize - i) % 100 == 0) { progress.progress(1); } if (writeCities && c.getType() != CityType.CITY && c.getType() != CityType.TOWN) { @@ -1130,7 +1131,4 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{ stat.close(); return cities; } - - - } diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java index 6a7affd92f..fb00c49231 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java @@ -282,7 +282,8 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { List l = new ArrayList(); l.add(w); boolean add = true; - for (int k = 0; k < incompletedRings.size();) { + int iRsize = incompletedRings.size(); + for (int k = 0; k < iRsize;) { boolean remove = false; List i = incompletedRings.get(k); Way last = i.get(i.size() - 1); @@ -576,7 +577,8 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { fs.close(); } List wNodes = new ArrayList(); - for (int i = 0; i < wayNodes.size(); i += 2) { + int wNsize = wayNodes.size(); + for (int i = 0; i < wNsize; i += 2) { wNodes.add(new Node(wayNodes.get(i), wayNodes.get(i + 1), i == 0 ? startNode : endNode)); } boolean skip = false; @@ -605,7 +607,8 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { int minY = Integer.MAX_VALUE; int maxY = Integer.MIN_VALUE; int c = 0; - for (int i = 0; i < nodes.size(); i++) { + int nsize = nodes.size(); + for (int i = 0; i < nsize; i++) { if (nodes.get(i) != null) { c++; int x = (int) (MapUtils.getTileNumberX(zoom, nodes.get(i).getLongitude()) * 256d); diff --git a/DataExtractionOSM/src/net/osmand/osm/Way.java b/DataExtractionOSM/src/net/osmand/osm/Way.java index 00cda65f77..6e6c5d93fa 100644 --- a/DataExtractionOSM/src/net/osmand/osm/Way.java +++ b/DataExtractionOSM/src/net/osmand/osm/Way.java @@ -88,11 +88,11 @@ public class Way extends Entity { } else { nodes.clear(); } - for (int i = 0; i < nodeIds.size(); i++) { + int nIsize = nodeIds.size(); + for (int i = 0; i < nIsize; i++) { nodes.add((Node) entities.get(new EntityId(EntityType.NODE,nodeIds.get(i)))); } } - } @Override diff --git a/DataExtractionOSM/src/net/osmand/osm/io/OsmBaseStorage.java b/DataExtractionOSM/src/net/osmand/osm/io/OsmBaseStorage.java index 62e445c680..8a56b8f87b 100644 --- a/DataExtractionOSM/src/net/osmand/osm/io/OsmBaseStorage.java +++ b/DataExtractionOSM/src/net/osmand/osm/io/OsmBaseStorage.java @@ -385,7 +385,8 @@ public class OsmBaseStorage extends DefaultHandler { @Override protected void parseNodes(List n) { EntityInfo info = null; - for(int i=0; i r) { EntityInfo info = null; - for(int i=0; i w) { EntityInfo info = null; - for(int i=0; i correlated = new LinkedHashMap(); Map reverse = new LinkedHashMap(); List stopsToCheck = new ArrayList(stopsMap.values()); - for(int k =0; k closestObjects = busStops.getClosestObjects(r.latitude, r.longitude, 0, 1); // filter closest objects @@ -140,7 +141,8 @@ public class MinskTransReader { MapUtils.sortListOfEntities(closestObjects, r.latitude, r.longitude); int ind = 0; boolean ccorrelated = false; - while(ind < closestObjects.size() && !ccorrelated){ + int cOsize = closestObjects.size(); + while(ind < cOsize && !ccorrelated){ Node foundNode = closestObjects.get(ind); if(!reverse.containsKey(foundNode)){ // all is good no one registered to that stop @@ -279,7 +281,8 @@ public class MinskTransReader { list.add(0, end); list.add(start); } - for(int i=0; i