From 87a7b42f66e4d14ade81b68a677ffa494ad96c2e Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Fri, 8 May 2020 16:40:58 +0300 Subject: [PATCH 01/24] work in project, crude merge working --- .../java/net/osmand/data/TransportRoute.java | 58 ++++++++ .../java/net/osmand/data/TransportStop.java | 15 +- .../osmand/router/TransportRoutePlanner.java | 136 +++++++++++++++--- 3 files changed, 192 insertions(+), 17 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index 64839b8649..ba485fa2f7 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -12,6 +12,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import gnu.trove.map.hash.TLongObjectHashMap; + public class TransportRoute extends MapObject { private List forwardStops = new ArrayList(); private String ref; @@ -22,10 +24,30 @@ public class TransportRoute extends MapObject { private List forwardWays; private TransportSchedule schedule; public static final double SAME_STOP = 40; + private boolean combined = false; + private List routeParts = new ArrayList(); public TransportRoute() { } + public TransportRoute(TransportRoute r, boolean combined) { + this.name = r.name; + this.enName = r.enName; + this.names = r.names; + this.id = r.id; //TODO check if need ways and id here + this.operator = r.operator; + this.ref = r.ref; + this.type = r.type; + this.dist = r.dist; + this.color = r.color; + this.schedule = r.schedule; + this.combined = combined; + + if (combined) { + this.addRoutePart(r, true); + } + } + public TransportSchedule getSchedule() { return schedule; } @@ -38,6 +60,42 @@ public class TransportRoute extends MapObject { } + + public boolean isCombined() { + return combined; + } + + public void setCombined(boolean combined) { + this.combined = combined; + } + + public void addRoutePart(TransportRoute part, boolean forward) { + if (forward) { + routeParts.add(part); + for (int i = 0; i < part.getForwardStops().size(); i++) { + if (!part.getForwardStops().get(i).isMissingStop() && !forwardStops.contains(part.getForwardStops().get(i))) { + forwardStops.add(part.getForwardStops().get(i)); + } + } + } else { + routeParts.add(0, part); + for (int i = part.getForwardStops().size() - 1; i >= 0 ; i--) { + if (!part.getForwardStops().get(i).isMissingStop() && !forwardStops.contains(part.getForwardStops().get(i))) { + forwardStops.add(part.getForwardStops().get(i)); + } + } + } + } + + + public List getRouteParts() { + return routeParts; + } + + public void setRouteParts(List routeParts) { + this.routeParts = routeParts; + } + public List getForwardStops() { return forwardStops; } diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java index b12afad9a1..48eb8e67f7 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java @@ -22,7 +22,8 @@ public class TransportStop extends MapObject { private List exits; private List routes = null; private LinkedHashMap referencesToRoutesMap; - + private boolean missingStop = false; + private TransportStopAggregated transportStopAggregated; public TransportStop() {} @@ -30,7 +31,19 @@ public class TransportStop extends MapObject { public List getRoutes() { return routes; } + + @Override + public void setName(String name) { + super.setName(name); + if (name != null && name.equals("#Missing Stop")) { + missingStop = true; + } + } + public boolean isMissingStop() { + return missingStop; + } + public LinkedHashMap getReferencesToRoutesMap() { return referencesToRoutesMap; } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 7b0b5b9f67..926fd68473 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -12,7 +12,9 @@ import java.util.Map; import java.util.PriorityQueue; import gnu.trove.iterator.TIntIterator; +import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.list.array.TIntArrayList; +import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TLongObjectHashMap; @@ -27,18 +29,20 @@ import net.osmand.data.TransportStop; import net.osmand.data.TransportStopExit; import net.osmand.osm.edit.Node; import net.osmand.osm.edit.Way; +import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; public class TransportRoutePlanner { private static final boolean MEASURE_TIME = false; + private static final int MISSING_STOP_SEARCH_RADIUS = 15000; public static final long GEOMETRY_WAY_ID = -1; public static final long STOPS_WAY_ID = -2; public List buildRoute(TransportRoutingContext ctx, LatLon start, LatLon end) throws IOException, InterruptedException { ctx.startCalcTime = System.currentTimeMillis(); - List startStops = ctx.getTransportStops(start); - List endStops = ctx.getTransportStops(end); + List startStops = ctx.getTransportStops(start, true, false); + List endStops = ctx.getTransportStops(end, true, false); TLongObjectHashMap endSegments = new TLongObjectHashMap(); for(TransportRouteSegment s : endStops) { @@ -113,7 +117,7 @@ public class TransportRoutePlanner { break; } sgms.clear(); - sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms); + sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms, true, stop.isMissingStop()); ctx.visitedStops++; for (TransportRouteSegment sgm : sgms) { if (ctx.calculationProgress != null && ctx.calculationProgress.isCancelled) { @@ -701,7 +705,7 @@ public class TransportRoutePlanner { public RouteCalculationProgress calculationProgress; public TLongObjectHashMap visitedSegments = new TLongObjectHashMap(); public TransportRoutingConfiguration cfg; - + public TLongObjectHashMap combinedRoutes = new TLongObjectHashMap(); public TLongObjectHashMap> quadTree; public final Map> routeMap = @@ -720,7 +724,7 @@ public class TransportRoutePlanner { private final int walkRadiusIn31; private final int walkChangeRadiusIn31; - + private final int missingStopRadiusIn31; @@ -728,6 +732,7 @@ public class TransportRoutePlanner { this.cfg = cfg; walkRadiusIn31 = (int) (cfg.walkRadius / MapUtils.getTileDistanceWidth(31)); walkChangeRadiusIn31 = (int) (cfg.walkChangeRadius / MapUtils.getTileDistanceWidth(31)); + missingStopRadiusIn31 = (int) (MISSING_STOP_SEARCH_RADIUS / MapUtils.getTileDistanceWidth(31)); quadTree = new TLongObjectHashMap>(); this.library = library; for (BinaryMapIndexReader r : readers) { @@ -735,19 +740,22 @@ public class TransportRoutePlanner { } } - public List getTransportStops(LatLon loc) throws IOException { + public List getTransportStops(LatLon loc, boolean completeRoutes, boolean missingStop) throws IOException { int y = MapUtils.get31TileNumberY(loc.getLatitude()); int x = MapUtils.get31TileNumberX(loc.getLongitude()); - return getTransportStops(x, y, false, new ArrayList()); + return getTransportStops(x, y, false, new ArrayList(), completeRoutes, missingStop); } - public List getTransportStops(int x, int y, boolean change, List res) throws IOException { - return loadNativeTransportStops(x, y, change, res); + public List getTransportStops(int x, int y, boolean change, List res, boolean completeRoutes, boolean missingStop) throws IOException { + return loadNativeTransportStops(x, y, change, res, completeRoutes, missingStop); } - private List loadNativeTransportStops(int sx, int sy, boolean change, List res) throws IOException { + private List loadNativeTransportStops(int sx, int sy, boolean change, List res, boolean completeRoutes, boolean missingStop) throws IOException { long nanoTime = System.nanoTime(); int d = change ? walkChangeRadiusIn31 : walkRadiusIn31; + if (missingStop) { + d = missingStopRadiusIn31; + } int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); @@ -757,11 +765,14 @@ public class TransportRoutePlanner { long tileId = (((long)x) << (cfg.ZOOM_TO_LOAD_TILES + 1)) + y; List list = quadTree.get(tileId); if(list == null) { - list = loadTile(x, y); + list = loadTile(x, y, completeRoutes); quadTree.put(tileId, list); } for(TransportRouteSegment r : list) { TransportStop st = r.getStop(r.segStart); +// if (missingStop && st.isMissingStop()) { +// +// } if (Math.abs(st.x31 - sx) > walkRadiusIn31 || Math.abs(st.y31 - sy) > walkRadiusIn31) { wrongLoadedWays++; } else { @@ -776,7 +787,7 @@ public class TransportRoutePlanner { } - private List loadTile(int x, int y) throws IOException { + private List loadTile(int x, int y, boolean completeRoutes) throws IOException { long nanoTime = System.nanoTime(); List lst = new ArrayList(); int pz = (31 - cfg.ZOOM_TO_LOAD_TILES); @@ -792,8 +803,9 @@ public class TransportRoutePlanner { localFileRoutes.clear(); mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); - + for (TransportStop stop : stops) { + long stopId = stop.getId(); TransportStop multifileStop = loadedTransportStops.get(stopId); int[] rrs = stop.getReferencesToRoutes(); @@ -807,6 +819,7 @@ public class TransportRoutePlanner { if (rrs != null && !multifileStop.isDeleted()) { for (int rr : rrs) { TransportRoute route = localFileRoutes.get(rr); + TransportRoute combinedRoute = getCombinedRoute(route); if (route == null) { System.err.println(String.format("Something went wrong by loading route %d for stop %s", rr, stop)); } else if (multifileStop == stop || @@ -814,13 +827,14 @@ public class TransportRoutePlanner { !multifileStop.isRouteDeleted(route.getId()))) { // duplicates won't be added multifileStop.addRouteId(route.getId()); - multifileStop.addRoute(route); +// multifileStop.addRoute(route); + multifileStop.addRoute(combinedRoute); //TODO how to add id? } } } } } - + //there should go stops with complete routes: loadTransportSegments(loadedTransportStops.valueCollection(), lst); readTime += System.nanoTime() - nanoTime; @@ -849,7 +863,7 @@ public class TransportRoutePlanner { localRoutesToLoad.addAll(stop.getReferencesToRoutes()); } } else if (multifileStop.isDeleted()){ - // stop has noting to load, so not needed + // stop has nothing to load, so not needed it.remove(); } else { if (delRIds != null) { @@ -903,7 +917,97 @@ public class TransportRoutePlanner { return stops; } + + private TransportRoute getCombinedRoute(TransportRoute route) throws IOException { + TransportRoute c = combinedRoutes.get(route.getId()); + if (c == null) { + c = combineRoute(route); + combinedRoutes.put(route.getId(), c); + } + + return c; + } + + private TransportRoute combineRoute(TransportRoute route) throws IOException { + TransportRoute cr = new TransportRoute(route, true); + TransportRoute missingPart; + if (route.getForwardStops().get(0).isMissingStop()) { + missingPart = loadMissingTransportRoute( + route.getForwardStops().get(0).x31, route.getForwardStops().get(0).y31, route); + if (missingPart != null) { + cr.addRoutePart(missingPart, false); + } + } + if (route.getForwardStops().get(route.getForwardStops().size()-1).isMissingStop()) { + missingPart = loadMissingTransportRoute( + route.getForwardStops().get(route.getForwardStops().size()-1).x31, + route.getForwardStops().get(route.getForwardStops().size()-1).y31, route); + if (missingPart != null) { + cr.addRoutePart(missingPart, true); + } + } + + return cr; + } + + private TransportRoute loadMissingTransportRoute(int sx, int sy, TransportRoute route) throws IOException { + long nanoTime = System.nanoTime(); + List res = new ArrayList(); + TIntObjectHashMap tr = new TIntObjectHashMap(); + int d = missingStopRadiusIn31; + int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); + int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); + int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); + int by = (sy + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); + for(int x = lx; x <= rx; x++) { + for(int y = ty; y <= by; y++) { + long tileId = (((long)x) << (cfg.ZOOM_TO_LOAD_TILES + 1)) + y; +// List list = quadTree.get(tileId); +// if(list == null) { + tr = getRouteParts(x, y); +// quadTree.put(tileId, list); +// } + if (!tr.isEmpty()) { + res.addAll(tr.valueCollection()); + } + + } + } + for (TransportRoute trr : res) { + if ((long)trr.getId() == (long)route.getId()) { + if (trr.getForwardStops() != route.getForwardStops()) { + return trr; + } + } + } + + return null; + } + + private TIntObjectHashMap getRouteParts(int x, int y) throws IOException { + int pz = (31 - cfg.ZOOM_TO_LOAD_TILES); + SearchRequest sr = BinaryMapIndexReader.buildSearchTransportRequest(x << pz, (x + 1) << pz, + y << pz, (y + 1) << pz, -1, null); + + TLongObjectHashMap loadedTransportStops = new TLongObjectHashMap(); + TIntObjectHashMap localFileRoutes = new TIntObjectHashMap<>(); + TIntObjectHashMap res = new TIntObjectHashMap(); + for (BinaryMapIndexReader r : routeMap.keySet()) { + sr.clearSearchResults(); + List stops = r.searchTransportIndex(sr); + + localFileRoutes.clear(); + //search routes here: + mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); + if (!localFileRoutes.isEmpty()) { + res.putAll(localFileRoutes); + } + } + return res; + } + + private void loadTransportSegments(Collection stops, List lst) throws IOException { for(TransportStop s : stops) { if (s.isDeleted() || s.getRoutes() == null) { From 2c8824341ad1c4f5df1e87da8de4c9ca9d19b014 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Tue, 12 May 2020 12:42:12 +0300 Subject: [PATCH 02/24] work in progress --- .../osmand/binary/BinaryMapIndexReader.java | 8 +- .../java/net/osmand/data/TransportRoute.java | 4 +- .../osmand/router/TransportRoutePlanner.java | 120 ++++++++++++------ 3 files changed, 91 insertions(+), 41 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java index ce83e15956..dabb1c4959 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java @@ -109,7 +109,9 @@ public class BinaryMapIndexReader { /*private*/ List transportIndexes = new ArrayList(); /*private*/ List routingIndexes = new ArrayList(); /*private*/ List indexes = new ArrayList(); - + + private final TLongObjectHashMap incompleteRoutes = new TLongObjectHashMap(); + protected CodedInputStream codedIS; private final BinaryMapTransportReaderAdapter transportAdapter; @@ -2631,5 +2633,9 @@ public class BinaryMapIndexReader { } } + public int[] getIncompleteRoutesPointers(long id) { + return incompleteRoutes.get(id); + } + } diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index ba485fa2f7..11d5699d4b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -34,7 +34,7 @@ public class TransportRoute extends MapObject { this.name = r.name; this.enName = r.enName; this.names = r.names; - this.id = r.id; //TODO check if need ways and id here + this.id = r.id; this.operator = r.operator; this.ref = r.ref; this.type = r.type; @@ -59,8 +59,6 @@ public class TransportRoute extends MapObject { return schedule; } - - public boolean isCombined() { return combined; } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 926fd68473..b0c1ffcb1e 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -19,6 +20,7 @@ import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TLongObjectHashMap; import net.osmand.NativeLibrary; +import net.osmand.binary.BinaryIndexPart; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; import net.osmand.data.LatLon; @@ -382,7 +384,7 @@ public class TransportRoutePlanner { public List getGeometry() { List list = new ArrayList<>(); - route.mergeForwardWays(); + route.mergeForwardWays(); //TODO merge ways of all Route parts if (DISPLAY_FULL_SEGMENT_ROUTE) { System.out.println("TOTAL SEGMENTS: " + route.getForwardWays().size()); if (route.getForwardWays().size() > DISPLAY_SEGMENT_IND) { @@ -706,11 +708,13 @@ public class TransportRoutePlanner { public TLongObjectHashMap visitedSegments = new TLongObjectHashMap(); public TransportRoutingConfiguration cfg; public TLongObjectHashMap combinedRoutes = new TLongObjectHashMap(); + public Map> missingStopsCache = new HashMap>(); public TLongObjectHashMap> quadTree; public final Map> routeMap = new LinkedHashMap>(); + // stats public long startCalcTime; public int visitedRoutesCount; @@ -770,9 +774,7 @@ public class TransportRoutePlanner { } for(TransportRouteSegment r : list) { TransportStop st = r.getStop(r.segStart); -// if (missingStop && st.isMissingStop()) { -// -// } + if (Math.abs(st.x31 - sx) > walkRadiusIn31 || Math.abs(st.y31 - sy) > walkRadiusIn31) { wrongLoadedWays++; } else { @@ -796,7 +798,7 @@ public class TransportRoutePlanner { // could be global ? TLongObjectHashMap loadedTransportStops = new TLongObjectHashMap(); - TIntObjectHashMap localFileRoutes = new TIntObjectHashMap<>(); + TIntObjectHashMap localFileRoutes = new TIntObjectHashMap<>(); //reference, route for (BinaryMapIndexReader r : routeMap.keySet()) { sr.clearSearchResults(); List stops = r.searchTransportIndex(sr); @@ -818,17 +820,16 @@ public class TransportRoutePlanner { } if (rrs != null && !multifileStop.isDeleted()) { for (int rr : rrs) { - TransportRoute route = localFileRoutes.get(rr); - TransportRoute combinedRoute = getCombinedRoute(route); - if (route == null) { + //TODO here we should assign only complete routes: + TransportRoute combinedRoute = getCombinedRoute(localFileRoutes.get(rr), r.getFile().getName()); + if (combinedRoute == null) { System.err.println(String.format("Something went wrong by loading route %d for stop %s", rr, stop)); } else if (multifileStop == stop || - (!multifileStop.hasRoute(route.getId()) && - !multifileStop.isRouteDeleted(route.getId()))) { + (!multifileStop.hasRoute(combinedRoute.getId()) && + !multifileStop.isRouteDeleted(combinedRoute.getId()))) { // duplicates won't be added - multifileStop.addRouteId(route.getId()); -// multifileStop.addRoute(route); - multifileStop.addRoute(combinedRoute); //TODO how to add id? + multifileStop.addRouteId(combinedRoute.getId()); + multifileStop.addRoute(combinedRoute); } } } @@ -841,16 +842,22 @@ public class TransportRoutePlanner { return lst; } + public static List mergeTransportStops(BinaryMapIndexReader reader, TLongObjectHashMap loadedTransportStops, List stops, TIntObjectHashMap localFileRoutes, - TIntObjectHashMap loadedRoutes) throws IOException { + TIntObjectHashMap loadedRoutes +// boolean processMissingStop + ) throws IOException { TIntArrayList routesToLoad = new TIntArrayList(); TIntArrayList localRoutesToLoad = new TIntArrayList(); Iterator it = stops.iterator(); while (it.hasNext()) { TransportStop stop = it.next(); +// if (stop.isMissingStop() && !processMissingStop) { +// continue; +// } long stopId = stop.getId(); localRoutesToLoad.clear(); TransportStop multifileStop = loadedTransportStops.get(stopId); @@ -890,10 +897,10 @@ public class TransportRoutePlanner { } } routesToLoad.addAll(localRoutesToLoad); - multifileStop.putReferencesToRoutes(reader.getFile().getName(), localRoutesToLoad.toArray()); + multifileStop.putReferencesToRoutes(reader.getFile().getName(), localRoutesToLoad.toArray()); //add valid stop and references to routes } - // load routes + // load/combine routes if (routesToLoad.size() > 0) { routesToLoad.sort(); TIntArrayList referencesToLoad = new TIntArrayList(); @@ -902,7 +909,7 @@ public class TransportRoutePlanner { while (itr.hasNext()) { int nxt = itr.next(); if (p != nxt) { - if (localFileRoutes != null && loadedRoutes != null && loadedRoutes.contains(nxt)) { + if (localFileRoutes != null && loadedRoutes != null && loadedRoutes.contains(nxt)) { //check if localFileRoutes.put(nxt, loadedRoutes.get(nxt)); } else { referencesToLoad.add(nxt); @@ -918,39 +925,78 @@ public class TransportRoutePlanner { return stops; } - private TransportRoute getCombinedRoute(TransportRoute route) throws IOException { + private TransportRoute getCombinedRoute(TransportRoute route, String fileName) throws IOException { + if (!route.getForwardStops().get(0).isMissingStop() && !route.getForwardStops().get(route.getForwardStops().size()-1).isMissingStop()) { + return route; + } + TransportRoute c = combinedRoutes.get(route.getId()); + if (c == null) { - c = combineRoute(route); + c = combineRoute(route, fileName); combinedRoutes.put(route.getId(), c); } return c; } - private TransportRoute combineRoute(TransportRoute route) throws IOException { + private TIntObjectHashMap findIncompleteRouteParts(TransportRoute baseRoute, String fileName) throws IOException { + int ptrs[]; + TIntObjectHashMap res = new TIntObjectHashMap(); + TIntObjectHashMap localRes = new TIntObjectHashMap(); +// TODO check if valid comparsion by filename + for (BinaryMapIndexReader bmir: routeMap.keySet()) { + if (!bmir.getFile().getName().equals(fileName)) { + /** + * What about situation when one route has several parts in map? + * MB check all readers and then sort it out? + * + * Should I check if those routes already loaded? But they shouldn't, + * else we will already had a combined route and never get there! + */ + localRes.clear(); + ptrs = bmir.getIncompleteRoutesPointers(baseRoute.getId()); + if (ptrs != null && ptrs.length > 0) { + localRes = bmir.getTransportRoutes(ptrs); + + res.putAll(localRes); + } + } + } + return res; + } + + + private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { TransportRoute cr = new TransportRoute(route, true); - TransportRoute missingPart; - - if (route.getForwardStops().get(0).isMissingStop()) { - missingPart = loadMissingTransportRoute( - route.getForwardStops().get(0).x31, route.getForwardStops().get(0).y31, route); - if (missingPart != null) { - cr.addRoutePart(missingPart, false); - } - } - if (route.getForwardStops().get(route.getForwardStops().size()-1).isMissingStop()) { - missingPart = loadMissingTransportRoute( - route.getForwardStops().get(route.getForwardStops().size()-1).x31, - route.getForwardStops().get(route.getForwardStops().size()-1).y31, route); - if (missingPart != null) { - cr.addRoutePart(missingPart, true); - } - } + TIntObjectHashMap res = findIncompleteRouteParts(route, fileName); +// for () { + //TODO check for duplicates and subsets + //TODO connect in right order + +// } +// TransportRoute missingPart; +// if (route.getForwardStops().get(0).isMissingStop()) { +// missingPart = loadMissingTransportRoute( +// route.getForwardStops().get(0).x31, route.getForwardStops().get(0).y31, route); +// if (missingPart != null) { +// cr.addRoutePart(missingPart, false); +// } +// } +// if (route.getForwardStops().get(route.getForwardStops().size()-1).isMissingStop()) { +// missingPart = loadMissingTransportRoute( +// route.getForwardStops().get(route.getForwardStops().size()-1).x31, +// route.getForwardStops().get(route.getForwardStops().size()-1).y31, route); +// if (missingPart != null) { +// cr.addRoutePart(missingPart, true); +// } +// } return cr; } + + private TransportRoute loadMissingTransportRoute(int sx, int sy, TransportRoute route) throws IOException { long nanoTime = System.nanoTime(); List res = new ArrayList(); From 7699e2061c75bcf13697145f79f1522c5f40ec79 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Wed, 13 May 2020 15:09:30 +0300 Subject: [PATCH 03/24] add reading of incomplete routes. Add cache - work in progress --- .../osmand/binary/BinaryMapIndexReader.java | 12 ++- .../BinaryMapTransportReaderAdapter.java | 89 ++++++++++++++++++- .../osmand/data/IncompleteTransportRoute.java | 50 +++++++++++ .../java/net/osmand/data/TransportRoute.java | 4 + .../osmand/router/TransportRoutePlanner.java | 79 ++++++++-------- 5 files changed, 192 insertions(+), 42 deletions(-) create mode 100644 OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java index 5fedfc8eae..4ddb58377a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java @@ -19,6 +19,7 @@ import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion; import net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex; +import net.osmand.binary.OsmandOdb.IncompleteTransportRoute; import net.osmand.binary.OsmandOdb.MapDataBlock; import net.osmand.binary.OsmandOdb.OsmAndMapIndex.MapDataBox; import net.osmand.binary.OsmandOdb.OsmAndMapIndex.MapEncodingRule; @@ -54,6 +55,7 @@ import java.io.InputStreamReader; import java.io.RandomAccessFile; import java.io.Reader; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -110,7 +112,8 @@ public class BinaryMapIndexReader { /*private*/ List routingIndexes = new ArrayList(); /*private*/ List indexes = new ArrayList(); - private final TLongObjectHashMap incompleteRoutes = new TLongObjectHashMap(); + private final TLongObjectHashMap incompleteRoutes = + new TLongObjectHashMap(); protected CodedInputStream codedIS; @@ -225,7 +228,7 @@ public class BinaryMapIndexReader { ind.filePointer = codedIS.getTotalBytesRead(); if (transportAdapter != null) { oldLimit = codedIS.pushLimit(ind.length); - transportAdapter.readTransportIndex(ind); + transportAdapter.readTransportIndex(ind, incompleteRoutes); codedIS.popLimit(oldLimit); transportIndexes.add(ind); indexes.add(ind); @@ -2633,9 +2636,12 @@ public class BinaryMapIndexReader { } } - public int[] getIncompleteRoutesPointers(long id) { + public net.osmand.data.IncompleteTransportRoute getIncompleteRoutePointers(long id) { return incompleteRoutes.get(id); } + public Collection getIncompleteRoutes() { + return incompleteRoutes.valueCollection(); + } } diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java index bf3a217306..617bf46f07 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java @@ -1,15 +1,20 @@ package net.osmand.binary; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import com.google.protobuf.CodedInputStream; import com.google.protobuf.WireFormat; +import gnu.trove.list.array.TLongArrayList; import gnu.trove.map.hash.TIntObjectHashMap; +import gnu.trove.map.hash.TLongObjectHashMap; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; +import net.osmand.binary.OsmandOdb.IncompleteTransportRoute; import net.osmand.data.TransportSchedule; import net.osmand.data.TransportStop; import net.osmand.data.TransportStopExit; @@ -43,6 +48,8 @@ public class BinaryMapTransportReaderAdapter { int stopsFileOffset = 0; int stopsFileLength = 0; + int incompleteRoutesOffset = 0; + int incompleteRoutesLength = 0; public String getPartName() { return "Transport"; @@ -67,7 +74,8 @@ public class BinaryMapTransportReaderAdapter { public int getBottom() { return bottom; } - + + IndexStringTable stringTable = null; } @@ -79,7 +87,7 @@ public class BinaryMapTransportReaderAdapter { } - protected void readTransportIndex(TransportIndex ind) throws IOException { + protected void readTransportIndex(TransportIndex ind, TLongObjectHashMap incompleteRoutes) throws IOException { while(true){ int t = codedIS.readTag(); int tag = WireFormat.getTagFieldNumber(t); @@ -108,6 +116,16 @@ public class BinaryMapTransportReaderAdapter { ind.stringTable = st; codedIS.seek(st.length + st.fileOffset); break; + case OsmandOdb.OsmAndTransportIndex.INCOMPLETEROUTES_FIELD_NUMBER : + TIntObjectHashMap stab = new TIntObjectHashMap(); + ind.incompleteRoutesLength = codedIS.readRawVarint32(); + ind.incompleteRoutesOffset = codedIS.getTotalBytesRead(); + int oldl = codedIS.pushLimit(ind.incompleteRoutesLength); + //may be we should start caching stringTable in advance? + readIncompleteRoutesList(incompleteRoutes, ind.incompleteRoutesLength, ind.incompleteRoutesOffset, stab); + codedIS.popLimit(oldl); + break; + default: skipUnknownField(t); break; @@ -240,6 +258,73 @@ public class BinaryMapTransportReaderAdapter { return ((char) i)+""; } + private void readIncompleteRoutesList(TLongObjectHashMap incompleteRoutes, + int length, int offset, TIntObjectHashMap stringTable) throws IOException { + codedIS.seek(offset); + + List irs = new ArrayList<>(); + boolean end = false; + while (!end) { + int t = codedIS.readTag(); + int tag = WireFormat.getTagFieldNumber(t); + switch (tag) { + case 0: + end = true; + break; + case OsmandOdb.IncompleteTransportRoutes.ROUTES_FIELD_NUMBER: + int l = codedIS.readRawVarint32(); + int olds = codedIS.pushLimit(l); + net.osmand.data.IncompleteTransportRoute ir = readIncompleteRoute(stringTable); + incompleteRoutes.put(ir.getRouteId(), ir); + codedIS.popLimit(olds); + break; + default: + skipUnknownField(t); + break; + } + + } + + } + + public net.osmand.data.IncompleteTransportRoute readIncompleteRoute(TIntObjectHashMap stringTable) throws IOException { + net.osmand.data.IncompleteTransportRoute dataObject = new net.osmand.data.IncompleteTransportRoute(); + boolean end = false; + while(!end){ + int t = codedIS.readTag(); + int tag = WireFormat.getTagFieldNumber(t); + switch (tag) { + case 0: + end = true; + break; + case OsmandOdb.IncompleteTransportRoute.ID_FIELD_NUMBER : + dataObject.setRouteId(codedIS.readUInt64()); + break; + case OsmandOdb.IncompleteTransportRoute.ROUTEREF_FIELD_NUMBER : + dataObject.setRouteOffset(codedIS.readRawVarint32()); + break; + case OsmandOdb.IncompleteTransportRoute.OPERATOR_FIELD_NUMBER : + dataObject.setOperator(regStr(stringTable)); + break; + case OsmandOdb.IncompleteTransportRoute.REF_FIELD_NUMBER : + dataObject.setRef(regStr(stringTable)); + break; + case OsmandOdb.IncompleteTransportRoute.TYPE_FIELD_NUMBER : + dataObject.setType(regStr(stringTable)); + break; + case OsmandOdb.IncompleteTransportRoute.MISSINGSTOPS_FIELD_NUMBER : +//// dataObject.getMissingStops().add(codedIS.readSInt32()); //skip for now + skipUnknownField(t); + break; + default: + skipUnknownField(t); + break; + } + } + + return dataObject; + } + public net.osmand.data.TransportRoute getTransportRoute(int filePointer, TIntObjectHashMap stringTable, boolean onlyDescription) throws IOException { codedIS.seek(filePointer); diff --git a/OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java new file mode 100644 index 0000000000..eb84be3453 --- /dev/null +++ b/OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java @@ -0,0 +1,50 @@ +package net.osmand.data; + +import gnu.trove.list.array.TIntArrayList; + +public class IncompleteTransportRoute { + private long routeId; + private int routeOffset = -1; + private String operator; + private String type; + private String ref; +// private TIntArrayList missingStops; //not needed + public long getRouteId() { + return routeId; + } + public void setRouteId(long routeId) { + this.routeId = routeId; + } + public int getRouteOffset() { + return routeOffset; + } + public void setRouteOffset(int routeOffset) { + this.routeOffset = routeOffset; + } + public String getOperator() { + return operator; + } + public void setOperator(String operator) { + this.operator = operator; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getRef() { + return ref; + } + public void setRef(String ref) { + this.ref = ref; + } +// public TIntArrayList getMissingStops() { +// return missingStops; +// } +// public void setMissingStops(TIntArrayList missingStops) { +// this.missingStops = missingStops; +// } + + +} \ No newline at end of file diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index ff49525665..251bb6b867 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -63,6 +63,10 @@ public class TransportRoute extends MapObject { return combined; } + public boolean isIncomplete() { + return forwardStops.get(0).isMissingStop() || forwardStops.get(forwardStops.size()-1).isMissingStop(); + } + public void setCombined(boolean combined) { this.combined = combined; } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index b0c1ffcb1e..4be06795ac 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -23,6 +23,7 @@ import net.osmand.NativeLibrary; import net.osmand.binary.BinaryIndexPart; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; +import net.osmand.data.IncompleteTransportRoute; import net.osmand.data.LatLon; import net.osmand.data.QuadRect; import net.osmand.data.TransportRoute; @@ -707,7 +708,7 @@ public class TransportRoutePlanner { public RouteCalculationProgress calculationProgress; public TLongObjectHashMap visitedSegments = new TLongObjectHashMap(); public TransportRoutingConfiguration cfg; - public TLongObjectHashMap combinedRoutes = new TLongObjectHashMap(); + public TLongObjectHashMap combinedRoutesCache = new TLongObjectHashMap(); public Map> missingStopsCache = new HashMap>(); public TLongObjectHashMap> quadTree; @@ -926,55 +927,31 @@ public class TransportRoutePlanner { } private TransportRoute getCombinedRoute(TransportRoute route, String fileName) throws IOException { - if (!route.getForwardStops().get(0).isMissingStop() && !route.getForwardStops().get(route.getForwardStops().size()-1).isMissingStop()) { + if (!route.isIncomplete()) { return route; } - TransportRoute c = combinedRoutes.get(route.getId()); + TransportRoute c = combinedRoutesCache.get(route.getId()); if (c == null) { c = combineRoute(route, fileName); - combinedRoutes.put(route.getId(), c); + combinedRoutesCache.put(route.getId(), c); } return c; } - private TIntObjectHashMap findIncompleteRouteParts(TransportRoute baseRoute, String fileName) throws IOException { - int ptrs[]; - TIntObjectHashMap res = new TIntObjectHashMap(); - TIntObjectHashMap localRes = new TIntObjectHashMap(); -// TODO check if valid comparsion by filename - for (BinaryMapIndexReader bmir: routeMap.keySet()) { - if (!bmir.getFile().getName().equals(fileName)) { - /** - * What about situation when one route has several parts in map? - * MB check all readers and then sort it out? - * - * Should I check if those routes already loaded? But they shouldn't, - * else we will already had a combined route and never get there! - */ - localRes.clear(); - ptrs = bmir.getIncompleteRoutesPointers(baseRoute.getId()); - if (ptrs != null && ptrs.length > 0) { - localRes = bmir.getTransportRoutes(ptrs); - - res.putAll(localRes); - } - } - } - return res; - } - - private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { TransportRoute cr = new TransportRoute(route, true); - TIntObjectHashMap res = findIncompleteRouteParts(route, fileName); -// for () { - //TODO check for duplicates and subsets - //TODO connect in right order + Collection res = findIncompleteRouteParts(route, fileName); + List stops = route.getForwardStops(); + List ways = route.getForwardWays(); + for (TransportRoute tr : res.valueCollection()) { -// } + //TODO check for duplicates and subsets + //TODO connect routes in right order (stops/ways) + + } // TransportRoute missingPart; // if (route.getForwardStops().get(0).isMissingStop()) { // missingPart = loadMissingTransportRoute( @@ -995,6 +972,35 @@ public class TransportRoutePlanner { return cr; } + private Collection findIncompleteRouteParts(TransportRoute baseRoute, String fileName) throws IOException { + IncompleteTransportRoute ptr; + TIntObjectHashMap res = new TIntObjectHashMap(); + TIntObjectHashMap localRes = new TIntObjectHashMap(); +// TODO check if valid comparison by filename + for (BinaryMapIndexReader bmir: routeMap.keySet()) { + if (!bmir.getFile().getName().equals(fileName)) { + /** + * What about situation when one route has several parts in map? + * MB check all readers and then sort it out? + * + * Should I check if those routes already loaded? But they shouldn't, + * else we will already had a combined route and never get there! + */ + localRes.clear(); + ptr = bmir.getIncompleteRoutePointers(baseRoute.getId()); + if (ptr!= null && ptr.getRouteOffset() != -1) { + localRes = bmir.getTransportRoutes(new int[] {ptr.getRouteOffset()}); + + res.putAll(localRes); + } + } + } + return res.valueCollection(); + } + + + + private TransportRoute loadMissingTransportRoute(int sx, int sy, TransportRoute route) throws IOException { @@ -1239,5 +1245,4 @@ public class TransportRoutePlanner { } return stops; } - } From d3d55cec4b3c419c1bc2b5c6a8e52abf06c786d4 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Thu, 14 May 2020 10:18:21 +0300 Subject: [PATCH 04/24] combine routes WIP --- .../java/net/osmand/data/TransportRoute.java | 15 +- .../osmand/router/TransportRoutePlanner.java | 207 ++++++++++++------ 2 files changed, 150 insertions(+), 72 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index 251bb6b867..152bb281d9 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -71,12 +71,23 @@ public class TransportRoute extends MapObject { this.combined = combined; } - public void addRoutePart(TransportRoute part, boolean forward) { + public TransportStop getMissingStartStop() { + return forwardStops.get(0).isMissingStop() ? forwardStops.get(0) : null; + } + + public TransportStop getMissingEndStop() { + return forwardStops.get(forwardStops.size()-1).isMissingStop() ? forwardStops.get(forwardStops.size()-1) : null; + } + + public boolean addRoutePart(TransportRoute part, boolean forward) { + //TODO chec stop validity and combine ways + int addCount = 0; if (forward) { routeParts.add(part); for (int i = 0; i < part.getForwardStops().size(); i++) { if (!part.getForwardStops().get(i).isMissingStop() && !forwardStops.contains(part.getForwardStops().get(i))) { forwardStops.add(part.getForwardStops().get(i)); + addCount++; } } } else { @@ -84,9 +95,11 @@ public class TransportRoute extends MapObject { for (int i = part.getForwardStops().size() - 1; i >= 0 ; i--) { if (!part.getForwardStops().get(i).isMissingStop() && !forwardStops.contains(part.getForwardStops().get(i))) { forwardStops.add(part.getForwardStops().get(i)); + addCount++; } } } + return addCount > 0; } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 4be06795ac..b7480d488d 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -808,7 +808,6 @@ public class TransportRoutePlanner { mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); for (TransportStop stop : stops) { - long stopId = stop.getId(); TransportStop multifileStop = loadedTransportStops.get(stopId); int[] rrs = stop.getReferencesToRoutes(); @@ -821,7 +820,7 @@ public class TransportRoutePlanner { } if (rrs != null && !multifileStop.isDeleted()) { for (int rr : rrs) { - //TODO here we should assign only complete routes: + // here we should assign only complete routes: TransportRoute combinedRoute = getCombinedRoute(localFileRoutes.get(rr), r.getFile().getName()); if (combinedRoute == null) { System.err.println(String.format("Something went wrong by loading route %d for stop %s", rr, stop)); @@ -930,45 +929,116 @@ public class TransportRoutePlanner { if (!route.isIncomplete()) { return route; } - TransportRoute c = combinedRoutesCache.get(route.getId()); - if (c == null) { c = combineRoute(route, fileName); combinedRoutesCache.put(route.getId(), c); } - return c; } + Comparator compareByDist = (TransportRoute tr1, TransportRoute tr2) + -> ((Integer)tr1.getDistance()).compareTo((Integer)tr2.getDistance()); + + private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { - TransportRoute cr = new TransportRoute(route, true); - Collection res = findIncompleteRouteParts(route, fileName); - List stops = route.getForwardStops(); - List ways = route.getForwardWays(); - for (TransportRoute tr : res.valueCollection()) { - - //TODO check for duplicates and subsets - //TODO connect routes in right order (stops/ways) + List result = new ArrayList<>(findIncompleteRouteParts(route, fileName)); + List acceptedCandidates = new ArrayList(); + + TransportRoute baseRoute = route; + + if (result.size() > 1) { + //1. Sort by longest piece: + Collections.sort(result, compareByDist); + //2. Check if any route's part contains more stops, then "base" route, + //so we could find longest part (and remove subsets and copies): + Iterator itr = result.iterator(); + boolean containsAllStops = false; + while (itr.hasNext()) { + TransportRoute candidate = itr.next(); + if (candidate.compareRoute(baseRoute)) { + itr.remove(); + continue; + } else if (candidate.getForwardStops().size() > baseRoute.getForwardStops().size()) { + for (TransportStop s : baseRoute.getForwardStops()) { + for (TransportStop cs : candidate.getForwardStops()) { + if (!s.isMissingStop() && !cs.isMissingStop()) { + if (s.getId() == cs.getId()) { + containsAllStops = true; + break; + } + containsAllStops = false; + } + } + } + if (containsAllStops) { + baseRoute = candidate; + itr.remove(); + } + } else { + for (TransportStop cs : candidate.getForwardStops()) { + for (TransportStop s: baseRoute.getForwardStops()) { + if (!s.isMissingStop() && !cs.isMissingStop()) { + if(s.getId() == cs.getId()) { + containsAllStops = true; + break; + } + containsAllStops = false; + } + } + } + if (containsAllStops) { + itr.remove(); + } + } + } + } else { + acceptedCandidates = result; } -// TransportRoute missingPart; -// if (route.getForwardStops().get(0).isMissingStop()) { -// missingPart = loadMissingTransportRoute( -// route.getForwardStops().get(0).x31, route.getForwardStops().get(0).y31, route); -// if (missingPart != null) { -// cr.addRoutePart(missingPart, false); -// } -// } -// if (route.getForwardStops().get(route.getForwardStops().size()-1).isMissingStop()) { -// missingPart = loadMissingTransportRoute( -// route.getForwardStops().get(route.getForwardStops().size()-1).x31, -// route.getForwardStops().get(route.getForwardStops().size()-1).y31, route); -// if (missingPart != null) { -// cr.addRoutePart(missingPart, true); -// } -// } + //3. Connect routes in right order (stops/ways) + TransportRoute cr = new TransportRoute(baseRoute, true); + + TransportStop missingStart = baseRoute.getMissingStartStop(); + TransportStop missingEnd = baseRoute.getMissingEndStop(); + + List stops = baseRoute.getForwardStops(); + List ways = route.getForwardWays(); + Iterator itr = result.iterator(); + while(result.size() > 0) { + boolean success = false; + double distFromMissingEnd = -1; + double distFromMissingStart = -1; + TransportRoute part = itr.next(); + if (baseRoute.getMissingEndStop() != null && part.getMissingStartStop() != null) { + distFromMissingEnd = + MapUtils.getDistance(baseRoute.getMissingEndStop().getLocation(), part.getMissingStartStop().getLocation()); + } + if (baseRoute.getMissingStartStop() != null && part.getMissingEndStop() != null) { + distFromMissingStart = + MapUtils.getDistance(baseRoute.getMissingStartStop().getLocation(), part.getMissingEndStop().getLocation()); + } + if (distFromMissingEnd != -1) { + if ((distFromMissingStart == -1 || distFromMissingStart > distFromMissingEnd) && distFromMissingEnd < MISSING_STOP_SEARCH_RADIUS) { + //try to attach route part to end of baseRoute + if (!cr.addRoutePart(part, true)) { + //else assume that part of the route is missing and we need to attach it later + //TODO (how to check if missing part is exist at all? If there no some part of map + //we will fall in endless loop) + result.add(part); + }; + } + } else if (distFromMissingStart != -1) { + if ((distFromMissingEnd == -1 || distFromMissingStart < distFromMissingEnd) && distFromMissingStart < MISSING_STOP_SEARCH_RADIUS) { + if (!cr.addRoutePart(part, false)) { + //same thing here, need to exit loop somehow + result.add(part); + } + } + } + } + return cr; } @@ -976,9 +1046,10 @@ public class TransportRoutePlanner { IncompleteTransportRoute ptr; TIntObjectHashMap res = new TIntObjectHashMap(); TIntObjectHashMap localRes = new TIntObjectHashMap(); -// TODO check if valid comparison by filename + for (BinaryMapIndexReader bmir: routeMap.keySet()) { - if (!bmir.getFile().getName().equals(fileName)) { +// if (!bmir.getFile().getName().equals(fileName)) { + localRes.clear(); /** * What about situation when one route has several parts in map? * MB check all readers and then sort it out? @@ -986,56 +1057,50 @@ public class TransportRoutePlanner { * Should I check if those routes already loaded? But they shouldn't, * else we will already had a combined route and never get there! */ - localRes.clear(); ptr = bmir.getIncompleteRoutePointers(baseRoute.getId()); - if (ptr!= null && ptr.getRouteOffset() != -1) { + if (ptr != null && ptr.getRouteOffset() != -1) { localRes = bmir.getTransportRoutes(new int[] {ptr.getRouteOffset()}); - res.putAll(localRes); } - } +// } } return res.valueCollection(); } - - - - - private TransportRoute loadMissingTransportRoute(int sx, int sy, TransportRoute route) throws IOException { - long nanoTime = System.nanoTime(); - List res = new ArrayList(); - TIntObjectHashMap tr = new TIntObjectHashMap(); - int d = missingStopRadiusIn31; - int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); - int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); - int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); - int by = (sy + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); - for(int x = lx; x <= rx; x++) { - for(int y = ty; y <= by; y++) { - long tileId = (((long)x) << (cfg.ZOOM_TO_LOAD_TILES + 1)) + y; -// List list = quadTree.get(tileId); -// if(list == null) { - tr = getRouteParts(x, y); -// quadTree.put(tileId, list); +// private TransportRoute loadMissingTransportRoute(int sx, int sy, TransportRoute route) throws IOException { +// long nanoTime = System.nanoTime(); +// List res = new ArrayList(); +// TIntObjectHashMap tr = new TIntObjectHashMap(); +// int d = missingStopRadiusIn31; +// int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); +// int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); +// int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); +// int by = (sy + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); +// for(int x = lx; x <= rx; x++) { +// for(int y = ty; y <= by; y++) { +// long tileId = (((long)x) << (cfg.ZOOM_TO_LOAD_TILES + 1)) + y; +//// List list = quadTree.get(tileId); +//// if(list == null) { +// tr = getRouteParts(x, y); +//// quadTree.put(tileId, list); +//// } +// if (!tr.isEmpty()) { +// res.addAll(tr.valueCollection()); // } - if (!tr.isEmpty()) { - res.addAll(tr.valueCollection()); - } - - } - } - for (TransportRoute trr : res) { - if ((long)trr.getId() == (long)route.getId()) { - if (trr.getForwardStops() != route.getForwardStops()) { - return trr; - } - } - } - - return null; - } +// +// } +// } +// for (TransportRoute trr : res) { +// if ((long)trr.getId() == (long)route.getId()) { +// if (trr.getForwardStops() != route.getForwardStops()) { +// return trr; +// } +// } +// } +// +// return null; +// } private TIntObjectHashMap getRouteParts(int x, int y) throws IOException { int pz = (31 - cfg.ZOOM_TO_LOAD_TILES); From 3ec03040ea68f3412145d4d92f8b26cce45fcbc8 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Fri, 15 May 2020 14:36:31 +0300 Subject: [PATCH 05/24] merge route parts implementation --- .../osmand/binary/BinaryMapIndexReader.java | 1 + .../java/net/osmand/data/TransportRoute.java | 61 +-- .../osmand/router/TransportRoutePlanner.java | 439 ++++++++++-------- 3 files changed, 276 insertions(+), 225 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java index 4ddb58377a..b3f4a5ea22 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java @@ -2639,6 +2639,7 @@ public class BinaryMapIndexReader { public net.osmand.data.IncompleteTransportRoute getIncompleteRoutePointers(long id) { return incompleteRoutes.get(id); } + public Collection getIncompleteRoutes() { return incompleteRoutes.valueCollection(); } diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index 152bb281d9..0c222cf173 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -12,6 +12,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import gnu.trove.list.array.TIntArrayList; +import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TLongObjectHashMap; public class TransportRoute extends MapObject { @@ -30,7 +32,7 @@ public class TransportRoute extends MapObject { public TransportRoute() { } - public TransportRoute(TransportRoute r, boolean combined) { + public TransportRoute(TransportRoute r, List mergedSegment, List ways) { this.name = r.name; this.enName = r.enName; this.names = r.names; @@ -38,14 +40,12 @@ public class TransportRoute extends MapObject { this.operator = r.operator; this.ref = r.ref; this.type = r.type; - this.dist = r.dist; this.color = r.color; this.schedule = r.schedule; - this.combined = combined; - - if (combined) { - this.addRoutePart(r, true); - } + this.combined = true; + this.forwardStops = mergedSegment; + this.dist = calculateDistance(); + this.forwardWays = ways; //TODO check } public TransportSchedule getSchedule() { @@ -62,47 +62,20 @@ public class TransportRoute extends MapObject { public boolean isCombined() { return combined; } - + + public Integer calculateDistance() { + int distance = 0; + for (int i = 0; i < forwardStops.size()-1; i++) { + if (!forwardStops.get(i).isMissingStop() || !forwardStops.get(i+1).isMissingStop()) + distance += MapUtils.getDistance(forwardStops.get(i).getLocation(), forwardStops.get(i+1).getLocation()); + } + return distance; + } + public boolean isIncomplete() { return forwardStops.get(0).isMissingStop() || forwardStops.get(forwardStops.size()-1).isMissingStop(); } - public void setCombined(boolean combined) { - this.combined = combined; - } - - public TransportStop getMissingStartStop() { - return forwardStops.get(0).isMissingStop() ? forwardStops.get(0) : null; - } - - public TransportStop getMissingEndStop() { - return forwardStops.get(forwardStops.size()-1).isMissingStop() ? forwardStops.get(forwardStops.size()-1) : null; - } - - public boolean addRoutePart(TransportRoute part, boolean forward) { - //TODO chec stop validity and combine ways - int addCount = 0; - if (forward) { - routeParts.add(part); - for (int i = 0; i < part.getForwardStops().size(); i++) { - if (!part.getForwardStops().get(i).isMissingStop() && !forwardStops.contains(part.getForwardStops().get(i))) { - forwardStops.add(part.getForwardStops().get(i)); - addCount++; - } - } - } else { - routeParts.add(0, part); - for (int i = part.getForwardStops().size() - 1; i >= 0 ; i--) { - if (!part.getForwardStops().get(i).isMissingStop() && !forwardStops.contains(part.getForwardStops().get(i))) { - forwardStops.add(part.getForwardStops().get(i)); - addCount++; - } - } - } - return addCount > 0; - } - - public List getRouteParts() { return routeParts; } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index b7480d488d..01972d1970 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -821,15 +821,20 @@ public class TransportRoutePlanner { if (rrs != null && !multifileStop.isDeleted()) { for (int rr : rrs) { // here we should assign only complete routes: - TransportRoute combinedRoute = getCombinedRoute(localFileRoutes.get(rr), r.getFile().getName()); - if (combinedRoute == null) { - System.err.println(String.format("Something went wrong by loading route %d for stop %s", rr, stop)); - } else if (multifileStop == stop || - (!multifileStop.hasRoute(combinedRoute.getId()) && - !multifileStop.isRouteDeleted(combinedRoute.getId()))) { - // duplicates won't be added - multifileStop.addRouteId(combinedRoute.getId()); - multifileStop.addRoute(combinedRoute); + TransportRoute route = localFileRoutes.get(rr); + if (route == null) { + System.err.println(String.format("Something went wrong by loading combined route %d for stop %s", route.getId(), stop)); + } else { + TransportRoute combinedRoute = getCombinedRoute(route, r.getFile().getName()); + if (combinedRoute == null) { + System.err.println(String.format("Something went wrong by loading combined route %d for stop %s", route.getId(), stop)); + } else if (multifileStop == stop || + (!multifileStop.hasRoute(combinedRoute.getId()) && + !multifileStop.isRouteDeleted(combinedRoute.getId()))) { + // duplicates won't be added + multifileStop.addRouteId(combinedRoute.getId()); + multifileStop.addRoute(combinedRoute); + } } } } @@ -932,197 +937,269 @@ public class TransportRoutePlanner { TransportRoute c = combinedRoutesCache.get(route.getId()); if (c == null) { c = combineRoute(route, fileName); + combinedRoutesCache.put(route.getId(), c); } return c; } - Comparator compareByDist = (TransportRoute tr1, TransportRoute tr2) - -> ((Integer)tr1.getDistance()).compareTo((Integer)tr2.getDistance()); - private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { - List result = new ArrayList<>(findIncompleteRouteParts(route, fileName)); - List acceptedCandidates = new ArrayList(); - - TransportRoute baseRoute = route; - - if (result.size() > 1) { - //1. Sort by longest piece: - Collections.sort(result, compareByDist); - - //2. Check if any route's part contains more stops, then "base" route, - //so we could find longest part (and remove subsets and copies): - Iterator itr = result.iterator(); - boolean containsAllStops = false; - while (itr.hasNext()) { - TransportRoute candidate = itr.next(); - if (candidate.compareRoute(baseRoute)) { - itr.remove(); - continue; - } else if (candidate.getForwardStops().size() > baseRoute.getForwardStops().size()) { - for (TransportStop s : baseRoute.getForwardStops()) { - for (TransportStop cs : candidate.getForwardStops()) { - if (!s.isMissingStop() && !cs.isMissingStop()) { - if (s.getId() == cs.getId()) { - containsAllStops = true; - break; - } - containsAllStops = false; - } - } - } - if (containsAllStops) { - baseRoute = candidate; - itr.remove(); - } - } else { - for (TransportStop cs : candidate.getForwardStops()) { - for (TransportStop s: baseRoute.getForwardStops()) { - if (!s.isMissingStop() && !cs.isMissingStop()) { - if(s.getId() == cs.getId()) { - containsAllStops = true; - break; - } - containsAllStops = false; - } - } - } - if (containsAllStops) { - itr.remove(); - } - } - } - } else { - acceptedCandidates = result; - } + //1.Get all available route parts; + List result = new ArrayList<>(findIncompleteRouteParts(route)); +// List acceptedCandidates = new ArrayList(); + List allWays = getAllWays(result); - //3. Connect routes in right order (stops/ways) - TransportRoute cr = new TransportRoute(baseRoute, true); - - TransportStop missingStart = baseRoute.getMissingStartStop(); - TransportStop missingEnd = baseRoute.getMissingEndStop(); + //2. Get massive of segments: + List> segments = parseRoutePartsToSegments(result); + Collections.sort(segments, compareSegsBySize.reversed()); - List stops = baseRoute.getForwardStops(); - List ways = route.getForwardWays(); - Iterator itr = result.iterator(); - while(result.size() > 0) { - boolean success = false; - double distFromMissingEnd = -1; - double distFromMissingStart = -1; - TransportRoute part = itr.next(); - if (baseRoute.getMissingEndStop() != null && part.getMissingStartStop() != null) { - distFromMissingEnd = - MapUtils.getDistance(baseRoute.getMissingEndStop().getLocation(), part.getMissingStartStop().getLocation()); - } - if (baseRoute.getMissingStartStop() != null && part.getMissingEndStop() != null) { - distFromMissingStart = - MapUtils.getDistance(baseRoute.getMissingStartStop().getLocation(), part.getMissingEndStop().getLocation()); - } - if (distFromMissingEnd != -1) { - if ((distFromMissingStart == -1 || distFromMissingStart > distFromMissingEnd) && distFromMissingEnd < MISSING_STOP_SEARCH_RADIUS) { - //try to attach route part to end of baseRoute - if (!cr.addRoutePart(part, true)) { - //else assume that part of the route is missing and we need to attach it later - //TODO (how to check if missing part is exist at all? If there no some part of map - //we will fall in endless loop) - result.add(part); - }; - } - } else if (distFromMissingStart != -1) { - if ((distFromMissingEnd == -1 || distFromMissingStart < distFromMissingEnd) && distFromMissingStart < MISSING_STOP_SEARCH_RADIUS) { - if (!cr.addRoutePart(part, false)) { - //same thing here, need to exit loop somehow - result.add(part); - } - } - } + //3. Merge segments and remove excess missingStops (when they are closer then MISSING_STOP_SEARCH_RADIUS): + //4. Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data + List> mergedSegments = combineSegments(segments); + + //5. Create combined TransportRoute and return it + if (mergedSegments.size() > 1) { + //TODO what will we do with incomplete route? + return null; + } else { + return new TransportRoute(route, mergedSegments.get(0), allWays); } - - return cr; + } + + private List getAllWays(List parts) { + List w = new ArrayList(); + for (TransportRoute t : parts) { + w.addAll(t.getForwardWays()); + } + return w; } - private Collection findIncompleteRouteParts(TransportRoute baseRoute, String fileName) throws IOException { + Comparator> compareSegsBySize = new Comparator>() { + public int compare(List s1, List s2) { + return ((Integer)s1.size()).compareTo((Integer)s2.size()); + } + }; + + private List> combineSegments(List> segments) { + List> rawSegments = segments; + + + List> partsToDelete = new ArrayList>(); + List> partsToReturn = new ArrayList>(); + List base; + int startSize = 0; + + Iterator> segItr = rawSegments.iterator(); + while (segItr.hasNext()) { + startSize = rawSegments.size(); + partsToDelete.clear(); + partsToReturn.clear(); + base = segItr.next(); + segItr.remove(); + + TransportStop firstStopMissing = base.get(0).isMissingStop() ? base.get(0) : null; + TransportStop lastStopMissing = base.get(base.size() - 1).isMissingStop() ? base.get(base.size() - 1) + : null; + + for (int i = 0; i < segments.size(); i++) { + // compare every other piece of route with base (largest part so far) + // and if it has common stops or close missing stops try to combine + List candidate = rawSegments.get(i); + TransportStop cmss = candidate.get(0).isMissingStop() ? candidate.get(0) : null; + TransportStop cmse = candidate.get(candidate.size() - 1).isMissingStop() + ? candidate.get(candidate.size() - 1) + : null; + int csStopCount = candidate.size(); + if (cmss != null) { + csStopCount--; + } + if (cmse != null) { + csStopCount--; + } + int csSameStopsCount = 0; + for (TransportStop s : base) { + if (!s.isMissingStop()) { + for (TransportStop cs : candidate) { + if (!cs.isMissingStop() && s.getId().equals(cs.getId())) { + csSameStopsCount++; + } + } + } + } + if (csStopCount == csSameStopsCount) { + // all stops of candidate inside base, delete candidate + partsToDelete.add(candidate); + continue; + + } else { + if (csSameStopsCount > 0 && firstStopMissing != null && lastStopMissing == null + && cmse != null) { + // parts intersecting and we know what sides to connect, attach to start + base = mergeSegments(base, candidate, false); + + } else if (csSameStopsCount > 0 && lastStopMissing != null && firstStopMissing == null + && cmss != null) { + // parts intersecting and we know what sides to connect, attach to end + base = mergeSegments(base, candidate, true); + + } else { + // check for missing stops in candidate and attach accordingly + double distStartToEnd = MISSING_STOP_SEARCH_RADIUS + 1; + double distEndToStart = MISSING_STOP_SEARCH_RADIUS + 1; + if (cmss != null && lastStopMissing != null) { + distStartToEnd = MapUtils.getDistance(cmss.getLocation(), + lastStopMissing.getLocation()); + } + if (cmse != null && firstStopMissing != null) { + distEndToStart = MapUtils.getDistance(cmse.getLocation(), + firstStopMissing.getLocation()); + } + if (distStartToEnd < distEndToStart && distStartToEnd <= MISSING_STOP_SEARCH_RADIUS) { + base = mergeSegments(base, candidate, true); + } else if (distEndToStart < distStartToEnd && distEndToStart <= MISSING_STOP_SEARCH_RADIUS) { + base = mergeSegments(base, candidate, false); + } else { + if (csSameStopsCount == 0) { + // it's OK, we should look for other parts first + partsToReturn.add(candidate); + System.out.println("Candidate is not connected to Base, continue search"); + } else { + // it's not OK, if there is intersecting stops and too long distance between + // missingStops, there is some error in data + System.out.println("MERGING ERROR. THERE IS SOMETHING WRONG WITH DATA"); + } + } + } + partsToDelete.add(candidate); + } + } + for (List p : partsToDelete) { + rawSegments.remove(p); + } + rawSegments.addAll(partsToReturn); + rawSegments.add(base); + //Check if all is merged: + if (rawSegments.size() == 1) { + break; + } + //If we still have several segments, but after iteration they number didn't dwindle, + //check if we still could merge some of them or do we have a hole in the data + boolean hasValidCandidate = false; + if (rawSegments.size() == startSize) { + for (int i = 0; i < rawSegments.size()-1; i++) { + TransportStop ms = rawSegments.get(i).get(0).isMissingStop() ? rawSegments.get(i).get(0) : null; + TransportStop me = rawSegments.get(i).get(rawSegments.get(i).size()-1).isMissingStop() + ? rawSegments.get(i).get(rawSegments.get(i).size()-1) : null; + for (int j = 1; j < rawSegments.size(); j++) { + TransportStop cms = rawSegments.get(j).get(0).isMissingStop() ? rawSegments.get(j).get(0) : null; + TransportStop cme = rawSegments.get(j).get(rawSegments.get(j).size()-1).isMissingStop() + ? rawSegments.get(j).get(rawSegments.get(j).size()-1) : null; + if (ms != null && cme != null && MapUtils.getDistance(ms.getLocation(), cme.getLocation()) <= MISSING_STOP_SEARCH_RADIUS) { + hasValidCandidate = true; + } + if (me != null && cms != null && MapUtils.getDistance(me.getLocation(), cms.getLocation()) <= MISSING_STOP_SEARCH_RADIUS) { + hasValidCandidate = true; + } + //we has at least one valid pair of segments for merging + if (hasValidCandidate) { + break; + } + } + } + } + //if we could not merge any more segments - break; + if (rawSegments.size() == 1 || (rawSegments.size() == startSize && !hasValidCandidate)) { + break; + } + } + return rawSegments; + } + + private List mergeSegments(List base, List candidate, boolean forward) { + List result; + if (forward) { + result = new ArrayList<>(base.subList(0, base.size()-1)); + for (int i = 1; i < candidate.size(); i++) { + if (!result.contains(candidate.get(i))) { + result.add(candidate.get(i)); + } + } + } else { + result = new ArrayList<>(candidate.subList(0, candidate.size()-1)); + for (int i = 1; i < base.size(); i++) { + if (!result.contains(base.get(i))) { + result.add(base.get(i)); + } + } + } + return result; + } + + private List> parseRoutePartsToSegments(List routeParts) { + List> segs = new ArrayList>(); + for (TransportRoute part : routeParts) { + List newSeg = new ArrayList(); + for (TransportStop s : part.getForwardStops()) { + if (s.isMissingStop()) { + if (newSeg.isEmpty()) { + newSeg.add(s); + } else { + newSeg.add(s); + segs.add(newSeg); + newSeg = new ArrayList(); + } + } else { + newSeg.add(s); + } + } + if (!newSeg.isEmpty()) { + segs.add(newSeg); + } + } + return segs; + } + + + private Collection findIncompleteRouteParts(TransportRoute baseRoute) throws IOException { IncompleteTransportRoute ptr; TIntObjectHashMap res = new TIntObjectHashMap(); - TIntObjectHashMap localRes = new TIntObjectHashMap(); - + //TODO search only routes from bbox? for (BinaryMapIndexReader bmir: routeMap.keySet()) { -// if (!bmir.getFile().getName().equals(fileName)) { - localRes.clear(); - /** - * What about situation when one route has several parts in map? - * MB check all readers and then sort it out? - * - * Should I check if those routes already loaded? But they shouldn't, - * else we will already had a combined route and never get there! - */ - ptr = bmir.getIncompleteRoutePointers(baseRoute.getId()); - if (ptr != null && ptr.getRouteOffset() != -1) { - localRes = bmir.getTransportRoutes(new int[] {ptr.getRouteOffset()}); - res.putAll(localRes); - } -// } + /** + * TODO: Should I check if those routes already loaded? But they shouldn't, + * else we will already had a combined route and never get there! + */ + ptr = bmir.getIncompleteRoutePointers(baseRoute.getId()); + if (ptr != null && ptr.getRouteOffset() != -1) { + res.putAll(bmir.getTransportRoutes(new int[] {ptr.getRouteOffset()})); + } } return res.valueCollection(); } - - -// private TransportRoute loadMissingTransportRoute(int sx, int sy, TransportRoute route) throws IOException { -// long nanoTime = System.nanoTime(); -// List res = new ArrayList(); -// TIntObjectHashMap tr = new TIntObjectHashMap(); -// int d = missingStopRadiusIn31; -// int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); -// int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); -// int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); -// int by = (sy + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); -// for(int x = lx; x <= rx; x++) { -// for(int y = ty; y <= by; y++) { -// long tileId = (((long)x) << (cfg.ZOOM_TO_LOAD_TILES + 1)) + y; -//// List list = quadTree.get(tileId); -//// if(list == null) { -// tr = getRouteParts(x, y); -//// quadTree.put(tileId, list); -//// } -// if (!tr.isEmpty()) { -// res.addAll(tr.valueCollection()); -// } -// -// } -// } -// for (TransportRoute trr : res) { -// if ((long)trr.getId() == (long)route.getId()) { -// if (trr.getForwardStops() != route.getForwardStops()) { -// return trr; -// } -// } -// } -// -// return null; -// } - private TIntObjectHashMap getRouteParts(int x, int y) throws IOException { - int pz = (31 - cfg.ZOOM_TO_LOAD_TILES); - SearchRequest sr = BinaryMapIndexReader.buildSearchTransportRequest(x << pz, (x + 1) << pz, - y << pz, (y + 1) << pz, -1, null); - - TLongObjectHashMap loadedTransportStops = new TLongObjectHashMap(); - TIntObjectHashMap localFileRoutes = new TIntObjectHashMap<>(); - TIntObjectHashMap res = new TIntObjectHashMap(); - for (BinaryMapIndexReader r : routeMap.keySet()) { - sr.clearSearchResults(); - List stops = r.searchTransportIndex(sr); - - localFileRoutes.clear(); - //search routes here: - mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); - if (!localFileRoutes.isEmpty()) { - res.putAll(localFileRoutes); - } - } - return res; - } + +// private TIntObjectHashMap getRouteParts(int x, int y) throws IOException { +// int pz = (31 - cfg.ZOOM_TO_LOAD_TILES); +// SearchRequest sr = BinaryMapIndexReader.buildSearchTransportRequest(x << pz, (x + 1) << pz, +// y << pz, (y + 1) << pz, -1, null); +// +// TLongObjectHashMap loadedTransportStops = new TLongObjectHashMap(); +// TIntObjectHashMap localFileRoutes = new TIntObjectHashMap<>(); +// TIntObjectHashMap res = new TIntObjectHashMap(); +// for (BinaryMapIndexReader r : routeMap.keySet()) { +// sr.clearSearchResults(); +// List stops = r.searchTransportIndex(sr); +// +// localFileRoutes.clear(); +// //search routes here: +// mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); +// if (!localFileRoutes.isEmpty()) { +// res.putAll(localFileRoutes); +// } +// } +// return res; +// } private void loadTransportSegments(Collection stops, List lst) throws IOException { From 3c655c4f986f192fe49d08332ba8d19d48b55b54 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Fri, 15 May 2020 14:39:42 +0300 Subject: [PATCH 06/24] fixes --- .../osmand/binary/BinaryMapTransportReaderAdapter.java | 9 ++++++--- .../java/net/osmand/router/TransportRoutePlanner.java | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java index 617bf46f07..62ffe1af07 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java @@ -304,13 +304,16 @@ public class BinaryMapTransportReaderAdapter { dataObject.setRouteOffset(codedIS.readRawVarint32()); break; case OsmandOdb.IncompleteTransportRoute.OPERATOR_FIELD_NUMBER : - dataObject.setOperator(regStr(stringTable)); + skipUnknownField(t); +// dataObject.setOperator(regStr(stringTable)); break; case OsmandOdb.IncompleteTransportRoute.REF_FIELD_NUMBER : - dataObject.setRef(regStr(stringTable)); + skipUnknownField(t); +// dataObject.setRef(regStr(stringTable)); break; case OsmandOdb.IncompleteTransportRoute.TYPE_FIELD_NUMBER : - dataObject.setType(regStr(stringTable)); + skipUnknownField(t); +// dataObject.setType(regStr(stringTable)); break; case OsmandOdb.IncompleteTransportRoute.MISSINGSTOPS_FIELD_NUMBER : //// dataObject.getMissingStops().add(codedIS.readSInt32()); //skip for now diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 01972d1970..2a022fe6e3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -808,6 +808,10 @@ public class TransportRoutePlanner { mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); for (TransportStop stop : stops) { + //skip missing stops + if (stop.isMissingStop()) { + continue; + } long stopId = stop.getId(); TransportStop multifileStop = loadedTransportStops.get(stopId); int[] rrs = stop.getReferencesToRoutes(); @@ -947,8 +951,7 @@ public class TransportRoutePlanner { private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { //1.Get all available route parts; List result = new ArrayList<>(findIncompleteRouteParts(route)); -// List acceptedCandidates = new ArrayList(); - List allWays = getAllWays(result); + List allWays = getAllWays(result); //TODO check ways for right order? Artifacts during drawing. //2. Get massive of segments: List> segments = parseRoutePartsToSegments(result); @@ -958,9 +961,10 @@ public class TransportRoutePlanner { //4. Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data List> mergedSegments = combineSegments(segments); + //5. Create combined TransportRoute and return it if (mergedSegments.size() > 1) { - //TODO what will we do with incomplete route? + //TODO sort incomplete routes (and remove missingStops) and merge into one? return null; } else { return new TransportRoute(route, mergedSegments.get(0), allWays); From 9fe736957dbd13abb7234c454934ceb310bf935e Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Fri, 15 May 2020 14:57:06 +0300 Subject: [PATCH 07/24] clear garbage --- .../java/net/osmand/data/TransportRoute.java | 15 ++++------ .../osmand/router/TransportRoutePlanner.java | 29 +++++++++---------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index 0c222cf173..11900aee9f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -73,15 +73,12 @@ public class TransportRoute extends MapObject { } public boolean isIncomplete() { - return forwardStops.get(0).isMissingStop() || forwardStops.get(forwardStops.size()-1).isMissingStop(); - } - - public List getRouteParts() { - return routeParts; - } - - public void setRouteParts(List routeParts) { - this.routeParts = routeParts; + for (TransportStop s : forwardStops) { + if (s.isMissingStop()) { + return true; + } + } + return false; } public List getForwardStops() { diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 2a022fe6e3..7c948cf6e3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -44,8 +44,8 @@ public class TransportRoutePlanner { public List buildRoute(TransportRoutingContext ctx, LatLon start, LatLon end) throws IOException, InterruptedException { ctx.startCalcTime = System.currentTimeMillis(); - List startStops = ctx.getTransportStops(start, true, false); - List endStops = ctx.getTransportStops(end, true, false); + List startStops = ctx.getTransportStops(start); + List endStops = ctx.getTransportStops(end); TLongObjectHashMap endSegments = new TLongObjectHashMap(); for(TransportRouteSegment s : endStops) { @@ -120,7 +120,7 @@ public class TransportRoutePlanner { break; } sgms.clear(); - sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms, true, stop.isMissingStop()); + sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms); ctx.visitedStops++; for (TransportRouteSegment sgm : sgms) { if (ctx.calculationProgress != null && ctx.calculationProgress.isCancelled) { @@ -745,22 +745,20 @@ public class TransportRoutePlanner { } } - public List getTransportStops(LatLon loc, boolean completeRoutes, boolean missingStop) throws IOException { + public List getTransportStops(LatLon loc) throws IOException { int y = MapUtils.get31TileNumberY(loc.getLatitude()); int x = MapUtils.get31TileNumberX(loc.getLongitude()); - return getTransportStops(x, y, false, new ArrayList(), completeRoutes, missingStop); + return getTransportStops(x, y, false, new ArrayList()); } - public List getTransportStops(int x, int y, boolean change, List res, boolean completeRoutes, boolean missingStop) throws IOException { - return loadNativeTransportStops(x, y, change, res, completeRoutes, missingStop); + public List getTransportStops(int x, int y, boolean change, List res) throws IOException { + return loadNativeTransportStops(x, y, change, res); } - private List loadNativeTransportStops(int sx, int sy, boolean change, List res, boolean completeRoutes, boolean missingStop) throws IOException { + private List loadNativeTransportStops(int sx, int sy, boolean change, List res) throws IOException { long nanoTime = System.nanoTime(); int d = change ? walkChangeRadiusIn31 : walkRadiusIn31; - if (missingStop) { - d = missingStopRadiusIn31; - } + int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); @@ -770,7 +768,7 @@ public class TransportRoutePlanner { long tileId = (((long)x) << (cfg.ZOOM_TO_LOAD_TILES + 1)) + y; List list = quadTree.get(tileId); if(list == null) { - list = loadTile(x, y, completeRoutes); + list = loadTile(x, y); quadTree.put(tileId, list); } for(TransportRouteSegment r : list) { @@ -790,7 +788,7 @@ public class TransportRoutePlanner { } - private List loadTile(int x, int y, boolean completeRoutes) throws IOException { + private List loadTile(int x, int y) throws IOException { long nanoTime = System.nanoTime(); List lst = new ArrayList(); int pz = (31 - cfg.ZOOM_TO_LOAD_TILES); @@ -946,8 +944,7 @@ public class TransportRoutePlanner { } return c; } - - + private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { //1.Get all available route parts; List result = new ArrayList<>(findIncompleteRouteParts(route)); @@ -955,6 +952,7 @@ public class TransportRoutePlanner { //2. Get massive of segments: List> segments = parseRoutePartsToSegments(result); + //TODO check for api? reversed works only from 24th Collections.sort(segments, compareSegsBySize.reversed()); //3. Merge segments and remove excess missingStops (when they are closer then MISSING_STOP_SEARCH_RADIUS): @@ -988,7 +986,6 @@ public class TransportRoutePlanner { private List> combineSegments(List> segments) { List> rawSegments = segments; - List> partsToDelete = new ArrayList>(); List> partsToReturn = new ArrayList>(); List base; From 87f49ed3d9845e806dbd8c20b2cd19cf8d4b4e88 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 15 May 2020 17:27:59 +0200 Subject: [PATCH 08/24] Transport route --- .../osmand/router/TransportRoutePlanner.java | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 7c948cf6e3..db1b35ebf6 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -13,14 +13,10 @@ import java.util.Map; import java.util.PriorityQueue; import gnu.trove.iterator.TIntIterator; -import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.list.array.TIntArrayList; -import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TLongObjectHashMap; - import net.osmand.NativeLibrary; -import net.osmand.binary.BinaryIndexPart; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; import net.osmand.data.IncompleteTransportRoute; @@ -32,7 +28,6 @@ import net.osmand.data.TransportStop; import net.osmand.data.TransportStopExit; import net.osmand.osm.edit.Node; import net.osmand.osm.edit.Way; -import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; public class TransportRoutePlanner { @@ -822,10 +817,11 @@ public class TransportRoutePlanner { } if (rrs != null && !multifileStop.isDeleted()) { for (int rr : rrs) { - // here we should assign only complete routes: TransportRoute route = localFileRoutes.get(rr); if (route == null) { - System.err.println(String.format("Something went wrong by loading combined route %d for stop %s", route.getId(), stop)); + System.err.println( + String.format("Something went wrong by loading combined route %d for stop %s", + rr, stop)); } else { TransportRoute combinedRoute = getCombinedRoute(route, r.getFile().getName()); if (combinedRoute == null) { @@ -946,25 +942,24 @@ public class TransportRoutePlanner { } private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { - //1.Get all available route parts; + // 1. Get all available route parts; List result = new ArrayList<>(findIncompleteRouteParts(route)); List allWays = getAllWays(result); //TODO check ways for right order? Artifacts during drawing. - //2. Get massive of segments: + // 2. Get array of segments: List> segments = parseRoutePartsToSegments(result); - //TODO check for api? reversed works only from 24th - Collections.sort(segments, compareSegsBySize.reversed()); + Collections.sort(segments, compareSegsBySize); - //3. Merge segments and remove excess missingStops (when they are closer then MISSING_STOP_SEARCH_RADIUS): - //4. Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data + // 3. Merge segments and remove excess missingStops (when they are closer then MISSING_STOP_SEARCH_RADIUS): + // 4. Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data List> mergedSegments = combineSegments(segments); - //5. Create combined TransportRoute and return it - if (mergedSegments.size() > 1) { - //TODO sort incomplete routes (and remove missingStops) and merge into one? - return null; - } else { + // 5. Create combined TransportRoute and return it + if (mergedSegments.size() > 1 || mergedSegments.size() == 0) { + // TODO sort incomplete routes (and remove missingStops) and merge into one? + return route; + } else { return new TransportRoute(route, mergedSegments.get(0), allWays); } } @@ -978,8 +973,8 @@ public class TransportRoutePlanner { } Comparator> compareSegsBySize = new Comparator>() { - public int compare(List s1, List s2) { - return ((Integer)s1.size()).compareTo((Integer)s2.size()); + public int compare(List s1, List s2) { + return -Integer.compare(s1.size(), s2.size()); } }; From 99503fdec5b1a6139bde6af4707d776779a33c78 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 16:03:54 +0200 Subject: [PATCH 09/24] Update transport rotues --- .../osmand/binary/BinaryMapIndexReader.java | 1 - .../BinaryMapTransportReaderAdapter.java | 16 ++-- .../osmand/data/IncompleteTransportRoute.java | 31 +++++--- .../java/net/osmand/data/TransportRoute.java | 3 +- .../java/net/osmand/osm/edit/Relation.java | 17 ++++- .../osmand/router/TransportRoutePlanner.java | 76 ++++++++----------- 6 files changed, 73 insertions(+), 71 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java index b3f4a5ea22..3474affe41 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java @@ -19,7 +19,6 @@ import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion; import net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex; -import net.osmand.binary.OsmandOdb.IncompleteTransportRoute; import net.osmand.binary.OsmandOdb.MapDataBlock; import net.osmand.binary.OsmandOdb.OsmAndMapIndex.MapDataBox; import net.osmand.binary.OsmandOdb.OsmAndMapIndex.MapEncodingRule; diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java index 62ffe1af07..13d9732f7b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java @@ -1,20 +1,16 @@ package net.osmand.binary; import java.io.IOException; -import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Map; import com.google.protobuf.CodedInputStream; import com.google.protobuf.WireFormat; -import gnu.trove.list.array.TLongArrayList; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TLongObjectHashMap; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; -import net.osmand.binary.OsmandOdb.IncompleteTransportRoute; import net.osmand.data.TransportSchedule; import net.osmand.data.TransportStop; import net.osmand.data.TransportStopExit; @@ -261,8 +257,6 @@ public class BinaryMapTransportReaderAdapter { private void readIncompleteRoutesList(TLongObjectHashMap incompleteRoutes, int length, int offset, TIntObjectHashMap stringTable) throws IOException { codedIS.seek(offset); - - List irs = new ArrayList<>(); boolean end = false; while (!end) { int t = codedIS.readTag(); @@ -275,7 +269,12 @@ public class BinaryMapTransportReaderAdapter { int l = codedIS.readRawVarint32(); int olds = codedIS.pushLimit(l); net.osmand.data.IncompleteTransportRoute ir = readIncompleteRoute(stringTable); - incompleteRoutes.put(ir.getRouteId(), ir); + net.osmand.data.IncompleteTransportRoute itr = incompleteRoutes.get(ir.getRouteId()); + if(itr != null) { + itr.setNextLinkedRoute(ir); + } else { + incompleteRoutes.put(ir.getRouteId(), ir); + } codedIS.popLimit(olds); break; default: @@ -316,7 +315,7 @@ public class BinaryMapTransportReaderAdapter { // dataObject.setType(regStr(stringTable)); break; case OsmandOdb.IncompleteTransportRoute.MISSINGSTOPS_FIELD_NUMBER : -//// dataObject.getMissingStops().add(codedIS.readSInt32()); //skip for now +// dataObject.getMissingStops().add(codedIS.readSInt32()); //skip for now skipUnknownField(t); break; default: @@ -482,7 +481,6 @@ public class BinaryMapTransportReaderAdapter { codedIS.seek(ind.stringTable.fileOffset); int oldLimit = codedIS.pushLimit(ind.stringTable.length); int current = 0; - int i = 0; while (codedIS.getBytesUntilLimit() > 0) { int t = codedIS.readTag(); int tag = WireFormat.getTagFieldNumber(t); diff --git a/OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java index eb84be3453..84be533a5f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/IncompleteTransportRoute.java @@ -1,50 +1,59 @@ package net.osmand.data; -import gnu.trove.list.array.TIntArrayList; - public class IncompleteTransportRoute { private long routeId; private int routeOffset = -1; private String operator; private String type; private String ref; -// private TIntArrayList missingStops; //not needed + private IncompleteTransportRoute nextLinkedRoute; + + public IncompleteTransportRoute getNextLinkedRoute() { + return nextLinkedRoute; + } + + public void setNextLinkedRoute(IncompleteTransportRoute nextLinkedRoute) { + this.nextLinkedRoute = nextLinkedRoute; + } + public long getRouteId() { return routeId; } + public void setRouteId(long routeId) { this.routeId = routeId; } + public int getRouteOffset() { return routeOffset; } + public void setRouteOffset(int routeOffset) { this.routeOffset = routeOffset; } + public String getOperator() { return operator; } + public void setOperator(String operator) { this.operator = operator; } + public String getType() { return type; } + public void setType(String type) { this.type = type; } + public String getRef() { return ref; } + public void setRef(String ref) { this.ref = ref; } -// public TIntArrayList getMissingStops() { -// return missingStops; -// } -// public void setMissingStops(TIntArrayList missingStops) { -// this.missingStops = missingStops; -// } - - + } \ No newline at end of file diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index 11900aee9f..b0df8f2adf 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -27,7 +27,6 @@ public class TransportRoute extends MapObject { private TransportSchedule schedule; public static final double SAME_STOP = 40; private boolean combined = false; - private List routeParts = new ArrayList(); public TransportRoute() { } @@ -45,7 +44,7 @@ public class TransportRoute extends MapObject { this.combined = true; this.forwardStops = mergedSegment; this.dist = calculateDistance(); - this.forwardWays = ways; //TODO check + this.forwardWays = ways; } public TransportSchedule getSchedule() { diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/edit/Relation.java b/OsmAnd-java/src/main/java/net/osmand/osm/edit/Relation.java index 6531eb8def..1e3443af19 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/edit/Relation.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/edit/Relation.java @@ -54,10 +54,14 @@ public class Relation extends Entity { } public void addMember(Long id, EntityType type, String role){ + addMember(new EntityId(type, id), role); + } + + public void addMember(EntityId id, String role){ if(members == null){ members = new ArrayList<>(); } - members.add(new RelationMember(new EntityId(type, id), role)); + members.add(new RelationMember(id, role)); } public List getMembers(String role) { @@ -115,7 +119,16 @@ public class Relation extends Entity { public LatLon getLatLon() { return null; } - + + public void update(RelationMember r, EntityId newEntityId) { + r.entity = null; + r.entityId = newEntityId; + } + + public void updateRole(RelationMember r, String newRole) { + r.role = newRole; + } + public boolean remove(EntityId key) { if(members != null) { Iterator it = members.iterator(); diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index db1b35ebf6..4fc7f69141 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -823,7 +823,7 @@ public class TransportRoutePlanner { String.format("Something went wrong by loading combined route %d for stop %s", rr, stop)); } else { - TransportRoute combinedRoute = getCombinedRoute(route, r.getFile().getName()); + TransportRoute combinedRoute = getCombinedRoute(route); if (combinedRoute == null) { System.err.println(String.format("Something went wrong by loading combined route %d for stop %s", route.getId(), stop)); } else if (multifileStop == stop || @@ -928,26 +928,30 @@ public class TransportRoutePlanner { return stops; } - private TransportRoute getCombinedRoute(TransportRoute route, String fileName) throws IOException { + private TransportRoute getCombinedRoute(TransportRoute route) throws IOException { if (!route.isIncomplete()) { return route; } TransportRoute c = combinedRoutesCache.get(route.getId()); if (c == null) { - c = combineRoute(route, fileName); - + c = combineRoute(route); combinedRoutesCache.put(route.getId(), c); } return c; } - private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { + private TransportRoute combineRoute(TransportRoute route) throws IOException { + // 1. Get all available route parts; - List result = new ArrayList<>(findIncompleteRouteParts(route)); - List allWays = getAllWays(result); //TODO check ways for right order? Artifacts during drawing. + List incompleteRoutes = findIncompleteRouteParts(route); + if (incompleteRoutes == null) { + return route; + } + + List allWays = getAllWays(incompleteRoutes); //TODO check ways for right order? Artifacts during drawing. // 2. Get array of segments: - List> segments = parseRoutePartsToSegments(result); + List> segments = parseRoutePartsToSegments(incompleteRoutes); Collections.sort(segments, compareSegsBySize); // 3. Merge segments and remove excess missingStops (when they are closer then MISSING_STOP_SEARCH_RADIUS): @@ -1156,48 +1160,28 @@ public class TransportRoutePlanner { return segs; } - - private Collection findIncompleteRouteParts(TransportRoute baseRoute) throws IOException { - IncompleteTransportRoute ptr; - TIntObjectHashMap res = new TIntObjectHashMap(); - //TODO search only routes from bbox? - for (BinaryMapIndexReader bmir: routeMap.keySet()) { - /** - * TODO: Should I check if those routes already loaded? But they shouldn't, - * else we will already had a combined route and never get there! - */ - ptr = bmir.getIncompleteRoutePointers(baseRoute.getId()); - if (ptr != null && ptr.getRouteOffset() != -1) { - res.putAll(bmir.getTransportRoutes(new int[] {ptr.getRouteOffset()})); + private List findIncompleteRouteParts(TransportRoute baseRoute) throws IOException { + List allRoutes = null; + // TODO completely irrelevant always reiteration over all maps + for (BinaryMapIndexReader bmir : routeMap.keySet()) { + IncompleteTransportRoute ptr = bmir.getIncompleteRoutePointers(baseRoute.getId()); + if (ptr != null) { + TIntArrayList lst = new TIntArrayList(); + while(ptr != null) { + lst.add(ptr.getRouteOffset()); + ptr = ptr.getNextLinkedRoute(); + } + if(lst.size() > 0) { + if(allRoutes == null) { + allRoutes = new ArrayList(); + } + allRoutes.addAll(bmir.getTransportRoutes(lst.toArray()).valueCollection()); + } } } - return res.valueCollection(); + return allRoutes; } - -// private TIntObjectHashMap getRouteParts(int x, int y) throws IOException { -// int pz = (31 - cfg.ZOOM_TO_LOAD_TILES); -// SearchRequest sr = BinaryMapIndexReader.buildSearchTransportRequest(x << pz, (x + 1) << pz, -// y << pz, (y + 1) << pz, -1, null); -// -// TLongObjectHashMap loadedTransportStops = new TLongObjectHashMap(); -// TIntObjectHashMap localFileRoutes = new TIntObjectHashMap<>(); -// TIntObjectHashMap res = new TIntObjectHashMap(); -// for (BinaryMapIndexReader r : routeMap.keySet()) { -// sr.clearSearchResults(); -// List stops = r.searchTransportIndex(sr); -// -// localFileRoutes.clear(); -// //search routes here: -// mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); -// if (!localFileRoutes.isEmpty()) { -// res.putAll(localFileRoutes); -// } -// } -// return res; -// } - - private void loadTransportSegments(Collection stops, List lst) throws IOException { for(TransportStop s : stops) { if (s.isDeleted() || s.getRoutes() == null) { From b456c41b341e7f1bd6c60c08abc4b0ab816770e6 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 16:33:59 +0200 Subject: [PATCH 10/24] Update transport rotues --- .../osmand/router/TransportRoutePlanner.java | 272 +++++++----------- 1 file changed, 100 insertions(+), 172 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 4fc7f69141..0143e17b64 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -8,10 +8,12 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.PriorityQueue; + import gnu.trove.iterator.TIntIterator; import gnu.trove.list.array.TIntArrayList; import gnu.trove.map.hash.TIntObjectHashMap; @@ -941,31 +943,33 @@ public class TransportRoutePlanner { } private TransportRoute combineRoute(TransportRoute route) throws IOException { - // 1. Get all available route parts; List incompleteRoutes = findIncompleteRouteParts(route); if (incompleteRoutes == null) { return route; } + // here could be multiple overlays between same points + // It's better to remove them especially identical segments + List allWays = getAllWays(incompleteRoutes); - List allWays = getAllWays(incompleteRoutes); //TODO check ways for right order? Artifacts during drawing. // 2. Get array of segments: - List> segments = parseRoutePartsToSegments(incompleteRoutes); - Collections.sort(segments, compareSegsBySize); + LinkedList> stopSegments = parseRoutePartsToSegments(incompleteRoutes); // 3. Merge segments and remove excess missingStops (when they are closer then MISSING_STOP_SEARCH_RADIUS): - // 4. Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data - List> mergedSegments = combineSegments(segments); + // + Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data + List> mergedSegments = combineSegmentsOfSameRoute(stopSegments); + // 4. Now we need to properly sort segments, proper sorting is minimizing distance between stops + // So it is salesman problem, we have this solution at TspAnt, but if we know last or first segment we can solve it straightforward - // 5. Create combined TransportRoute and return it - if (mergedSegments.size() > 1 || mergedSegments.size() == 0) { - // TODO sort incomplete routes (and remove missingStops) and merge into one? - return route; - } else { - return new TransportRoute(route, mergedSegments.get(0), allWays); + // TODO + List finalList = new ArrayList(); + for(List s : mergedSegments) { + finalList.addAll(s); } + // 5. Create combined TransportRoute and return it + return new TransportRoute(route, finalList, allWays); } private List getAllWays(List parts) { @@ -976,181 +980,105 @@ public class TransportRoutePlanner { return w; } - Comparator> compareSegsBySize = new Comparator>() { - public int compare(List s1, List s2) { - return -Integer.compare(s1.size(), s2.size()); - } - }; - private List> combineSegments(List> segments) { - List> rawSegments = segments; - - List> partsToDelete = new ArrayList>(); - List> partsToReturn = new ArrayList>(); - List base; - int startSize = 0; - - Iterator> segItr = rawSegments.iterator(); - while (segItr.hasNext()) { - startSize = rawSegments.size(); - partsToDelete.clear(); - partsToReturn.clear(); - base = segItr.next(); - segItr.remove(); - - TransportStop firstStopMissing = base.get(0).isMissingStop() ? base.get(0) : null; - TransportStop lastStopMissing = base.get(base.size() - 1).isMissingStop() ? base.get(base.size() - 1) - : null; - - for (int i = 0; i < segments.size(); i++) { - // compare every other piece of route with base (largest part so far) - // and if it has common stops or close missing stops try to combine - List candidate = rawSegments.get(i); - TransportStop cmss = candidate.get(0).isMissingStop() ? candidate.get(0) : null; - TransportStop cmse = candidate.get(candidate.size() - 1).isMissingStop() - ? candidate.get(candidate.size() - 1) - : null; - int csStopCount = candidate.size(); - if (cmss != null) { - csStopCount--; - } - if (cmse != null) { - csStopCount--; - } - int csSameStopsCount = 0; - for (TransportStop s : base) { - if (!s.isMissingStop()) { - for (TransportStop cs : candidate) { - if (!cs.isMissingStop() && s.getId().equals(cs.getId())) { - csSameStopsCount++; - } - } - } - } - if (csStopCount == csSameStopsCount) { - // all stops of candidate inside base, delete candidate - partsToDelete.add(candidate); - continue; - - } else { - if (csSameStopsCount > 0 && firstStopMissing != null && lastStopMissing == null - && cmse != null) { - // parts intersecting and we know what sides to connect, attach to start - base = mergeSegments(base, candidate, false); - - } else if (csSameStopsCount > 0 && lastStopMissing != null && firstStopMissing == null - && cmss != null) { - // parts intersecting and we know what sides to connect, attach to end - base = mergeSegments(base, candidate, true); - - } else { - // check for missing stops in candidate and attach accordingly - double distStartToEnd = MISSING_STOP_SEARCH_RADIUS + 1; - double distEndToStart = MISSING_STOP_SEARCH_RADIUS + 1; - if (cmss != null && lastStopMissing != null) { - distStartToEnd = MapUtils.getDistance(cmss.getLocation(), - lastStopMissing.getLocation()); - } - if (cmse != null && firstStopMissing != null) { - distEndToStart = MapUtils.getDistance(cmse.getLocation(), - firstStopMissing.getLocation()); - } - if (distStartToEnd < distEndToStart && distStartToEnd <= MISSING_STOP_SEARCH_RADIUS) { - base = mergeSegments(base, candidate, true); - } else if (distEndToStart < distStartToEnd && distEndToStart <= MISSING_STOP_SEARCH_RADIUS) { - base = mergeSegments(base, candidate, false); - } else { - if (csSameStopsCount == 0) { - // it's OK, we should look for other parts first - partsToReturn.add(candidate); - System.out.println("Candidate is not connected to Base, continue search"); - } else { - // it's not OK, if there is intersecting stops and too long distance between - // missingStops, there is some error in data - System.out.println("MERGING ERROR. THERE IS SOMETHING WRONG WITH DATA"); - } - } - } - partsToDelete.add(candidate); - } - } - for (List p : partsToDelete) { - rawSegments.remove(p); - } - rawSegments.addAll(partsToReturn); - rawSegments.add(base); - //Check if all is merged: - if (rawSegments.size() == 1) { - break; - } - //If we still have several segments, but after iteration they number didn't dwindle, - //check if we still could merge some of them or do we have a hole in the data - boolean hasValidCandidate = false; - if (rawSegments.size() == startSize) { - for (int i = 0; i < rawSegments.size()-1; i++) { - TransportStop ms = rawSegments.get(i).get(0).isMissingStop() ? rawSegments.get(i).get(0) : null; - TransportStop me = rawSegments.get(i).get(rawSegments.get(i).size()-1).isMissingStop() - ? rawSegments.get(i).get(rawSegments.get(i).size()-1) : null; - for (int j = 1; j < rawSegments.size(); j++) { - TransportStop cms = rawSegments.get(j).get(0).isMissingStop() ? rawSegments.get(j).get(0) : null; - TransportStop cme = rawSegments.get(j).get(rawSegments.get(j).size()-1).isMissingStop() - ? rawSegments.get(j).get(rawSegments.get(j).size()-1) : null; - if (ms != null && cme != null && MapUtils.getDistance(ms.getLocation(), cme.getLocation()) <= MISSING_STOP_SEARCH_RADIUS) { - hasValidCandidate = true; - } - if (me != null && cms != null && MapUtils.getDistance(me.getLocation(), cms.getLocation()) <= MISSING_STOP_SEARCH_RADIUS) { - hasValidCandidate = true; - } - //we has at least one valid pair of segments for merging - if (hasValidCandidate) { - break; - } + + private List> combineSegmentsOfSameRoute(LinkedList> segments) { + List> resultSegments = new ArrayList>(); + while (!segments.isEmpty()) { + List firstSegment = segments.poll(); + boolean merged = true; + while (merged) { + merged = false; + Iterator> it = segments.iterator(); + while (it.hasNext()) { + List segmentToMerge = it.next(); + merged = tryToMerge(firstSegment, segmentToMerge); + if (merged) { + it.remove(); + break; } } } - //if we could not merge any more segments - break; - if (rawSegments.size() == 1 || (rawSegments.size() == startSize && !hasValidCandidate)) { - break; + resultSegments.add(firstSegment); + } + return resultSegments; + } + + private boolean tryToMerge(List firstSegment, List segmentToMerge) { + if(firstSegment.size() < 2 || segmentToMerge.size() < 2) { + return false; + } + // 1st we check that segments overlap by stop + int commonStopFirst = 0; + int commonStopSecond = 0; + for(;commonStopFirst < firstSegment.size(); commonStopFirst++) { + for(; commonStopSecond < segmentToMerge.size(); commonStopSecond++ ) { + long lid1 = firstSegment.get(commonStopFirst).getId(); + long lid2 = segmentToMerge.get(commonStopSecond).getId(); + if(lid1 > 0 && lid2 == lid1) { + break; + } } } - return rawSegments; + if(commonStopFirst < firstSegment.size()) { + // we've found common stop so we can merge based on stops + // merge last part first + if(firstSegment.size() - commonStopFirst < segmentToMerge.size() - commonStopSecond) { + while(firstSegment.size() > commonStopFirst) { + firstSegment.remove(firstSegment.size() - 1); + } + for(int i = commonStopSecond; i < segmentToMerge.size(); i++) { + firstSegment.add(segmentToMerge.get(i)); + } + } + // merge first part + if(commonStopFirst < commonStopSecond) { + for(int i = 0; i < commonStopFirst; i++) { + firstSegment.remove(0); + } + for(int i = commonStopSecond; i >= 0; i--) { + firstSegment.add(0, segmentToMerge.get(i)); + } + } + return true; + + } + // no common stops, so try to connect to the end or beginning + // beginning + boolean merged = false; + if (MapUtils.getDistance(firstSegment.get(0).getLocation(), + segmentToMerge.get(segmentToMerge.size() - 1).getLocation()) < MISSING_STOP_SEARCH_RADIUS) { + firstSegment.remove(0); + for(int i = segmentToMerge.size() - 2; i >= 0; i--) { + firstSegment.add(0, segmentToMerge.get(i)); + } + merged = true; + } else if(MapUtils.getDistance(firstSegment.get(firstSegment.size() - 1).getLocation(), + segmentToMerge.get(0).getLocation()) < MISSING_STOP_SEARCH_RADIUS) { + firstSegment.remove(firstSegment.size() - 1); + for(int i = 1; i < segmentToMerge.size(); i++) { + firstSegment.add(segmentToMerge.get(i)); + } + merged = true; + } + return merged; } + - private List mergeSegments(List base, List candidate, boolean forward) { - List result; - if (forward) { - result = new ArrayList<>(base.subList(0, base.size()-1)); - for (int i = 1; i < candidate.size(); i++) { - if (!result.contains(candidate.get(i))) { - result.add(candidate.get(i)); - } - } - } else { - result = new ArrayList<>(candidate.subList(0, candidate.size()-1)); - for (int i = 1; i < base.size(); i++) { - if (!result.contains(base.get(i))) { - result.add(base.get(i)); - } - } - } - return result; - } - private List> parseRoutePartsToSegments(List routeParts) { - List> segs = new ArrayList>(); + private LinkedList> parseRoutePartsToSegments(List routeParts) { + LinkedList> segs = new LinkedList>(); + // here we assume that missing stops come in pairs + // TODO check generation that are doubles for (TransportRoute part : routeParts) { - List newSeg = new ArrayList(); + List newSeg = new ArrayList(); for (TransportStop s : part.getForwardStops()) { + newSeg.add(s); if (s.isMissingStop()) { - if (newSeg.isEmpty()) { - newSeg.add(s); - } else { - newSeg.add(s); + if (!newSeg.isEmpty()) { segs.add(newSeg); newSeg = new ArrayList(); } - } else { - newSeg.add(s); } } if (!newSeg.isEmpty()) { From 52fec9c7cc46f8455b9e13a1c36ef5e04d813b66 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 16:48:01 +0200 Subject: [PATCH 11/24] Update transport rotues --- .../osmand/router/TransportRoutePlanner.java | 53 ++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 0143e17b64..2bf64242ae 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -953,7 +953,7 @@ public class TransportRoutePlanner { List allWays = getAllWays(incompleteRoutes); - // 2. Get array of segments: + // 2. Get array of segments (each array size > 1): LinkedList> stopSegments = parseRoutePartsToSegments(incompleteRoutes); // 3. Merge segments and remove excess missingStops (when they are closer then MISSING_STOP_SEARCH_RADIUS): @@ -962,16 +962,57 @@ public class TransportRoutePlanner { // 4. Now we need to properly sort segments, proper sorting is minimizing distance between stops // So it is salesman problem, we have this solution at TspAnt, but if we know last or first segment we can solve it straightforward - - // TODO + List firstSegment = null; + List lastSegment = null; + for(List l : mergedSegments) { + if(!l.get(0).isMissingStop()) { + firstSegment = l; + } + if(!l.get(l.size() - 1).isMissingStop()) { + lastSegment = l; + } + } + List> sortedSegments = new ArrayList>(); + if(firstSegment != null) { + sortedSegments.add(firstSegment); + while(!mergedSegments.isEmpty()) { + List last = sortedSegments.get(sortedSegments.size() - 1); + List add = findAndDeleteMinDistance(last.get(last.size() - 1).getLocation(), mergedSegments, true); + sortedSegments.add(add); + } + + } else if(lastSegment != null) { + while(!mergedSegments.isEmpty()) { + List first = sortedSegments.get(0); + List add = findAndDeleteMinDistance(first.get(0).getLocation(), mergedSegments, false); + sortedSegments.add(0, add); + } + } else { + sortedSegments = mergedSegments; + } List finalList = new ArrayList(); - for(List s : mergedSegments) { + for(List s : sortedSegments) { finalList.addAll(s); } // 5. Create combined TransportRoute and return it return new TransportRoute(route, finalList, allWays); } + private List findAndDeleteMinDistance(LatLon location, List> mergedSegments, + boolean attachToBegin) { + int ind = attachToBegin ? 0 : mergedSegments.get(0).size() - 1; + double minDist = MapUtils.getDistance(mergedSegments.get(0).get(ind).getLocation(), location); + int minInd = 0; + for(int i = 1; i < mergedSegments.size(); i++) { + ind = attachToBegin ? 0 : mergedSegments.get(i).size() - 1; + double dist = MapUtils.getDistance(mergedSegments.get(i).get(ind).getLocation(), location); + if(dist < minDist) { + minInd = i; + } + } + return mergedSegments.remove(minInd); + } + private List getAllWays(List parts) { List w = new ArrayList(); for (TransportRoute t : parts) { @@ -1075,13 +1116,13 @@ public class TransportRoutePlanner { for (TransportStop s : part.getForwardStops()) { newSeg.add(s); if (s.isMissingStop()) { - if (!newSeg.isEmpty()) { + if (newSeg.size() > 1) { segs.add(newSeg); newSeg = new ArrayList(); } } } - if (!newSeg.isEmpty()) { + if (newSeg.size() > 1) { segs.add(newSeg); } } From e5bd6cb065ab46cdbf177773f7a90f8a8df2c67b Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 16:49:17 +0200 Subject: [PATCH 12/24] Update transport rotues --- .../src/main/java/net/osmand/router/TransportRoutePlanner.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 2bf64242ae..b4d59be05f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -982,6 +982,7 @@ public class TransportRoutePlanner { } } else if(lastSegment != null) { + sortedSegments.add(lastSegment); while(!mergedSegments.isEmpty()) { List first = sortedSegments.get(0); List add = findAndDeleteMinDistance(first.get(0).getLocation(), mergedSegments, false); From 4873ab04a95af48214f5db6bcfe6d9accc12425b Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 16:51:51 +0200 Subject: [PATCH 13/24] Update transport rotues --- .../net/osmand/router/TransportRoutePlanner.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index b4d59be05f..1548bba2f3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -803,13 +803,14 @@ public class TransportRoutePlanner { mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); for (TransportStop stop : stops) { - //skip missing stops + // skip missing stops if (stop.isMissingStop()) { continue; } long stopId = stop.getId(); TransportStop multifileStop = loadedTransportStops.get(stopId); int[] rrs = stop.getReferencesToRoutes(); + // TODO what is this? if (multifileStop == stop) { // clear up so it won't be used as it is multi file stop stop.setReferencesToRoutes(null); @@ -826,10 +827,7 @@ public class TransportRoutePlanner { rr, stop)); } else { TransportRoute combinedRoute = getCombinedRoute(route); - if (combinedRoute == null) { - System.err.println(String.format("Something went wrong by loading combined route %d for stop %s", route.getId(), stop)); - } else if (multifileStop == stop || - (!multifileStop.hasRoute(combinedRoute.getId()) && + if (multifileStop == stop || (!multifileStop.hasRoute(combinedRoute.getId()) && !multifileStop.isRouteDeleted(combinedRoute.getId()))) { // duplicates won't be added multifileStop.addRouteId(combinedRoute.getId()); @@ -853,16 +851,12 @@ public class TransportRoutePlanner { List stops, TIntObjectHashMap localFileRoutes, TIntObjectHashMap loadedRoutes -// boolean processMissingStop ) throws IOException { TIntArrayList routesToLoad = new TIntArrayList(); TIntArrayList localRoutesToLoad = new TIntArrayList(); Iterator it = stops.iterator(); while (it.hasNext()) { TransportStop stop = it.next(); -// if (stop.isMissingStop() && !processMissingStop) { -// continue; -// } long stopId = stop.getId(); localRoutesToLoad.clear(); TransportStop multifileStop = loadedTransportStops.get(stopId); From 7319a235c0c778c089c9b6b935d7e27f1ea2ffb8 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 17:12:34 +0200 Subject: [PATCH 14/24] Lazy loading reading --- .../osmand/binary/BinaryMapIndexReader.java | 26 +++++++++++-------- .../BinaryMapTransportReaderAdapter.java | 17 +++++------- .../osmand/router/TransportRoutePlanner.java | 4 +-- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java index 3474affe41..ae64660ea0 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java @@ -3,6 +3,7 @@ package net.osmand.binary; import com.google.protobuf.CodedInputStream; import com.google.protobuf.CodedOutputStream; +import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.WireFormat; import net.osmand.Collator; @@ -26,6 +27,7 @@ import net.osmand.binary.OsmandOdb.OsmAndMapIndex.MapRootLevel; import net.osmand.data.Amenity; import net.osmand.data.Building; import net.osmand.data.City; +import net.osmand.data.IncompleteTransportRoute; import net.osmand.data.LatLon; import net.osmand.data.MapObject; import net.osmand.data.Street; @@ -54,7 +56,6 @@ import java.io.InputStreamReader; import java.io.RandomAccessFile; import java.io.Reader; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -110,9 +111,7 @@ public class BinaryMapIndexReader { /*private*/ List transportIndexes = new ArrayList(); /*private*/ List routingIndexes = new ArrayList(); /*private*/ List indexes = new ArrayList(); - - private final TLongObjectHashMap incompleteRoutes = - new TLongObjectHashMap(); + TLongObjectHashMap incompleteTransportRoutes = null; protected CodedInputStream codedIS; @@ -227,7 +226,7 @@ public class BinaryMapIndexReader { ind.filePointer = codedIS.getTotalBytesRead(); if (transportAdapter != null) { oldLimit = codedIS.pushLimit(ind.length); - transportAdapter.readTransportIndex(ind, incompleteRoutes); + transportAdapter.readTransportIndex(ind); codedIS.popLimit(oldLimit); transportIndexes.add(ind); indexes.add(ind); @@ -2635,12 +2634,17 @@ public class BinaryMapIndexReader { } } - public net.osmand.data.IncompleteTransportRoute getIncompleteRoutePointers(long id) { - return incompleteRoutes.get(id); - } - - public Collection getIncompleteRoutes() { - return incompleteRoutes.valueCollection(); + public TLongObjectHashMap getIncompleteTransportRoutes() throws InvalidProtocolBufferException, IOException { + if (incompleteTransportRoutes == null) { + incompleteTransportRoutes = new TLongObjectHashMap<>(); + for (TransportIndex ti : transportIndexes) { + if (ti.incompleteRoutesLength > 0) { + transportAdapter.readIncompleteRoutesList(incompleteTransportRoutes, ti.incompleteRoutesLength, + ti.incompleteRoutesOffset); + } + } + } + return incompleteTransportRoutes; } diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java index 13d9732f7b..049fc161eb 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapTransportReaderAdapter.java @@ -83,7 +83,7 @@ public class BinaryMapTransportReaderAdapter { } - protected void readTransportIndex(TransportIndex ind, TLongObjectHashMap incompleteRoutes) throws IOException { + protected void readTransportIndex(TransportIndex ind) throws IOException { while(true){ int t = codedIS.readTag(); int tag = WireFormat.getTagFieldNumber(t); @@ -113,13 +113,9 @@ public class BinaryMapTransportReaderAdapter { codedIS.seek(st.length + st.fileOffset); break; case OsmandOdb.OsmAndTransportIndex.INCOMPLETEROUTES_FIELD_NUMBER : - TIntObjectHashMap stab = new TIntObjectHashMap(); ind.incompleteRoutesLength = codedIS.readRawVarint32(); ind.incompleteRoutesOffset = codedIS.getTotalBytesRead(); - int oldl = codedIS.pushLimit(ind.incompleteRoutesLength); - //may be we should start caching stringTable in advance? - readIncompleteRoutesList(incompleteRoutes, ind.incompleteRoutesLength, ind.incompleteRoutesOffset, stab); - codedIS.popLimit(oldl); + codedIS.seek(ind.incompleteRoutesLength + ind.incompleteRoutesOffset); break; default: @@ -128,6 +124,7 @@ public class BinaryMapTransportReaderAdapter { } } } + private void readTransportBounds(TransportIndex ind) throws IOException { while(true){ @@ -254,8 +251,8 @@ public class BinaryMapTransportReaderAdapter { return ((char) i)+""; } - private void readIncompleteRoutesList(TLongObjectHashMap incompleteRoutes, - int length, int offset, TIntObjectHashMap stringTable) throws IOException { + public void readIncompleteRoutesList(TLongObjectHashMap incompleteRoutes, + int length, int offset) throws IOException { codedIS.seek(offset); boolean end = false; while (!end) { @@ -268,7 +265,7 @@ public class BinaryMapTransportReaderAdapter { case OsmandOdb.IncompleteTransportRoutes.ROUTES_FIELD_NUMBER: int l = codedIS.readRawVarint32(); int olds = codedIS.pushLimit(l); - net.osmand.data.IncompleteTransportRoute ir = readIncompleteRoute(stringTable); + net.osmand.data.IncompleteTransportRoute ir = readIncompleteRoute(); net.osmand.data.IncompleteTransportRoute itr = incompleteRoutes.get(ir.getRouteId()); if(itr != null) { itr.setNextLinkedRoute(ir); @@ -286,7 +283,7 @@ public class BinaryMapTransportReaderAdapter { } - public net.osmand.data.IncompleteTransportRoute readIncompleteRoute(TIntObjectHashMap stringTable) throws IOException { + public net.osmand.data.IncompleteTransportRoute readIncompleteRoute() throws IOException { net.osmand.data.IncompleteTransportRoute dataObject = new net.osmand.data.IncompleteTransportRoute(); boolean end = false; while(!end){ diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 1548bba2f3..9ca8d2a609 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -1126,9 +1126,9 @@ public class TransportRoutePlanner { private List findIncompleteRouteParts(TransportRoute baseRoute) throws IOException { List allRoutes = null; - // TODO completely irrelevant always reiteration over all maps + // TODO completely irrelevant always reiteration over all maps (especially not in bbox of the route probabl) for (BinaryMapIndexReader bmir : routeMap.keySet()) { - IncompleteTransportRoute ptr = bmir.getIncompleteRoutePointers(baseRoute.getId()); + IncompleteTransportRoute ptr = bmir.getIncompleteTransportRoutes().get(baseRoute.getId()); if (ptr != null) { TIntArrayList lst = new TIntArrayList(); while(ptr != null) { From a52767bdb3a819d2eaad2255151f02311354889e Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 17:17:04 +0200 Subject: [PATCH 15/24] clean up --- .../java/net/osmand/data/TransportRoute.java | 34 ++++--------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index b0df8f2adf..4fd2b7d03a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -1,10 +1,5 @@ package net.osmand.data; -import net.osmand.osm.edit.Node; -import net.osmand.osm.edit.Way; -import net.osmand.util.Algorithms; -import net.osmand.util.MapUtils; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -12,9 +7,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import gnu.trove.list.array.TIntArrayList; -import gnu.trove.map.hash.TIntObjectHashMap; -import gnu.trove.map.hash.TLongObjectHashMap; +import net.osmand.osm.edit.Node; +import net.osmand.osm.edit.Way; +import net.osmand.util.Algorithms; +import net.osmand.util.MapUtils; public class TransportRoute extends MapObject { private List forwardStops = new ArrayList(); @@ -26,12 +22,11 @@ public class TransportRoute extends MapObject { private List forwardWays; private TransportSchedule schedule; public static final double SAME_STOP = 40; - private boolean combined = false; public TransportRoute() { } - public TransportRoute(TransportRoute r, List mergedSegment, List ways) { + public TransportRoute(TransportRoute r, List forwardStops, List forwardWay) { this.name = r.name; this.enName = r.enName; this.names = r.names; @@ -41,10 +36,8 @@ public class TransportRoute extends MapObject { this.type = r.type; this.color = r.color; this.schedule = r.schedule; - this.combined = true; - this.forwardStops = mergedSegment; - this.dist = calculateDistance(); - this.forwardWays = ways; + this.forwardStops = forwardStops; + this.forwardWays = forwardWay; } public TransportSchedule getSchedule() { @@ -58,19 +51,6 @@ public class TransportRoute extends MapObject { return schedule; } - public boolean isCombined() { - return combined; - } - - public Integer calculateDistance() { - int distance = 0; - for (int i = 0; i < forwardStops.size()-1; i++) { - if (!forwardStops.get(i).isMissingStop() || !forwardStops.get(i+1).isMissingStop()) - distance += MapUtils.getDistance(forwardStops.get(i).getLocation(), forwardStops.get(i+1).getLocation()); - } - return distance; - } - public boolean isIncomplete() { for (TransportStop s : forwardStops) { if (s.isMissingStop()) { From a00011693acdfa4aac0f04fd8557719a07256e29 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 17:18:58 +0200 Subject: [PATCH 16/24] clean up --- .../src/main/java/net/osmand/data/TransportStop.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java index 48eb8e67f7..b7c3687b31 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java @@ -12,6 +12,7 @@ import java.util.List; public class TransportStop extends MapObject { private static final int DELETED_STOP = -1; + public static final String MISSING_STOP_NAME = "#Missing Stop"; private int[] referencesToRoutes = null; private long[] deletedRoutesIds; @@ -22,7 +23,6 @@ public class TransportStop extends MapObject { private List exits; private List routes = null; private LinkedHashMap referencesToRoutesMap; - private boolean missingStop = false; private TransportStopAggregated transportStopAggregated; @@ -32,16 +32,8 @@ public class TransportStop extends MapObject { return routes; } - @Override - public void setName(String name) { - super.setName(name); - if (name != null && name.equals("#Missing Stop")) { - missingStop = true; - } - } - public boolean isMissingStop() { - return missingStop; + return MISSING_STOP_NAME.equals(getName()); } public LinkedHashMap getReferencesToRoutesMap() { From 15ce3fa998e7b65a3943ccef337e141a7fec0944 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 19:57:11 +0200 Subject: [PATCH 17/24] Add incomplete stops to cached indexes --- .../osmand/binary/CachedOsmandIndexes.java | 7 +- .../java/net/osmand/binary/OsmandIndex.java | 10238 ++++++++++++---- .../osmand/router/TransportRoutePlanner.java | 4 - 3 files changed, 7589 insertions(+), 2660 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/CachedOsmandIndexes.java b/OsmAnd-java/src/main/java/net/osmand/binary/CachedOsmandIndexes.java index fced895dfb..4a4bec70a2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/CachedOsmandIndexes.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/CachedOsmandIndexes.java @@ -26,7 +26,6 @@ import net.osmand.binary.OsmandIndex.PoiPart; import net.osmand.binary.OsmandIndex.RoutingPart; import net.osmand.binary.OsmandIndex.RoutingSubregion; import net.osmand.binary.OsmandIndex.TransportPart; -import net.osmand.util.MapUtils; import org.apache.commons.logging.Log; @@ -131,6 +130,10 @@ public class CachedOsmandIndexes { transport.setBottom(index.getBottom()); transport.setStopsTableLength(index.stopsFileLength); transport.setStopsTableOffset(index.stopsFileOffset); +// if(index.incompleteRoutesLength > 0) { + transport.setIncompleteRoutesLength(index.incompleteRoutesLength); + transport.setIncompleteRoutesOffset(index.incompleteRoutesOffset); +// } transport.setStringTableLength(index.stringTable.length); transport.setStringTableOffset(index.stringTable.fileOffset); fileIndex.addTransportIndex(transport); @@ -269,6 +272,8 @@ public class CachedOsmandIndexes { mi.bottom = index.getBottom(); mi.stopsFileLength = index.getStopsTableLength(); mi.stopsFileOffset = index.getStopsTableOffset(); + mi.incompleteRoutesLength = index.getIncompleteRoutesLength(); + mi.incompleteRoutesOffset = index.getIncompleteRoutesOffset(); mi.stringTable = new IndexStringTable(); mi.stringTable.fileOffset = index.getStringTableOffset(); mi.stringTable.length = index.getStringTableLength(); diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/OsmandIndex.java b/OsmAnd-java/src/main/java/net/osmand/binary/OsmandIndex.java index 3eb3b1164c..aba922cdf8 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/OsmandIndex.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/OsmandIndex.java @@ -8,238 +8,416 @@ public final class OsmandIndex { public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } + public interface OsmAndStoredIndexOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required uint32 version = 1; + /** + * required uint32 version = 1; + */ + boolean hasVersion(); + /** + * required uint32 version = 1; + */ + int getVersion(); + + // required int64 dateCreated = 18; + /** + * required int64 dateCreated = 18; + * + *
+     * System.currentTimeMillis()
+     * 
+ */ + boolean hasDateCreated(); + /** + * required int64 dateCreated = 18; + * + *
+     * System.currentTimeMillis()
+     * 
+ */ + long getDateCreated(); + + // repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + java.util.List + getFileIndexList(); + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + net.osmand.binary.OsmandIndex.FileIndex getFileIndex(int index); + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + int getFileIndexCount(); + } + /** + * Protobuf type {@code OsmAnd.OBF.OsmAndStoredIndex} + */ public static final class OsmAndStoredIndex extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements OsmAndStoredIndexOrBuilder { // Use OsmAndStoredIndex.newBuilder() to construct. - private OsmAndStoredIndex() { - initFields(); + private OsmAndStoredIndex(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private OsmAndStoredIndex(boolean noInit) {} - + private static final OsmAndStoredIndex defaultInstance; public static OsmAndStoredIndex getDefaultInstance() { return defaultInstance; } - + public OsmAndStoredIndex getDefaultInstanceForType() { return defaultInstance; } - + + private OsmAndStoredIndex( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + version_ = input.readUInt32(); + break; + } + case 58: { + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + fileIndex_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; + } + fileIndex_.add(input.readMessage(net.osmand.binary.OsmandIndex.FileIndex.PARSER, extensionRegistry)); + break; + } + case 144: { + bitField0_ |= 0x00000002; + dateCreated_ = input.readInt64(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + fileIndex_ = java.util.Collections.unmodifiableList(fileIndex_); + } + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public OsmAndStoredIndex parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OsmAndStoredIndex(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required uint32 version = 1; public static final int VERSION_FIELD_NUMBER = 1; - private boolean hasVersion; - private int version_ = 0; - public boolean hasVersion() { return hasVersion; } - public int getVersion() { return version_; } - + private int version_; + /** + * required uint32 version = 1; + */ + public boolean hasVersion() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required uint32 version = 1; + */ + public int getVersion() { + return version_; + } + // required int64 dateCreated = 18; public static final int DATECREATED_FIELD_NUMBER = 18; - private boolean hasDateCreated; - private long dateCreated_ = 0L; - public boolean hasDateCreated() { return hasDateCreated; } - public long getDateCreated() { return dateCreated_; } - - // repeated .FileIndex fileIndex = 7; + private long dateCreated_; + /** + * required int64 dateCreated = 18; + * + *
+     * System.currentTimeMillis()
+     * 
+ */ + public boolean hasDateCreated() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 dateCreated = 18; + * + *
+     * System.currentTimeMillis()
+     * 
+ */ + public long getDateCreated() { + return dateCreated_; + } + + // repeated .OsmAnd.OBF.FileIndex fileIndex = 7; public static final int FILEINDEX_FIELD_NUMBER = 7; - private java.util.List fileIndex_ = - java.util.Collections.emptyList(); + private java.util.List fileIndex_; + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public java.util.List getFileIndexList() { return fileIndex_; } - public int getFileIndexCount() { return fileIndex_.size(); } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public java.util.List + getFileIndexOrBuilderList() { + return fileIndex_; + } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public int getFileIndexCount() { + return fileIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public net.osmand.binary.OsmandIndex.FileIndex getFileIndex(int index) { return fileIndex_.get(index); } - - private void initFields() { + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public net.osmand.binary.OsmandIndex.FileIndexOrBuilder getFileIndexOrBuilder( + int index) { + return fileIndex_.get(index); } + + private void initFields() { + version_ = 0; + dateCreated_ = 0L; + fileIndex_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasVersion) return false; - if (!hasDateCreated) return false; - for (net.osmand.binary.OsmandIndex.FileIndex element : getFileIndexList()) { - if (!element.isInitialized()) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasVersion()) { + memoizedIsInitialized = 0; + return false; } + if (!hasDateCreated()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getFileIndexCount(); i++) { + if (!getFileIndex(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasVersion()) { - output.writeUInt32(1, getVersion()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, version_); } - for (net.osmand.binary.OsmandIndex.FileIndex element : getFileIndexList()) { - output.writeMessage(7, element); + for (int i = 0; i < fileIndex_.size(); i++) { + output.writeMessage(7, fileIndex_.get(i)); } - if (hasDateCreated()) { - output.writeInt64(18, getDateCreated()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(18, dateCreated_); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasVersion()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, getVersion()); + .computeUInt32Size(1, version_); } - for (net.osmand.binary.OsmandIndex.FileIndex element : getFileIndexList()) { + for (int i = 0; i < fileIndex_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(7, element); + .computeMessageSize(7, fileIndex_.get(i)); } - if (hasDateCreated()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(18, getDateCreated()); + .computeInt64Size(18, dateCreated_); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.OsmAndStoredIndex parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.OsmAndStoredIndex prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.OsmAndStoredIndex} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.OsmAndStoredIndex, Builder> { - private net.osmand.binary.OsmandIndex.OsmAndStoredIndex result; - + net.osmand.binary.OsmandIndex.OsmAndStoredIndex, Builder> + implements net.osmand.binary.OsmandIndex.OsmAndStoredIndexOrBuilder { // Construct using net.osmand.binary.OsmandIndex.OsmAndStoredIndex.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.OsmAndStoredIndex(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.OsmAndStoredIndex internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.OsmAndStoredIndex(); + super.clear(); + version_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + dateCreated_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + fileIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.OsmAndStoredIndex getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.OsmAndStoredIndex.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.OsmAndStoredIndex build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.OsmAndStoredIndex result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.OsmAndStoredIndex buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.OsmAndStoredIndex buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.OsmAndStoredIndex result = new net.osmand.binary.OsmandIndex.OsmAndStoredIndex(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - if (result.fileIndex_ != java.util.Collections.EMPTY_LIST) { - result.fileIndex_ = - java.util.Collections.unmodifiableList(result.fileIndex_); + result.version_ = version_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; } - net.osmand.binary.OsmandIndex.OsmAndStoredIndex returnMe = result; - result = null; - return returnMe; + result.dateCreated_ = dateCreated_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + fileIndex_ = java.util.Collections.unmodifiableList(fileIndex_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.fileIndex_ = fileIndex_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.OsmAndStoredIndex other) { if (other == net.osmand.binary.OsmandIndex.OsmAndStoredIndex.getDefaultInstance()) return this; if (other.hasVersion()) { @@ -249,513 +427,1129 @@ public final class OsmandIndex { setDateCreated(other.getDateCreated()); } if (!other.fileIndex_.isEmpty()) { - if (result.fileIndex_.isEmpty()) { - result.fileIndex_ = new java.util.ArrayList(); + if (fileIndex_.isEmpty()) { + fileIndex_ = other.fileIndex_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureFileIndexIsMutable(); + fileIndex_.addAll(other.fileIndex_); } - result.fileIndex_.addAll(other.fileIndex_); + } return this; } - + + public final boolean isInitialized() { + if (!hasVersion()) { + + return false; + } + if (!hasDateCreated()) { + + return false; + } + for (int i = 0; i < getFileIndexCount(); i++) { + if (!getFileIndex(i).isInitialized()) { + + return false; + } + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setVersion(input.readUInt32()); - break; - } - case 58: { - net.osmand.binary.OsmandIndex.FileIndex.Builder subBuilder = net.osmand.binary.OsmandIndex.FileIndex.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addFileIndex(subBuilder.buildPartial()); - break; - } - case 144: { - setDateCreated(input.readInt64()); - break; - } + net.osmand.binary.OsmandIndex.OsmAndStoredIndex parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.OsmAndStoredIndex) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required uint32 version = 1; + private int version_ ; + /** + * required uint32 version = 1; + */ public boolean hasVersion() { - return result.hasVersion(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required uint32 version = 1; + */ public int getVersion() { - return result.getVersion(); + return version_; } + /** + * required uint32 version = 1; + */ public Builder setVersion(int value) { - result.hasVersion = true; - result.version_ = value; + bitField0_ |= 0x00000001; + version_ = value; + return this; } + /** + * required uint32 version = 1; + */ public Builder clearVersion() { - result.hasVersion = false; - result.version_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + version_ = 0; + return this; } - + // required int64 dateCreated = 18; + private long dateCreated_ ; + /** + * required int64 dateCreated = 18; + * + *
+       * System.currentTimeMillis()
+       * 
+ */ public boolean hasDateCreated() { - return result.hasDateCreated(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 dateCreated = 18; + * + *
+       * System.currentTimeMillis()
+       * 
+ */ public long getDateCreated() { - return result.getDateCreated(); + return dateCreated_; } + /** + * required int64 dateCreated = 18; + * + *
+       * System.currentTimeMillis()
+       * 
+ */ public Builder setDateCreated(long value) { - result.hasDateCreated = true; - result.dateCreated_ = value; + bitField0_ |= 0x00000002; + dateCreated_ = value; + return this; } + /** + * required int64 dateCreated = 18; + * + *
+       * System.currentTimeMillis()
+       * 
+ */ public Builder clearDateCreated() { - result.hasDateCreated = false; - result.dateCreated_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + dateCreated_ = 0L; + return this; } - - // repeated .FileIndex fileIndex = 7; + + // repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + private java.util.List fileIndex_ = + java.util.Collections.emptyList(); + private void ensureFileIndexIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + fileIndex_ = new java.util.ArrayList(fileIndex_); + bitField0_ |= 0x00000004; + } + } + + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public java.util.List getFileIndexList() { - return java.util.Collections.unmodifiableList(result.fileIndex_); + return java.util.Collections.unmodifiableList(fileIndex_); } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public int getFileIndexCount() { - return result.getFileIndexCount(); + return fileIndex_.size(); } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public net.osmand.binary.OsmandIndex.FileIndex getFileIndex(int index) { - return result.getFileIndex(index); + return fileIndex_.get(index); } - public Builder setFileIndex(int index, net.osmand.binary.OsmandIndex.FileIndex value) { + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public Builder setFileIndex( + int index, net.osmand.binary.OsmandIndex.FileIndex value) { if (value == null) { throw new NullPointerException(); } - result.fileIndex_.set(index, value); + ensureFileIndexIsMutable(); + fileIndex_.set(index, value); + return this; } - public Builder setFileIndex(int index, net.osmand.binary.OsmandIndex.FileIndex.Builder builderForValue) { - result.fileIndex_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public Builder setFileIndex( + int index, net.osmand.binary.OsmandIndex.FileIndex.Builder builderForValue) { + ensureFileIndexIsMutable(); + fileIndex_.set(index, builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public Builder addFileIndex(net.osmand.binary.OsmandIndex.FileIndex value) { if (value == null) { throw new NullPointerException(); } - if (result.fileIndex_.isEmpty()) { - result.fileIndex_ = new java.util.ArrayList(); - } - result.fileIndex_.add(value); + ensureFileIndexIsMutable(); + fileIndex_.add(value); + return this; } - public Builder addFileIndex(net.osmand.binary.OsmandIndex.FileIndex.Builder builderForValue) { - if (result.fileIndex_.isEmpty()) { - result.fileIndex_ = new java.util.ArrayList(); + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public Builder addFileIndex( + int index, net.osmand.binary.OsmandIndex.FileIndex value) { + if (value == null) { + throw new NullPointerException(); } - result.fileIndex_.add(builderForValue.build()); + ensureFileIndexIsMutable(); + fileIndex_.add(index, value); + return this; } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public Builder addFileIndex( + net.osmand.binary.OsmandIndex.FileIndex.Builder builderForValue) { + ensureFileIndexIsMutable(); + fileIndex_.add(builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public Builder addFileIndex( + int index, net.osmand.binary.OsmandIndex.FileIndex.Builder builderForValue) { + ensureFileIndexIsMutable(); + fileIndex_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public Builder addAllFileIndex( java.lang.Iterable values) { - if (result.fileIndex_.isEmpty()) { - result.fileIndex_ = new java.util.ArrayList(); - } - super.addAll(values, result.fileIndex_); + ensureFileIndexIsMutable(); + super.addAll(values, fileIndex_); + return this; } + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ public Builder clearFileIndex() { - result.fileIndex_ = java.util.Collections.emptyList(); + fileIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + return this; } - - // @@protoc_insertion_point(builder_scope:OsmAndStoredIndex) + /** + * repeated .OsmAnd.OBF.FileIndex fileIndex = 7; + */ + public Builder removeFileIndex(int index) { + ensureFileIndexIsMutable(); + fileIndex_.remove(index); + + return this; + } + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.OsmAndStoredIndex) } - + static { defaultInstance = new OsmAndStoredIndex(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:OsmAndStoredIndex) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.OsmAndStoredIndex) } - + + public interface FileIndexOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 dateModified = 2; + /** + * required int64 dateModified = 2; + */ + boolean hasDateModified(); + /** + * required int64 dateModified = 2; + */ + long getDateModified(); + + // required string fileName = 3; + /** + * required string fileName = 3; + */ + boolean hasFileName(); + /** + * required string fileName = 3; + */ + java.lang.String getFileName(); + /** + * required string fileName = 3; + */ + com.google.protobuf.ByteString + getFileNameBytes(); + + // required int32 version = 4; + /** + * required int32 version = 4; + */ + boolean hasVersion(); + /** + * required int32 version = 4; + */ + int getVersion(); + + // repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + java.util.List + getAddressIndexList(); + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + net.osmand.binary.OsmandIndex.AddressPart getAddressIndex(int index); + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + int getAddressIndexCount(); + + // repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + java.util.List + getTransportIndexList(); + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + net.osmand.binary.OsmandIndex.TransportPart getTransportIndex(int index); + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + int getTransportIndexCount(); + + // repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + java.util.List + getPoiIndexList(); + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + net.osmand.binary.OsmandIndex.PoiPart getPoiIndex(int index); + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + int getPoiIndexCount(); + + // repeated .OsmAnd.OBF.MapPart mapIndex = 11; + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + java.util.List + getMapIndexList(); + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + net.osmand.binary.OsmandIndex.MapPart getMapIndex(int index); + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + int getMapIndexCount(); + + // repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + java.util.List + getRoutingIndexList(); + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + net.osmand.binary.OsmandIndex.RoutingPart getRoutingIndex(int index); + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + int getRoutingIndexCount(); + } + /** + * Protobuf type {@code OsmAnd.OBF.FileIndex} + */ public static final class FileIndex extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements FileIndexOrBuilder { // Use FileIndex.newBuilder() to construct. - private FileIndex() { - initFields(); + private FileIndex(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private FileIndex(boolean noInit) {} - + private static final FileIndex defaultInstance; public static FileIndex getDefaultInstance() { return defaultInstance; } - + public FileIndex getDefaultInstanceForType() { return defaultInstance; } - + + private FileIndex( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + dateModified_ = input.readInt64(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + fileName_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + version_ = input.readInt32(); + break; + } + case 66: { + if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + addressIndex_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000010; + } + addressIndex_.add(input.readMessage(net.osmand.binary.OsmandIndex.AddressPart.PARSER, extensionRegistry)); + break; + } + case 74: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + transportIndex_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + transportIndex_.add(input.readMessage(net.osmand.binary.OsmandIndex.TransportPart.PARSER, extensionRegistry)); + break; + } + case 82: { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + poiIndex_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000040; + } + poiIndex_.add(input.readMessage(net.osmand.binary.OsmandIndex.PoiPart.PARSER, extensionRegistry)); + break; + } + case 90: { + if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) { + mapIndex_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000080; + } + mapIndex_.add(input.readMessage(net.osmand.binary.OsmandIndex.MapPart.PARSER, extensionRegistry)); + break; + } + case 98: { + if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { + routingIndex_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000100; + } + routingIndex_.add(input.readMessage(net.osmand.binary.OsmandIndex.RoutingPart.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + addressIndex_ = java.util.Collections.unmodifiableList(addressIndex_); + } + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + transportIndex_ = java.util.Collections.unmodifiableList(transportIndex_); + } + if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + poiIndex_ = java.util.Collections.unmodifiableList(poiIndex_); + } + if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) { + mapIndex_ = java.util.Collections.unmodifiableList(mapIndex_); + } + if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { + routingIndex_ = java.util.Collections.unmodifiableList(routingIndex_); + } + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public FileIndex parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new FileIndex(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 dateModified = 2; public static final int DATEMODIFIED_FIELD_NUMBER = 2; - private boolean hasDateModified; - private long dateModified_ = 0L; - public boolean hasDateModified() { return hasDateModified; } - public long getDateModified() { return dateModified_; } - + private long dateModified_; + /** + * required int64 dateModified = 2; + */ + public boolean hasDateModified() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 dateModified = 2; + */ + public long getDateModified() { + return dateModified_; + } + // required string fileName = 3; public static final int FILENAME_FIELD_NUMBER = 3; - private boolean hasFileName; - private java.lang.String fileName_ = ""; - public boolean hasFileName() { return hasFileName; } - public java.lang.String getFileName() { return fileName_; } - + private java.lang.Object fileName_; + /** + * required string fileName = 3; + */ + public boolean hasFileName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * required string fileName = 3; + */ + public java.lang.String getFileName() { + java.lang.Object ref = fileName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + fileName_ = s; + } + return s; + } + } + /** + * required string fileName = 3; + */ + public com.google.protobuf.ByteString + getFileNameBytes() { + java.lang.Object ref = fileName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + fileName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + // required int32 version = 4; public static final int VERSION_FIELD_NUMBER = 4; - private boolean hasVersion; - private int version_ = 0; - public boolean hasVersion() { return hasVersion; } - public int getVersion() { return version_; } - - // repeated .AddressPart addressIndex = 8; + private int version_; + /** + * required int32 version = 4; + */ + public boolean hasVersion() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * required int32 version = 4; + */ + public int getVersion() { + return version_; + } + + // repeated .OsmAnd.OBF.AddressPart addressIndex = 8; public static final int ADDRESSINDEX_FIELD_NUMBER = 8; - private java.util.List addressIndex_ = - java.util.Collections.emptyList(); + private java.util.List addressIndex_; + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ public java.util.List getAddressIndexList() { return addressIndex_; } - public int getAddressIndexCount() { return addressIndex_.size(); } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public java.util.List + getAddressIndexOrBuilderList() { + return addressIndex_; + } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public int getAddressIndexCount() { + return addressIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ public net.osmand.binary.OsmandIndex.AddressPart getAddressIndex(int index) { return addressIndex_.get(index); } - - // repeated .TransportPart transportIndex = 9; + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public net.osmand.binary.OsmandIndex.AddressPartOrBuilder getAddressIndexOrBuilder( + int index) { + return addressIndex_.get(index); + } + + // repeated .OsmAnd.OBF.TransportPart transportIndex = 9; public static final int TRANSPORTINDEX_FIELD_NUMBER = 9; - private java.util.List transportIndex_ = - java.util.Collections.emptyList(); + private java.util.List transportIndex_; + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ public java.util.List getTransportIndexList() { return transportIndex_; } - public int getTransportIndexCount() { return transportIndex_.size(); } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public java.util.List + getTransportIndexOrBuilderList() { + return transportIndex_; + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public int getTransportIndexCount() { + return transportIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ public net.osmand.binary.OsmandIndex.TransportPart getTransportIndex(int index) { return transportIndex_.get(index); } - - // repeated .PoiPart poiIndex = 10; + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public net.osmand.binary.OsmandIndex.TransportPartOrBuilder getTransportIndexOrBuilder( + int index) { + return transportIndex_.get(index); + } + + // repeated .OsmAnd.OBF.PoiPart poiIndex = 10; public static final int POIINDEX_FIELD_NUMBER = 10; - private java.util.List poiIndex_ = - java.util.Collections.emptyList(); + private java.util.List poiIndex_; + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ public java.util.List getPoiIndexList() { return poiIndex_; } - public int getPoiIndexCount() { return poiIndex_.size(); } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public java.util.List + getPoiIndexOrBuilderList() { + return poiIndex_; + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public int getPoiIndexCount() { + return poiIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ public net.osmand.binary.OsmandIndex.PoiPart getPoiIndex(int index) { return poiIndex_.get(index); } - - // repeated .MapPart mapIndex = 11; + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public net.osmand.binary.OsmandIndex.PoiPartOrBuilder getPoiIndexOrBuilder( + int index) { + return poiIndex_.get(index); + } + + // repeated .OsmAnd.OBF.MapPart mapIndex = 11; public static final int MAPINDEX_FIELD_NUMBER = 11; - private java.util.List mapIndex_ = - java.util.Collections.emptyList(); + private java.util.List mapIndex_; + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ public java.util.List getMapIndexList() { return mapIndex_; } - public int getMapIndexCount() { return mapIndex_.size(); } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public java.util.List + getMapIndexOrBuilderList() { + return mapIndex_; + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public int getMapIndexCount() { + return mapIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ public net.osmand.binary.OsmandIndex.MapPart getMapIndex(int index) { return mapIndex_.get(index); } - - // repeated .RoutingPart routingIndex = 12; + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public net.osmand.binary.OsmandIndex.MapPartOrBuilder getMapIndexOrBuilder( + int index) { + return mapIndex_.get(index); + } + + // repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; public static final int ROUTINGINDEX_FIELD_NUMBER = 12; - private java.util.List routingIndex_ = - java.util.Collections.emptyList(); + private java.util.List routingIndex_; + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ public java.util.List getRoutingIndexList() { return routingIndex_; } - public int getRoutingIndexCount() { return routingIndex_.size(); } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public java.util.List + getRoutingIndexOrBuilderList() { + return routingIndex_; + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public int getRoutingIndexCount() { + return routingIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ public net.osmand.binary.OsmandIndex.RoutingPart getRoutingIndex(int index) { return routingIndex_.get(index); } - - private void initFields() { + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public net.osmand.binary.OsmandIndex.RoutingPartOrBuilder getRoutingIndexOrBuilder( + int index) { + return routingIndex_.get(index); } + + private void initFields() { + size_ = 0L; + dateModified_ = 0L; + fileName_ = ""; + version_ = 0; + addressIndex_ = java.util.Collections.emptyList(); + transportIndex_ = java.util.Collections.emptyList(); + poiIndex_ = java.util.Collections.emptyList(); + mapIndex_ = java.util.Collections.emptyList(); + routingIndex_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasDateModified) return false; - if (!hasFileName) return false; - if (!hasVersion) return false; - for (net.osmand.binary.OsmandIndex.AddressPart element : getAddressIndexList()) { - if (!element.isInitialized()) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; } - for (net.osmand.binary.OsmandIndex.TransportPart element : getTransportIndexList()) { - if (!element.isInitialized()) return false; + if (!hasDateModified()) { + memoizedIsInitialized = 0; + return false; } - for (net.osmand.binary.OsmandIndex.PoiPart element : getPoiIndexList()) { - if (!element.isInitialized()) return false; + if (!hasFileName()) { + memoizedIsInitialized = 0; + return false; } - for (net.osmand.binary.OsmandIndex.MapPart element : getMapIndexList()) { - if (!element.isInitialized()) return false; + if (!hasVersion()) { + memoizedIsInitialized = 0; + return false; } - for (net.osmand.binary.OsmandIndex.RoutingPart element : getRoutingIndexList()) { - if (!element.isInitialized()) return false; + for (int i = 0; i < getAddressIndexCount(); i++) { + if (!getAddressIndex(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } } + for (int i = 0; i < getTransportIndexCount(); i++) { + if (!getTransportIndex(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getPoiIndexCount(); i++) { + if (!getPoiIndex(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getMapIndexCount(); i++) { + if (!getMapIndex(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getRoutingIndexCount(); i++) { + if (!getRoutingIndex(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasDateModified()) { - output.writeInt64(2, getDateModified()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, dateModified_); } - if (hasFileName()) { - output.writeString(3, getFileName()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getFileNameBytes()); } - if (hasVersion()) { - output.writeInt32(4, getVersion()); + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(4, version_); } - for (net.osmand.binary.OsmandIndex.AddressPart element : getAddressIndexList()) { - output.writeMessage(8, element); + for (int i = 0; i < addressIndex_.size(); i++) { + output.writeMessage(8, addressIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.TransportPart element : getTransportIndexList()) { - output.writeMessage(9, element); + for (int i = 0; i < transportIndex_.size(); i++) { + output.writeMessage(9, transportIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.PoiPart element : getPoiIndexList()) { - output.writeMessage(10, element); + for (int i = 0; i < poiIndex_.size(); i++) { + output.writeMessage(10, poiIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.MapPart element : getMapIndexList()) { - output.writeMessage(11, element); + for (int i = 0; i < mapIndex_.size(); i++) { + output.writeMessage(11, mapIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.RoutingPart element : getRoutingIndexList()) { - output.writeMessage(12, element); + for (int i = 0; i < routingIndex_.size(); i++) { + output.writeMessage(12, routingIndex_.get(i)); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasDateModified()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getDateModified()); + .computeInt64Size(2, dateModified_); } - if (hasFileName()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(3, getFileName()); + .computeBytesSize(3, getFileNameBytes()); } - if (hasVersion()) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, getVersion()); + .computeInt32Size(4, version_); } - for (net.osmand.binary.OsmandIndex.AddressPart element : getAddressIndexList()) { + for (int i = 0; i < addressIndex_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(8, element); + .computeMessageSize(8, addressIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.TransportPart element : getTransportIndexList()) { + for (int i = 0; i < transportIndex_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(9, element); + .computeMessageSize(9, transportIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.PoiPart element : getPoiIndexList()) { + for (int i = 0; i < poiIndex_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(10, element); + .computeMessageSize(10, poiIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.MapPart element : getMapIndexList()) { + for (int i = 0; i < mapIndex_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(11, element); + .computeMessageSize(11, mapIndex_.get(i)); } - for (net.osmand.binary.OsmandIndex.RoutingPart element : getRoutingIndexList()) { + for (int i = 0; i < routingIndex_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(12, element); + .computeMessageSize(12, routingIndex_.get(i)); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.FileIndex parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.FileIndex parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.FileIndex parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.FileIndex parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.FileIndex parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.FileIndex parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.FileIndex parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.FileIndex parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.FileIndex parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.FileIndex parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.FileIndex prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.FileIndex} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.FileIndex, Builder> { - private net.osmand.binary.OsmandIndex.FileIndex result; - + net.osmand.binary.OsmandIndex.FileIndex, Builder> + implements net.osmand.binary.OsmandIndex.FileIndexOrBuilder { // Construct using net.osmand.binary.OsmandIndex.FileIndex.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.FileIndex(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.FileIndex internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.FileIndex(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + dateModified_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + fileName_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + version_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + addressIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + transportIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + poiIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + mapIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + routingIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000100); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.FileIndex getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.FileIndex.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.FileIndex build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.FileIndex result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.FileIndex buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.FileIndex buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.FileIndex result = new net.osmand.binary.OsmandIndex.FileIndex(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - if (result.addressIndex_ != java.util.Collections.EMPTY_LIST) { - result.addressIndex_ = - java.util.Collections.unmodifiableList(result.addressIndex_); + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; } - if (result.transportIndex_ != java.util.Collections.EMPTY_LIST) { - result.transportIndex_ = - java.util.Collections.unmodifiableList(result.transportIndex_); + result.dateModified_ = dateModified_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; } - if (result.poiIndex_ != java.util.Collections.EMPTY_LIST) { - result.poiIndex_ = - java.util.Collections.unmodifiableList(result.poiIndex_); + result.fileName_ = fileName_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; } - if (result.mapIndex_ != java.util.Collections.EMPTY_LIST) { - result.mapIndex_ = - java.util.Collections.unmodifiableList(result.mapIndex_); + result.version_ = version_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + addressIndex_ = java.util.Collections.unmodifiableList(addressIndex_); + bitField0_ = (bitField0_ & ~0x00000010); } - if (result.routingIndex_ != java.util.Collections.EMPTY_LIST) { - result.routingIndex_ = - java.util.Collections.unmodifiableList(result.routingIndex_); + result.addressIndex_ = addressIndex_; + if (((bitField0_ & 0x00000020) == 0x00000020)) { + transportIndex_ = java.util.Collections.unmodifiableList(transportIndex_); + bitField0_ = (bitField0_ & ~0x00000020); } - net.osmand.binary.OsmandIndex.FileIndex returnMe = result; - result = null; - return returnMe; + result.transportIndex_ = transportIndex_; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + poiIndex_ = java.util.Collections.unmodifiableList(poiIndex_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.poiIndex_ = poiIndex_; + if (((bitField0_ & 0x00000080) == 0x00000080)) { + mapIndex_ = java.util.Collections.unmodifiableList(mapIndex_); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.mapIndex_ = mapIndex_; + if (((bitField0_ & 0x00000100) == 0x00000100)) { + routingIndex_ = java.util.Collections.unmodifiableList(routingIndex_); + bitField0_ = (bitField0_ & ~0x00000100); + } + result.routingIndex_ = routingIndex_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.FileIndex other) { if (other == net.osmand.binary.OsmandIndex.FileIndex.getDefaultInstance()) return this; if (other.hasSize()) { @@ -765,600 +1559,1452 @@ public final class OsmandIndex { setDateModified(other.getDateModified()); } if (other.hasFileName()) { - setFileName(other.getFileName()); + bitField0_ |= 0x00000004; + fileName_ = other.fileName_; + } if (other.hasVersion()) { setVersion(other.getVersion()); } if (!other.addressIndex_.isEmpty()) { - if (result.addressIndex_.isEmpty()) { - result.addressIndex_ = new java.util.ArrayList(); + if (addressIndex_.isEmpty()) { + addressIndex_ = other.addressIndex_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureAddressIndexIsMutable(); + addressIndex_.addAll(other.addressIndex_); } - result.addressIndex_.addAll(other.addressIndex_); + } if (!other.transportIndex_.isEmpty()) { - if (result.transportIndex_.isEmpty()) { - result.transportIndex_ = new java.util.ArrayList(); + if (transportIndex_.isEmpty()) { + transportIndex_ = other.transportIndex_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureTransportIndexIsMutable(); + transportIndex_.addAll(other.transportIndex_); } - result.transportIndex_.addAll(other.transportIndex_); + } if (!other.poiIndex_.isEmpty()) { - if (result.poiIndex_.isEmpty()) { - result.poiIndex_ = new java.util.ArrayList(); + if (poiIndex_.isEmpty()) { + poiIndex_ = other.poiIndex_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensurePoiIndexIsMutable(); + poiIndex_.addAll(other.poiIndex_); } - result.poiIndex_.addAll(other.poiIndex_); + } if (!other.mapIndex_.isEmpty()) { - if (result.mapIndex_.isEmpty()) { - result.mapIndex_ = new java.util.ArrayList(); + if (mapIndex_.isEmpty()) { + mapIndex_ = other.mapIndex_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureMapIndexIsMutable(); + mapIndex_.addAll(other.mapIndex_); } - result.mapIndex_.addAll(other.mapIndex_); + } if (!other.routingIndex_.isEmpty()) { - if (result.routingIndex_.isEmpty()) { - result.routingIndex_ = new java.util.ArrayList(); + if (routingIndex_.isEmpty()) { + routingIndex_ = other.routingIndex_; + bitField0_ = (bitField0_ & ~0x00000100); + } else { + ensureRoutingIndexIsMutable(); + routingIndex_.addAll(other.routingIndex_); } - result.routingIndex_.addAll(other.routingIndex_); + } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasDateModified()) { + + return false; + } + if (!hasFileName()) { + + return false; + } + if (!hasVersion()) { + + return false; + } + for (int i = 0; i < getAddressIndexCount(); i++) { + if (!getAddressIndex(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getTransportIndexCount(); i++) { + if (!getTransportIndex(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getPoiIndexCount(); i++) { + if (!getPoiIndex(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getMapIndexCount(); i++) { + if (!getMapIndex(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getRoutingIndexCount(); i++) { + if (!getRoutingIndex(i).isInitialized()) { + + return false; + } + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setDateModified(input.readInt64()); - break; - } - case 26: { - setFileName(input.readString()); - break; - } - case 32: { - setVersion(input.readInt32()); - break; - } - case 66: { - net.osmand.binary.OsmandIndex.AddressPart.Builder subBuilder = net.osmand.binary.OsmandIndex.AddressPart.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAddressIndex(subBuilder.buildPartial()); - break; - } - case 74: { - net.osmand.binary.OsmandIndex.TransportPart.Builder subBuilder = net.osmand.binary.OsmandIndex.TransportPart.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addTransportIndex(subBuilder.buildPartial()); - break; - } - case 82: { - net.osmand.binary.OsmandIndex.PoiPart.Builder subBuilder = net.osmand.binary.OsmandIndex.PoiPart.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPoiIndex(subBuilder.buildPartial()); - break; - } - case 90: { - net.osmand.binary.OsmandIndex.MapPart.Builder subBuilder = net.osmand.binary.OsmandIndex.MapPart.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addMapIndex(subBuilder.buildPartial()); - break; - } - case 98: { - net.osmand.binary.OsmandIndex.RoutingPart.Builder subBuilder = net.osmand.binary.OsmandIndex.RoutingPart.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addRoutingIndex(subBuilder.buildPartial()); - break; - } + net.osmand.binary.OsmandIndex.FileIndex parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.FileIndex) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 dateModified = 2; + private long dateModified_ ; + /** + * required int64 dateModified = 2; + */ public boolean hasDateModified() { - return result.hasDateModified(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 dateModified = 2; + */ public long getDateModified() { - return result.getDateModified(); + return dateModified_; } + /** + * required int64 dateModified = 2; + */ public Builder setDateModified(long value) { - result.hasDateModified = true; - result.dateModified_ = value; + bitField0_ |= 0x00000002; + dateModified_ = value; + return this; } + /** + * required int64 dateModified = 2; + */ public Builder clearDateModified() { - result.hasDateModified = false; - result.dateModified_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + dateModified_ = 0L; + return this; } - + // required string fileName = 3; + private java.lang.Object fileName_ = ""; + /** + * required string fileName = 3; + */ public boolean hasFileName() { - return result.hasFileName(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * required string fileName = 3; + */ public java.lang.String getFileName() { - return result.getFileName(); + java.lang.Object ref = fileName_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + fileName_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - public Builder setFileName(java.lang.String value) { + /** + * required string fileName = 3; + */ + public com.google.protobuf.ByteString + getFileNameBytes() { + java.lang.Object ref = fileName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + fileName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string fileName = 3; + */ + public Builder setFileName( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.hasFileName = true; - result.fileName_ = value; + bitField0_ |= 0x00000004; + fileName_ = value; + return this; } + /** + * required string fileName = 3; + */ public Builder clearFileName() { - result.hasFileName = false; - result.fileName_ = getDefaultInstance().getFileName(); + bitField0_ = (bitField0_ & ~0x00000004); + fileName_ = getDefaultInstance().getFileName(); + return this; } - + /** + * required string fileName = 3; + */ + public Builder setFileNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + fileName_ = value; + + return this; + } + // required int32 version = 4; + private int version_ ; + /** + * required int32 version = 4; + */ public boolean hasVersion() { - return result.hasVersion(); + return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * required int32 version = 4; + */ public int getVersion() { - return result.getVersion(); + return version_; } + /** + * required int32 version = 4; + */ public Builder setVersion(int value) { - result.hasVersion = true; - result.version_ = value; + bitField0_ |= 0x00000008; + version_ = value; + return this; } + /** + * required int32 version = 4; + */ public Builder clearVersion() { - result.hasVersion = false; - result.version_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + version_ = 0; + return this; } - - // repeated .AddressPart addressIndex = 8; + + // repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + private java.util.List addressIndex_ = + java.util.Collections.emptyList(); + private void ensureAddressIndexIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + addressIndex_ = new java.util.ArrayList(addressIndex_); + bitField0_ |= 0x00000010; + } + } + + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ public java.util.List getAddressIndexList() { - return java.util.Collections.unmodifiableList(result.addressIndex_); + return java.util.Collections.unmodifiableList(addressIndex_); } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ public int getAddressIndexCount() { - return result.getAddressIndexCount(); + return addressIndex_.size(); } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ public net.osmand.binary.OsmandIndex.AddressPart getAddressIndex(int index) { - return result.getAddressIndex(index); + return addressIndex_.get(index); } - public Builder setAddressIndex(int index, net.osmand.binary.OsmandIndex.AddressPart value) { + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder setAddressIndex( + int index, net.osmand.binary.OsmandIndex.AddressPart value) { if (value == null) { throw new NullPointerException(); } - result.addressIndex_.set(index, value); + ensureAddressIndexIsMutable(); + addressIndex_.set(index, value); + return this; } - public Builder setAddressIndex(int index, net.osmand.binary.OsmandIndex.AddressPart.Builder builderForValue) { - result.addressIndex_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder setAddressIndex( + int index, net.osmand.binary.OsmandIndex.AddressPart.Builder builderForValue) { + ensureAddressIndexIsMutable(); + addressIndex_.set(index, builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ public Builder addAddressIndex(net.osmand.binary.OsmandIndex.AddressPart value) { if (value == null) { throw new NullPointerException(); } - if (result.addressIndex_.isEmpty()) { - result.addressIndex_ = new java.util.ArrayList(); - } - result.addressIndex_.add(value); + ensureAddressIndexIsMutable(); + addressIndex_.add(value); + return this; } - public Builder addAddressIndex(net.osmand.binary.OsmandIndex.AddressPart.Builder builderForValue) { - if (result.addressIndex_.isEmpty()) { - result.addressIndex_ = new java.util.ArrayList(); - } - result.addressIndex_.add(builderForValue.build()); - return this; - } - public Builder addAllAddressIndex( - java.lang.Iterable values) { - if (result.addressIndex_.isEmpty()) { - result.addressIndex_ = new java.util.ArrayList(); - } - super.addAll(values, result.addressIndex_); - return this; - } - public Builder clearAddressIndex() { - result.addressIndex_ = java.util.Collections.emptyList(); - return this; - } - - // repeated .TransportPart transportIndex = 9; - public java.util.List getTransportIndexList() { - return java.util.Collections.unmodifiableList(result.transportIndex_); - } - public int getTransportIndexCount() { - return result.getTransportIndexCount(); - } - public net.osmand.binary.OsmandIndex.TransportPart getTransportIndex(int index) { - return result.getTransportIndex(index); - } - public Builder setTransportIndex(int index, net.osmand.binary.OsmandIndex.TransportPart value) { + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder addAddressIndex( + int index, net.osmand.binary.OsmandIndex.AddressPart value) { if (value == null) { throw new NullPointerException(); } - result.transportIndex_.set(index, value); + ensureAddressIndexIsMutable(); + addressIndex_.add(index, value); + return this; } - public Builder setTransportIndex(int index, net.osmand.binary.OsmandIndex.TransportPart.Builder builderForValue) { - result.transportIndex_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder addAddressIndex( + net.osmand.binary.OsmandIndex.AddressPart.Builder builderForValue) { + ensureAddressIndexIsMutable(); + addressIndex_.add(builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder addAddressIndex( + int index, net.osmand.binary.OsmandIndex.AddressPart.Builder builderForValue) { + ensureAddressIndexIsMutable(); + addressIndex_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder addAllAddressIndex( + java.lang.Iterable values) { + ensureAddressIndexIsMutable(); + super.addAll(values, addressIndex_); + + return this; + } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder clearAddressIndex() { + addressIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + + return this; + } + /** + * repeated .OsmAnd.OBF.AddressPart addressIndex = 8; + */ + public Builder removeAddressIndex(int index) { + ensureAddressIndexIsMutable(); + addressIndex_.remove(index); + + return this; + } + + // repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + private java.util.List transportIndex_ = + java.util.Collections.emptyList(); + private void ensureTransportIndexIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + transportIndex_ = new java.util.ArrayList(transportIndex_); + bitField0_ |= 0x00000020; + } + } + + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public java.util.List getTransportIndexList() { + return java.util.Collections.unmodifiableList(transportIndex_); + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public int getTransportIndexCount() { + return transportIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public net.osmand.binary.OsmandIndex.TransportPart getTransportIndex(int index) { + return transportIndex_.get(index); + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder setTransportIndex( + int index, net.osmand.binary.OsmandIndex.TransportPart value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTransportIndexIsMutable(); + transportIndex_.set(index, value); + + return this; + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder setTransportIndex( + int index, net.osmand.binary.OsmandIndex.TransportPart.Builder builderForValue) { + ensureTransportIndexIsMutable(); + transportIndex_.set(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ public Builder addTransportIndex(net.osmand.binary.OsmandIndex.TransportPart value) { if (value == null) { throw new NullPointerException(); } - if (result.transportIndex_.isEmpty()) { - result.transportIndex_ = new java.util.ArrayList(); - } - result.transportIndex_.add(value); + ensureTransportIndexIsMutable(); + transportIndex_.add(value); + return this; } - public Builder addTransportIndex(net.osmand.binary.OsmandIndex.TransportPart.Builder builderForValue) { - if (result.transportIndex_.isEmpty()) { - result.transportIndex_ = new java.util.ArrayList(); - } - result.transportIndex_.add(builderForValue.build()); - return this; - } - public Builder addAllTransportIndex( - java.lang.Iterable values) { - if (result.transportIndex_.isEmpty()) { - result.transportIndex_ = new java.util.ArrayList(); - } - super.addAll(values, result.transportIndex_); - return this; - } - public Builder clearTransportIndex() { - result.transportIndex_ = java.util.Collections.emptyList(); - return this; - } - - // repeated .PoiPart poiIndex = 10; - public java.util.List getPoiIndexList() { - return java.util.Collections.unmodifiableList(result.poiIndex_); - } - public int getPoiIndexCount() { - return result.getPoiIndexCount(); - } - public net.osmand.binary.OsmandIndex.PoiPart getPoiIndex(int index) { - return result.getPoiIndex(index); - } - public Builder setPoiIndex(int index, net.osmand.binary.OsmandIndex.PoiPart value) { + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder addTransportIndex( + int index, net.osmand.binary.OsmandIndex.TransportPart value) { if (value == null) { throw new NullPointerException(); } - result.poiIndex_.set(index, value); + ensureTransportIndexIsMutable(); + transportIndex_.add(index, value); + return this; } - public Builder setPoiIndex(int index, net.osmand.binary.OsmandIndex.PoiPart.Builder builderForValue) { - result.poiIndex_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder addTransportIndex( + net.osmand.binary.OsmandIndex.TransportPart.Builder builderForValue) { + ensureTransportIndexIsMutable(); + transportIndex_.add(builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder addTransportIndex( + int index, net.osmand.binary.OsmandIndex.TransportPart.Builder builderForValue) { + ensureTransportIndexIsMutable(); + transportIndex_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder addAllTransportIndex( + java.lang.Iterable values) { + ensureTransportIndexIsMutable(); + super.addAll(values, transportIndex_); + + return this; + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder clearTransportIndex() { + transportIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + + return this; + } + /** + * repeated .OsmAnd.OBF.TransportPart transportIndex = 9; + */ + public Builder removeTransportIndex(int index) { + ensureTransportIndexIsMutable(); + transportIndex_.remove(index); + + return this; + } + + // repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + private java.util.List poiIndex_ = + java.util.Collections.emptyList(); + private void ensurePoiIndexIsMutable() { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { + poiIndex_ = new java.util.ArrayList(poiIndex_); + bitField0_ |= 0x00000040; + } + } + + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public java.util.List getPoiIndexList() { + return java.util.Collections.unmodifiableList(poiIndex_); + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public int getPoiIndexCount() { + return poiIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public net.osmand.binary.OsmandIndex.PoiPart getPoiIndex(int index) { + return poiIndex_.get(index); + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder setPoiIndex( + int index, net.osmand.binary.OsmandIndex.PoiPart value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoiIndexIsMutable(); + poiIndex_.set(index, value); + + return this; + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder setPoiIndex( + int index, net.osmand.binary.OsmandIndex.PoiPart.Builder builderForValue) { + ensurePoiIndexIsMutable(); + poiIndex_.set(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ public Builder addPoiIndex(net.osmand.binary.OsmandIndex.PoiPart value) { if (value == null) { throw new NullPointerException(); } - if (result.poiIndex_.isEmpty()) { - result.poiIndex_ = new java.util.ArrayList(); - } - result.poiIndex_.add(value); + ensurePoiIndexIsMutable(); + poiIndex_.add(value); + return this; } - public Builder addPoiIndex(net.osmand.binary.OsmandIndex.PoiPart.Builder builderForValue) { - if (result.poiIndex_.isEmpty()) { - result.poiIndex_ = new java.util.ArrayList(); - } - result.poiIndex_.add(builderForValue.build()); - return this; - } - public Builder addAllPoiIndex( - java.lang.Iterable values) { - if (result.poiIndex_.isEmpty()) { - result.poiIndex_ = new java.util.ArrayList(); - } - super.addAll(values, result.poiIndex_); - return this; - } - public Builder clearPoiIndex() { - result.poiIndex_ = java.util.Collections.emptyList(); - return this; - } - - // repeated .MapPart mapIndex = 11; - public java.util.List getMapIndexList() { - return java.util.Collections.unmodifiableList(result.mapIndex_); - } - public int getMapIndexCount() { - return result.getMapIndexCount(); - } - public net.osmand.binary.OsmandIndex.MapPart getMapIndex(int index) { - return result.getMapIndex(index); - } - public Builder setMapIndex(int index, net.osmand.binary.OsmandIndex.MapPart value) { + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder addPoiIndex( + int index, net.osmand.binary.OsmandIndex.PoiPart value) { if (value == null) { throw new NullPointerException(); } - result.mapIndex_.set(index, value); + ensurePoiIndexIsMutable(); + poiIndex_.add(index, value); + return this; } - public Builder setMapIndex(int index, net.osmand.binary.OsmandIndex.MapPart.Builder builderForValue) { - result.mapIndex_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder addPoiIndex( + net.osmand.binary.OsmandIndex.PoiPart.Builder builderForValue) { + ensurePoiIndexIsMutable(); + poiIndex_.add(builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder addPoiIndex( + int index, net.osmand.binary.OsmandIndex.PoiPart.Builder builderForValue) { + ensurePoiIndexIsMutable(); + poiIndex_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder addAllPoiIndex( + java.lang.Iterable values) { + ensurePoiIndexIsMutable(); + super.addAll(values, poiIndex_); + + return this; + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder clearPoiIndex() { + poiIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + + return this; + } + /** + * repeated .OsmAnd.OBF.PoiPart poiIndex = 10; + */ + public Builder removePoiIndex(int index) { + ensurePoiIndexIsMutable(); + poiIndex_.remove(index); + + return this; + } + + // repeated .OsmAnd.OBF.MapPart mapIndex = 11; + private java.util.List mapIndex_ = + java.util.Collections.emptyList(); + private void ensureMapIndexIsMutable() { + if (!((bitField0_ & 0x00000080) == 0x00000080)) { + mapIndex_ = new java.util.ArrayList(mapIndex_); + bitField0_ |= 0x00000080; + } + } + + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public java.util.List getMapIndexList() { + return java.util.Collections.unmodifiableList(mapIndex_); + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public int getMapIndexCount() { + return mapIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public net.osmand.binary.OsmandIndex.MapPart getMapIndex(int index) { + return mapIndex_.get(index); + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder setMapIndex( + int index, net.osmand.binary.OsmandIndex.MapPart value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMapIndexIsMutable(); + mapIndex_.set(index, value); + + return this; + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder setMapIndex( + int index, net.osmand.binary.OsmandIndex.MapPart.Builder builderForValue) { + ensureMapIndexIsMutable(); + mapIndex_.set(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ public Builder addMapIndex(net.osmand.binary.OsmandIndex.MapPart value) { if (value == null) { throw new NullPointerException(); } - if (result.mapIndex_.isEmpty()) { - result.mapIndex_ = new java.util.ArrayList(); - } - result.mapIndex_.add(value); + ensureMapIndexIsMutable(); + mapIndex_.add(value); + return this; } - public Builder addMapIndex(net.osmand.binary.OsmandIndex.MapPart.Builder builderForValue) { - if (result.mapIndex_.isEmpty()) { - result.mapIndex_ = new java.util.ArrayList(); - } - result.mapIndex_.add(builderForValue.build()); - return this; - } - public Builder addAllMapIndex( - java.lang.Iterable values) { - if (result.mapIndex_.isEmpty()) { - result.mapIndex_ = new java.util.ArrayList(); - } - super.addAll(values, result.mapIndex_); - return this; - } - public Builder clearMapIndex() { - result.mapIndex_ = java.util.Collections.emptyList(); - return this; - } - - // repeated .RoutingPart routingIndex = 12; - public java.util.List getRoutingIndexList() { - return java.util.Collections.unmodifiableList(result.routingIndex_); - } - public int getRoutingIndexCount() { - return result.getRoutingIndexCount(); - } - public net.osmand.binary.OsmandIndex.RoutingPart getRoutingIndex(int index) { - return result.getRoutingIndex(index); - } - public Builder setRoutingIndex(int index, net.osmand.binary.OsmandIndex.RoutingPart value) { + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder addMapIndex( + int index, net.osmand.binary.OsmandIndex.MapPart value) { if (value == null) { throw new NullPointerException(); } - result.routingIndex_.set(index, value); + ensureMapIndexIsMutable(); + mapIndex_.add(index, value); + return this; } - public Builder setRoutingIndex(int index, net.osmand.binary.OsmandIndex.RoutingPart.Builder builderForValue) { - result.routingIndex_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder addMapIndex( + net.osmand.binary.OsmandIndex.MapPart.Builder builderForValue) { + ensureMapIndexIsMutable(); + mapIndex_.add(builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder addMapIndex( + int index, net.osmand.binary.OsmandIndex.MapPart.Builder builderForValue) { + ensureMapIndexIsMutable(); + mapIndex_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder addAllMapIndex( + java.lang.Iterable values) { + ensureMapIndexIsMutable(); + super.addAll(values, mapIndex_); + + return this; + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder clearMapIndex() { + mapIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + + return this; + } + /** + * repeated .OsmAnd.OBF.MapPart mapIndex = 11; + */ + public Builder removeMapIndex(int index) { + ensureMapIndexIsMutable(); + mapIndex_.remove(index); + + return this; + } + + // repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + private java.util.List routingIndex_ = + java.util.Collections.emptyList(); + private void ensureRoutingIndexIsMutable() { + if (!((bitField0_ & 0x00000100) == 0x00000100)) { + routingIndex_ = new java.util.ArrayList(routingIndex_); + bitField0_ |= 0x00000100; + } + } + + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public java.util.List getRoutingIndexList() { + return java.util.Collections.unmodifiableList(routingIndex_); + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public int getRoutingIndexCount() { + return routingIndex_.size(); + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public net.osmand.binary.OsmandIndex.RoutingPart getRoutingIndex(int index) { + return routingIndex_.get(index); + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public Builder setRoutingIndex( + int index, net.osmand.binary.OsmandIndex.RoutingPart value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRoutingIndexIsMutable(); + routingIndex_.set(index, value); + + return this; + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public Builder setRoutingIndex( + int index, net.osmand.binary.OsmandIndex.RoutingPart.Builder builderForValue) { + ensureRoutingIndexIsMutable(); + routingIndex_.set(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ public Builder addRoutingIndex(net.osmand.binary.OsmandIndex.RoutingPart value) { if (value == null) { throw new NullPointerException(); } - if (result.routingIndex_.isEmpty()) { - result.routingIndex_ = new java.util.ArrayList(); - } - result.routingIndex_.add(value); + ensureRoutingIndexIsMutable(); + routingIndex_.add(value); + return this; } - public Builder addRoutingIndex(net.osmand.binary.OsmandIndex.RoutingPart.Builder builderForValue) { - if (result.routingIndex_.isEmpty()) { - result.routingIndex_ = new java.util.ArrayList(); + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public Builder addRoutingIndex( + int index, net.osmand.binary.OsmandIndex.RoutingPart value) { + if (value == null) { + throw new NullPointerException(); } - result.routingIndex_.add(builderForValue.build()); + ensureRoutingIndexIsMutable(); + routingIndex_.add(index, value); + return this; } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public Builder addRoutingIndex( + net.osmand.binary.OsmandIndex.RoutingPart.Builder builderForValue) { + ensureRoutingIndexIsMutable(); + routingIndex_.add(builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public Builder addRoutingIndex( + int index, net.osmand.binary.OsmandIndex.RoutingPart.Builder builderForValue) { + ensureRoutingIndexIsMutable(); + routingIndex_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ public Builder addAllRoutingIndex( java.lang.Iterable values) { - if (result.routingIndex_.isEmpty()) { - result.routingIndex_ = new java.util.ArrayList(); - } - super.addAll(values, result.routingIndex_); + ensureRoutingIndexIsMutable(); + super.addAll(values, routingIndex_); + return this; } + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ public Builder clearRoutingIndex() { - result.routingIndex_ = java.util.Collections.emptyList(); + routingIndex_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000100); + return this; } - - // @@protoc_insertion_point(builder_scope:FileIndex) + /** + * repeated .OsmAnd.OBF.RoutingPart routingIndex = 12; + */ + public Builder removeRoutingIndex(int index) { + ensureRoutingIndexIsMutable(); + routingIndex_.remove(index); + + return this; + } + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.FileIndex) } - + static { defaultInstance = new FileIndex(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:FileIndex) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.FileIndex) } - + + public interface AddressPartOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // optional string name = 3; + /** + * optional string name = 3; + */ + boolean hasName(); + /** + * optional string name = 3; + */ + java.lang.String getName(); + /** + * optional string name = 3; + */ + com.google.protobuf.ByteString + getNameBytes(); + + // optional string nameEn = 4; + /** + * optional string nameEn = 4; + */ + boolean hasNameEn(); + /** + * optional string nameEn = 4; + */ + java.lang.String getNameEn(); + /** + * optional string nameEn = 4; + */ + com.google.protobuf.ByteString + getNameEnBytes(); + + // optional int32 indexNameOffset = 5; + /** + * optional int32 indexNameOffset = 5; + */ + boolean hasIndexNameOffset(); + /** + * optional int32 indexNameOffset = 5; + */ + int getIndexNameOffset(); + + // repeated .OsmAnd.OBF.CityBlock cities = 8; + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + java.util.List + getCitiesList(); + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + net.osmand.binary.OsmandIndex.CityBlock getCities(int index); + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + int getCitiesCount(); + + // repeated string additionalTags = 9; + /** + * repeated string additionalTags = 9; + */ + java.util.List + getAdditionalTagsList(); + /** + * repeated string additionalTags = 9; + */ + int getAdditionalTagsCount(); + /** + * repeated string additionalTags = 9; + */ + java.lang.String getAdditionalTags(int index); + /** + * repeated string additionalTags = 9; + */ + com.google.protobuf.ByteString + getAdditionalTagsBytes(int index); + } + /** + * Protobuf type {@code OsmAnd.OBF.AddressPart} + */ public static final class AddressPart extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements AddressPartOrBuilder { // Use AddressPart.newBuilder() to construct. - private AddressPart() { - initFields(); + private AddressPart(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private AddressPart(boolean noInit) {} - + private static final AddressPart defaultInstance; public static AddressPart getDefaultInstance() { return defaultInstance; } - + public AddressPart getDefaultInstanceForType() { return defaultInstance; } - + + private AddressPart( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + name_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + nameEn_ = input.readBytes(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + indexNameOffset_ = input.readInt32(); + break; + } + case 66: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + cities_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + cities_.add(input.readMessage(net.osmand.binary.OsmandIndex.CityBlock.PARSER, extensionRegistry)); + break; + } + case 74: { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + additionalTags_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000040; + } + additionalTags_.add(input.readBytes()); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + cities_ = java.util.Collections.unmodifiableList(cities_); + } + if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + additionalTags_ = new com.google.protobuf.UnmodifiableLazyStringList(additionalTags_); + } + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public AddressPart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AddressPart(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // optional string name = 3; public static final int NAME_FIELD_NUMBER = 3; - private boolean hasName; - private java.lang.String name_ = ""; - public boolean hasName() { return hasName; } - public java.lang.String getName() { return name_; } - + private java.lang.Object name_; + /** + * optional string name = 3; + */ + public boolean hasName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string name = 3; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + name_ = s; + } + return s; + } + } + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + // optional string nameEn = 4; public static final int NAMEEN_FIELD_NUMBER = 4; - private boolean hasNameEn; - private java.lang.String nameEn_ = ""; - public boolean hasNameEn() { return hasNameEn; } - public java.lang.String getNameEn() { return nameEn_; } - + private java.lang.Object nameEn_; + /** + * optional string nameEn = 4; + */ + public boolean hasNameEn() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string nameEn = 4; + */ + public java.lang.String getNameEn() { + java.lang.Object ref = nameEn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + nameEn_ = s; + } + return s; + } + } + /** + * optional string nameEn = 4; + */ + public com.google.protobuf.ByteString + getNameEnBytes() { + java.lang.Object ref = nameEn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nameEn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + // optional int32 indexNameOffset = 5; public static final int INDEXNAMEOFFSET_FIELD_NUMBER = 5; - private boolean hasIndexNameOffset; - private int indexNameOffset_ = 0; - public boolean hasIndexNameOffset() { return hasIndexNameOffset; } - public int getIndexNameOffset() { return indexNameOffset_; } - - // repeated .CityBlock cities = 8; + private int indexNameOffset_; + /** + * optional int32 indexNameOffset = 5; + */ + public boolean hasIndexNameOffset() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional int32 indexNameOffset = 5; + */ + public int getIndexNameOffset() { + return indexNameOffset_; + } + + // repeated .OsmAnd.OBF.CityBlock cities = 8; public static final int CITIES_FIELD_NUMBER = 8; - private java.util.List cities_ = - java.util.Collections.emptyList(); + private java.util.List cities_; + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public java.util.List getCitiesList() { return cities_; } - public int getCitiesCount() { return cities_.size(); } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public java.util.List + getCitiesOrBuilderList() { + return cities_; + } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public int getCitiesCount() { + return cities_.size(); + } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public net.osmand.binary.OsmandIndex.CityBlock getCities(int index) { return cities_.get(index); } - + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public net.osmand.binary.OsmandIndex.CityBlockOrBuilder getCitiesOrBuilder( + int index) { + return cities_.get(index); + } + // repeated string additionalTags = 9; public static final int ADDITIONALTAGS_FIELD_NUMBER = 9; - private java.util.List additionalTags_ = - java.util.Collections.emptyList(); - public java.util.List getAdditionalTagsList() { + private com.google.protobuf.LazyStringList additionalTags_; + /** + * repeated string additionalTags = 9; + */ + public java.util.List + getAdditionalTagsList() { return additionalTags_; } - public int getAdditionalTagsCount() { return additionalTags_.size(); } + /** + * repeated string additionalTags = 9; + */ + public int getAdditionalTagsCount() { + return additionalTags_.size(); + } + /** + * repeated string additionalTags = 9; + */ public java.lang.String getAdditionalTags(int index) { return additionalTags_.get(index); } - - private void initFields() { + /** + * repeated string additionalTags = 9; + */ + public com.google.protobuf.ByteString + getAdditionalTagsBytes(int index) { + return additionalTags_.getByteString(index); } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + name_ = ""; + nameEn_ = ""; + indexNameOffset_ = 0; + cities_ = java.util.Collections.emptyList(); + additionalTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; - for (net.osmand.binary.OsmandIndex.CityBlock element : getCitiesList()) { - if (!element.isInitialized()) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getCitiesCount(); i++) { + if (!getCities(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasName()) { - output.writeString(3, getName()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getNameBytes()); } - if (hasNameEn()) { - output.writeString(4, getNameEn()); + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getNameEnBytes()); } - if (hasIndexNameOffset()) { - output.writeInt32(5, getIndexNameOffset()); + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(5, indexNameOffset_); } - for (net.osmand.binary.OsmandIndex.CityBlock element : getCitiesList()) { - output.writeMessage(8, element); + for (int i = 0; i < cities_.size(); i++) { + output.writeMessage(8, cities_.get(i)); } - for (java.lang.String element : getAdditionalTagsList()) { - output.writeString(9, element); + for (int i = 0; i < additionalTags_.size(); i++) { + output.writeBytes(9, additionalTags_.getByteString(i)); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasName()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(3, getName()); + .computeBytesSize(3, getNameBytes()); } - if (hasNameEn()) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(4, getNameEn()); + .computeBytesSize(4, getNameEnBytes()); } - if (hasIndexNameOffset()) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, getIndexNameOffset()); + .computeInt32Size(5, indexNameOffset_); } - for (net.osmand.binary.OsmandIndex.CityBlock element : getCitiesList()) { + for (int i = 0; i < cities_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(8, element); + .computeMessageSize(8, cities_.get(i)); } { int dataSize = 0; - for (java.lang.String element : getAdditionalTagsList()) { + for (int i = 0; i < additionalTags_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream - .computeStringSizeNoTag(element); + .computeBytesSizeNoTag(additionalTags_.getByteString(i)); } size += dataSize; size += 1 * getAdditionalTagsList().size(); @@ -1366,153 +3012,166 @@ public final class OsmandIndex { memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.AddressPart parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.AddressPart parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.AddressPart parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.AddressPart parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.AddressPart parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.AddressPart parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.AddressPart parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.AddressPart parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.AddressPart parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.AddressPart parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.AddressPart prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.AddressPart} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.AddressPart, Builder> { - private net.osmand.binary.OsmandIndex.AddressPart result; - + net.osmand.binary.OsmandIndex.AddressPart, Builder> + implements net.osmand.binary.OsmandIndex.AddressPartOrBuilder { // Construct using net.osmand.binary.OsmandIndex.AddressPart.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.AddressPart(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.AddressPart internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.AddressPart(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + nameEn_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + indexNameOffset_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + cities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + additionalTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.AddressPart getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.AddressPart.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.AddressPart build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.AddressPart result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.AddressPart buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.AddressPart buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.AddressPart result = new net.osmand.binary.OsmandIndex.AddressPart(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - if (result.cities_ != java.util.Collections.EMPTY_LIST) { - result.cities_ = - java.util.Collections.unmodifiableList(result.cities_); + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; } - if (result.additionalTags_ != java.util.Collections.EMPTY_LIST) { - result.additionalTags_ = - java.util.Collections.unmodifiableList(result.additionalTags_); + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; } - net.osmand.binary.OsmandIndex.AddressPart returnMe = result; - result = null; - return returnMe; + result.name_ = name_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.nameEn_ = nameEn_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.indexNameOffset_ = indexNameOffset_; + if (((bitField0_ & 0x00000020) == 0x00000020)) { + cities_ = java.util.Collections.unmodifiableList(cities_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.cities_ = cities_; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + additionalTags_ = new com.google.protobuf.UnmodifiableLazyStringList( + additionalTags_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.additionalTags_ = additionalTags_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.AddressPart other) { if (other == net.osmand.binary.OsmandIndex.AddressPart.getDefaultInstance()) return this; if (other.hasSize()) { @@ -1522,499 +3181,914 @@ public final class OsmandIndex { setOffset(other.getOffset()); } if (other.hasName()) { - setName(other.getName()); + bitField0_ |= 0x00000004; + name_ = other.name_; + } if (other.hasNameEn()) { - setNameEn(other.getNameEn()); + bitField0_ |= 0x00000008; + nameEn_ = other.nameEn_; + } if (other.hasIndexNameOffset()) { setIndexNameOffset(other.getIndexNameOffset()); } if (!other.cities_.isEmpty()) { - if (result.cities_.isEmpty()) { - result.cities_ = new java.util.ArrayList(); + if (cities_.isEmpty()) { + cities_ = other.cities_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureCitiesIsMutable(); + cities_.addAll(other.cities_); } - result.cities_.addAll(other.cities_); + } if (!other.additionalTags_.isEmpty()) { - if (result.additionalTags_.isEmpty()) { - result.additionalTags_ = new java.util.ArrayList(); + if (additionalTags_.isEmpty()) { + additionalTags_ = other.additionalTags_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureAdditionalTagsIsMutable(); + additionalTags_.addAll(other.additionalTags_); } - result.additionalTags_.addAll(other.additionalTags_); + } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + for (int i = 0; i < getCitiesCount(); i++) { + if (!getCities(i).isInitialized()) { + + return false; + } + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 26: { - setName(input.readString()); - break; - } - case 34: { - setNameEn(input.readString()); - break; - } - case 40: { - setIndexNameOffset(input.readInt32()); - break; - } - case 66: { - net.osmand.binary.OsmandIndex.CityBlock.Builder subBuilder = net.osmand.binary.OsmandIndex.CityBlock.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addCities(subBuilder.buildPartial()); - break; - } - case 74: { - addAdditionalTags(input.readString()); - break; - } + net.osmand.binary.OsmandIndex.AddressPart parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.AddressPart) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // optional string name = 3; + private java.lang.Object name_ = ""; + /** + * optional string name = 3; + */ public boolean hasName() { - return result.hasName(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional string name = 3; + */ public java.lang.String getName() { - return result.getName(); + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - public Builder setName(java.lang.String value) { + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string name = 3; + */ + public Builder setName( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.hasName = true; - result.name_ = value; + bitField0_ |= 0x00000004; + name_ = value; + return this; } + /** + * optional string name = 3; + */ public Builder clearName() { - result.hasName = false; - result.name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + name_ = getDefaultInstance().getName(); + return this; } - - // optional string nameEn = 4; - public boolean hasNameEn() { - return result.hasNameEn(); - } - public java.lang.String getNameEn() { - return result.getNameEn(); - } - public Builder setNameEn(java.lang.String value) { + /** + * optional string name = 3; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - result.hasNameEn = true; - result.nameEn_ = value; + bitField0_ |= 0x00000004; + name_ = value; + return this; } + + // optional string nameEn = 4; + private java.lang.Object nameEn_ = ""; + /** + * optional string nameEn = 4; + */ + public boolean hasNameEn() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string nameEn = 4; + */ + public java.lang.String getNameEn() { + java.lang.Object ref = nameEn_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + nameEn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string nameEn = 4; + */ + public com.google.protobuf.ByteString + getNameEnBytes() { + java.lang.Object ref = nameEn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nameEn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string nameEn = 4; + */ + public Builder setNameEn( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + nameEn_ = value; + + return this; + } + /** + * optional string nameEn = 4; + */ public Builder clearNameEn() { - result.hasNameEn = false; - result.nameEn_ = getDefaultInstance().getNameEn(); + bitField0_ = (bitField0_ & ~0x00000008); + nameEn_ = getDefaultInstance().getNameEn(); + return this; } - + /** + * optional string nameEn = 4; + */ + public Builder setNameEnBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + nameEn_ = value; + + return this; + } + // optional int32 indexNameOffset = 5; + private int indexNameOffset_ ; + /** + * optional int32 indexNameOffset = 5; + */ public boolean hasIndexNameOffset() { - return result.hasIndexNameOffset(); + return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * optional int32 indexNameOffset = 5; + */ public int getIndexNameOffset() { - return result.getIndexNameOffset(); + return indexNameOffset_; } + /** + * optional int32 indexNameOffset = 5; + */ public Builder setIndexNameOffset(int value) { - result.hasIndexNameOffset = true; - result.indexNameOffset_ = value; + bitField0_ |= 0x00000010; + indexNameOffset_ = value; + return this; } + /** + * optional int32 indexNameOffset = 5; + */ public Builder clearIndexNameOffset() { - result.hasIndexNameOffset = false; - result.indexNameOffset_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + indexNameOffset_ = 0; + return this; } - - // repeated .CityBlock cities = 8; + + // repeated .OsmAnd.OBF.CityBlock cities = 8; + private java.util.List cities_ = + java.util.Collections.emptyList(); + private void ensureCitiesIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + cities_ = new java.util.ArrayList(cities_); + bitField0_ |= 0x00000020; + } + } + + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public java.util.List getCitiesList() { - return java.util.Collections.unmodifiableList(result.cities_); + return java.util.Collections.unmodifiableList(cities_); } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public int getCitiesCount() { - return result.getCitiesCount(); + return cities_.size(); } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public net.osmand.binary.OsmandIndex.CityBlock getCities(int index) { - return result.getCities(index); + return cities_.get(index); } - public Builder setCities(int index, net.osmand.binary.OsmandIndex.CityBlock value) { + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public Builder setCities( + int index, net.osmand.binary.OsmandIndex.CityBlock value) { if (value == null) { throw new NullPointerException(); } - result.cities_.set(index, value); + ensureCitiesIsMutable(); + cities_.set(index, value); + return this; } - public Builder setCities(int index, net.osmand.binary.OsmandIndex.CityBlock.Builder builderForValue) { - result.cities_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public Builder setCities( + int index, net.osmand.binary.OsmandIndex.CityBlock.Builder builderForValue) { + ensureCitiesIsMutable(); + cities_.set(index, builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public Builder addCities(net.osmand.binary.OsmandIndex.CityBlock value) { if (value == null) { throw new NullPointerException(); } - if (result.cities_.isEmpty()) { - result.cities_ = new java.util.ArrayList(); - } - result.cities_.add(value); + ensureCitiesIsMutable(); + cities_.add(value); + return this; } - public Builder addCities(net.osmand.binary.OsmandIndex.CityBlock.Builder builderForValue) { - if (result.cities_.isEmpty()) { - result.cities_ = new java.util.ArrayList(); + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public Builder addCities( + int index, net.osmand.binary.OsmandIndex.CityBlock value) { + if (value == null) { + throw new NullPointerException(); } - result.cities_.add(builderForValue.build()); + ensureCitiesIsMutable(); + cities_.add(index, value); + return this; } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public Builder addCities( + net.osmand.binary.OsmandIndex.CityBlock.Builder builderForValue) { + ensureCitiesIsMutable(); + cities_.add(builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public Builder addCities( + int index, net.osmand.binary.OsmandIndex.CityBlock.Builder builderForValue) { + ensureCitiesIsMutable(); + cities_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public Builder addAllCities( java.lang.Iterable values) { - if (result.cities_.isEmpty()) { - result.cities_ = new java.util.ArrayList(); - } - super.addAll(values, result.cities_); + ensureCitiesIsMutable(); + super.addAll(values, cities_); + return this; } + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ public Builder clearCities() { - result.cities_ = java.util.Collections.emptyList(); + cities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + return this; } - + /** + * repeated .OsmAnd.OBF.CityBlock cities = 8; + */ + public Builder removeCities(int index) { + ensureCitiesIsMutable(); + cities_.remove(index); + + return this; + } + // repeated string additionalTags = 9; - public java.util.List getAdditionalTagsList() { - return java.util.Collections.unmodifiableList(result.additionalTags_); + private com.google.protobuf.LazyStringList additionalTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureAdditionalTagsIsMutable() { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { + additionalTags_ = new com.google.protobuf.LazyStringArrayList(additionalTags_); + bitField0_ |= 0x00000040; + } } + /** + * repeated string additionalTags = 9; + */ + public java.util.List + getAdditionalTagsList() { + return java.util.Collections.unmodifiableList(additionalTags_); + } + /** + * repeated string additionalTags = 9; + */ public int getAdditionalTagsCount() { - return result.getAdditionalTagsCount(); + return additionalTags_.size(); } + /** + * repeated string additionalTags = 9; + */ public java.lang.String getAdditionalTags(int index) { - return result.getAdditionalTags(index); + return additionalTags_.get(index); } - public Builder setAdditionalTags(int index, java.lang.String value) { + /** + * repeated string additionalTags = 9; + */ + public com.google.protobuf.ByteString + getAdditionalTagsBytes(int index) { + return additionalTags_.getByteString(index); + } + /** + * repeated string additionalTags = 9; + */ + public Builder setAdditionalTags( + int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.additionalTags_.set(index, value); + ensureAdditionalTagsIsMutable(); + additionalTags_.set(index, value); + return this; } - public Builder addAdditionalTags(java.lang.String value) { + /** + * repeated string additionalTags = 9; + */ + public Builder addAdditionalTags( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } - if (result.additionalTags_.isEmpty()) { - result.additionalTags_ = new java.util.ArrayList(); - } - result.additionalTags_.add(value); + ensureAdditionalTagsIsMutable(); + additionalTags_.add(value); + return this; } + /** + * repeated string additionalTags = 9; + */ public Builder addAllAdditionalTags( - java.lang.Iterable values) { - if (result.additionalTags_.isEmpty()) { - result.additionalTags_ = new java.util.ArrayList(); - } - super.addAll(values, result.additionalTags_); + java.lang.Iterable values) { + ensureAdditionalTagsIsMutable(); + super.addAll(values, additionalTags_); + return this; } + /** + * repeated string additionalTags = 9; + */ public Builder clearAdditionalTags() { - result.additionalTags_ = java.util.Collections.emptyList(); + additionalTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + return this; } - - // @@protoc_insertion_point(builder_scope:AddressPart) + /** + * repeated string additionalTags = 9; + */ + public Builder addAdditionalTagsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdditionalTagsIsMutable(); + additionalTags_.add(value); + + return this; + } + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.AddressPart) } - + static { defaultInstance = new AddressPart(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:AddressPart) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.AddressPart) } - + + public interface CityBlockOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // required int32 type = 3; + /** + * required int32 type = 3; + */ + boolean hasType(); + /** + * required int32 type = 3; + */ + int getType(); + } + /** + * Protobuf type {@code OsmAnd.OBF.CityBlock} + */ public static final class CityBlock extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements CityBlockOrBuilder { // Use CityBlock.newBuilder() to construct. - private CityBlock() { - initFields(); + private CityBlock(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private CityBlock(boolean noInit) {} - + private static final CityBlock defaultInstance; public static CityBlock getDefaultInstance() { return defaultInstance; } - + public CityBlock getDefaultInstanceForType() { return defaultInstance; } - + + private CityBlock( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + type_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CityBlock parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CityBlock(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // required int32 type = 3; public static final int TYPE_FIELD_NUMBER = 3; - private boolean hasType; - private int type_ = 0; - public boolean hasType() { return hasType; } - public int getType() { return type_; } - - private void initFields() { + private int type_; + /** + * required int32 type = 3; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * required int32 type = 3; + */ + public int getType() { + return type_; + } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + type_ = 0; + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; - if (!hasType) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasType()) { - output.writeInt32(3, getType()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(3, type_); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasType()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(3, getType()); + .computeInt32Size(3, type_); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.CityBlock parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.CityBlock parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.CityBlock parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.CityBlock parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.CityBlock parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.CityBlock parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.CityBlock parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.CityBlock parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.CityBlock parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.CityBlock parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.CityBlock prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.CityBlock} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.CityBlock, Builder> { - private net.osmand.binary.OsmandIndex.CityBlock result; - + net.osmand.binary.OsmandIndex.CityBlock, Builder> + implements net.osmand.binary.OsmandIndex.CityBlockOrBuilder { // Construct using net.osmand.binary.OsmandIndex.CityBlock.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.CityBlock(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.CityBlock internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.CityBlock(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + type_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.CityBlock getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.CityBlock.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.CityBlock build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.CityBlock result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.CityBlock buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.CityBlock buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.CityBlock result = new net.osmand.binary.OsmandIndex.CityBlock(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - net.osmand.binary.OsmandIndex.CityBlock returnMe = result; - result = null; - return returnMe; + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.type_ = type_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.CityBlock other) { if (other == net.osmand.binary.OsmandIndex.CityBlock.getDefaultInstance()) return this; if (other.hasSize()) { @@ -2028,385 +4102,736 @@ public final class OsmandIndex { } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + if (!hasType()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 24: { - setType(input.readInt32()); - break; - } + net.osmand.binary.OsmandIndex.CityBlock parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.CityBlock) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // required int32 type = 3; + private int type_ ; + /** + * required int32 type = 3; + */ public boolean hasType() { - return result.hasType(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * required int32 type = 3; + */ public int getType() { - return result.getType(); + return type_; } + /** + * required int32 type = 3; + */ public Builder setType(int value) { - result.hasType = true; - result.type_ = value; + bitField0_ |= 0x00000004; + type_ = value; + return this; } + /** + * required int32 type = 3; + */ public Builder clearType() { - result.hasType = false; - result.type_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + type_ = 0; + return this; } - - // @@protoc_insertion_point(builder_scope:CityBlock) + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.CityBlock) } - + static { defaultInstance = new CityBlock(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:CityBlock) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.CityBlock) } - + + public interface PoiPartOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // optional string name = 3; + /** + * optional string name = 3; + */ + boolean hasName(); + /** + * optional string name = 3; + */ + java.lang.String getName(); + /** + * optional string name = 3; + */ + com.google.protobuf.ByteString + getNameBytes(); + + // required int32 left = 4; + /** + * required int32 left = 4; + */ + boolean hasLeft(); + /** + * required int32 left = 4; + */ + int getLeft(); + + // required int32 right = 5; + /** + * required int32 right = 5; + */ + boolean hasRight(); + /** + * required int32 right = 5; + */ + int getRight(); + + // required int32 top = 6; + /** + * required int32 top = 6; + */ + boolean hasTop(); + /** + * required int32 top = 6; + */ + int getTop(); + + // required int32 bottom = 7; + /** + * required int32 bottom = 7; + */ + boolean hasBottom(); + /** + * required int32 bottom = 7; + */ + int getBottom(); + } + /** + * Protobuf type {@code OsmAnd.OBF.PoiPart} + */ public static final class PoiPart extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements PoiPartOrBuilder { // Use PoiPart.newBuilder() to construct. - private PoiPart() { - initFields(); + private PoiPart(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private PoiPart(boolean noInit) {} - + private static final PoiPart defaultInstance; public static PoiPart getDefaultInstance() { return defaultInstance; } - + public PoiPart getDefaultInstanceForType() { return defaultInstance; } - + + private PoiPart( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + name_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + left_ = input.readInt32(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + right_ = input.readInt32(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + top_ = input.readInt32(); + break; + } + case 56: { + bitField0_ |= 0x00000040; + bottom_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PoiPart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PoiPart(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // optional string name = 3; public static final int NAME_FIELD_NUMBER = 3; - private boolean hasName; - private java.lang.String name_ = ""; - public boolean hasName() { return hasName; } - public java.lang.String getName() { return name_; } - + private java.lang.Object name_; + /** + * optional string name = 3; + */ + public boolean hasName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string name = 3; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + name_ = s; + } + return s; + } + } + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + // required int32 left = 4; public static final int LEFT_FIELD_NUMBER = 4; - private boolean hasLeft; - private int left_ = 0; - public boolean hasLeft() { return hasLeft; } - public int getLeft() { return left_; } - + private int left_; + /** + * required int32 left = 4; + */ + public boolean hasLeft() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * required int32 left = 4; + */ + public int getLeft() { + return left_; + } + // required int32 right = 5; public static final int RIGHT_FIELD_NUMBER = 5; - private boolean hasRight; - private int right_ = 0; - public boolean hasRight() { return hasRight; } - public int getRight() { return right_; } - + private int right_; + /** + * required int32 right = 5; + */ + public boolean hasRight() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * required int32 right = 5; + */ + public int getRight() { + return right_; + } + // required int32 top = 6; public static final int TOP_FIELD_NUMBER = 6; - private boolean hasTop; - private int top_ = 0; - public boolean hasTop() { return hasTop; } - public int getTop() { return top_; } - + private int top_; + /** + * required int32 top = 6; + */ + public boolean hasTop() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * required int32 top = 6; + */ + public int getTop() { + return top_; + } + // required int32 bottom = 7; public static final int BOTTOM_FIELD_NUMBER = 7; - private boolean hasBottom; - private int bottom_ = 0; - public boolean hasBottom() { return hasBottom; } - public int getBottom() { return bottom_; } - - private void initFields() { + private int bottom_; + /** + * required int32 bottom = 7; + */ + public boolean hasBottom() { + return ((bitField0_ & 0x00000040) == 0x00000040); } + /** + * required int32 bottom = 7; + */ + public int getBottom() { + return bottom_; + } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + name_ = ""; + left_ = 0; + right_ = 0; + top_ = 0; + bottom_ = 0; + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; - if (!hasLeft) return false; - if (!hasRight) return false; - if (!hasTop) return false; - if (!hasBottom) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLeft()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRight()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTop()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasBottom()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasName()) { - output.writeString(3, getName()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getNameBytes()); } - if (hasLeft()) { - output.writeInt32(4, getLeft()); + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(4, left_); } - if (hasRight()) { - output.writeInt32(5, getRight()); + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(5, right_); } - if (hasTop()) { - output.writeInt32(6, getTop()); + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt32(6, top_); } - if (hasBottom()) { - output.writeInt32(7, getBottom()); + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeInt32(7, bottom_); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasName()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(3, getName()); + .computeBytesSize(3, getNameBytes()); } - if (hasLeft()) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, getLeft()); + .computeInt32Size(4, left_); } - if (hasRight()) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, getRight()); + .computeInt32Size(5, right_); } - if (hasTop()) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(6, getTop()); + .computeInt32Size(6, top_); } - if (hasBottom()) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(7, getBottom()); + .computeInt32Size(7, bottom_); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.PoiPart parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.PoiPart parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.PoiPart parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.PoiPart parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.PoiPart parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.PoiPart parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.PoiPart parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.PoiPart parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.PoiPart parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.PoiPart parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.PoiPart prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.PoiPart} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.PoiPart, Builder> { - private net.osmand.binary.OsmandIndex.PoiPart result; - + net.osmand.binary.OsmandIndex.PoiPart, Builder> + implements net.osmand.binary.OsmandIndex.PoiPartOrBuilder { // Construct using net.osmand.binary.OsmandIndex.PoiPart.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.PoiPart(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.PoiPart internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.PoiPart(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + left_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + right_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + top_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.PoiPart getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.PoiPart.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.PoiPart build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.PoiPart result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.PoiPart buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.PoiPart buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.PoiPart result = new net.osmand.binary.OsmandIndex.PoiPart(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - net.osmand.binary.OsmandIndex.PoiPart returnMe = result; - result = null; - return returnMe; + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.name_ = name_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.left_ = left_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.right_ = right_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.top_ = top_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.bottom_ = bottom_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.PoiPart other) { if (other == net.osmand.binary.OsmandIndex.PoiPart.getDefaultInstance()) return this; if (other.hasSize()) { @@ -2416,7 +4841,9 @@ public final class OsmandIndex { setOffset(other.getOffset()); } if (other.hasName()) { - setName(other.getName()); + bitField0_ |= 0x00000004; + name_ = other.name_; + } if (other.hasLeft()) { setLeft(other.getLeft()); @@ -2432,490 +4859,934 @@ public final class OsmandIndex { } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + if (!hasLeft()) { + + return false; + } + if (!hasRight()) { + + return false; + } + if (!hasTop()) { + + return false; + } + if (!hasBottom()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 26: { - setName(input.readString()); - break; - } - case 32: { - setLeft(input.readInt32()); - break; - } - case 40: { - setRight(input.readInt32()); - break; - } - case 48: { - setTop(input.readInt32()); - break; - } - case 56: { - setBottom(input.readInt32()); - break; - } + net.osmand.binary.OsmandIndex.PoiPart parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.PoiPart) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // optional string name = 3; + private java.lang.Object name_ = ""; + /** + * optional string name = 3; + */ public boolean hasName() { - return result.hasName(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional string name = 3; + */ public java.lang.String getName() { - return result.getName(); + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - public Builder setName(java.lang.String value) { + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string name = 3; + */ + public Builder setName( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.hasName = true; - result.name_ = value; + bitField0_ |= 0x00000004; + name_ = value; + return this; } + /** + * optional string name = 3; + */ public Builder clearName() { - result.hasName = false; - result.name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + name_ = getDefaultInstance().getName(); + return this; } - + /** + * optional string name = 3; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + name_ = value; + + return this; + } + // required int32 left = 4; + private int left_ ; + /** + * required int32 left = 4; + */ public boolean hasLeft() { - return result.hasLeft(); + return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * required int32 left = 4; + */ public int getLeft() { - return result.getLeft(); + return left_; } + /** + * required int32 left = 4; + */ public Builder setLeft(int value) { - result.hasLeft = true; - result.left_ = value; + bitField0_ |= 0x00000008; + left_ = value; + return this; } + /** + * required int32 left = 4; + */ public Builder clearLeft() { - result.hasLeft = false; - result.left_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + left_ = 0; + return this; } - + // required int32 right = 5; + private int right_ ; + /** + * required int32 right = 5; + */ public boolean hasRight() { - return result.hasRight(); + return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * required int32 right = 5; + */ public int getRight() { - return result.getRight(); + return right_; } + /** + * required int32 right = 5; + */ public Builder setRight(int value) { - result.hasRight = true; - result.right_ = value; + bitField0_ |= 0x00000010; + right_ = value; + return this; } + /** + * required int32 right = 5; + */ public Builder clearRight() { - result.hasRight = false; - result.right_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + right_ = 0; + return this; } - + // required int32 top = 6; + private int top_ ; + /** + * required int32 top = 6; + */ public boolean hasTop() { - return result.hasTop(); + return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * required int32 top = 6; + */ public int getTop() { - return result.getTop(); + return top_; } + /** + * required int32 top = 6; + */ public Builder setTop(int value) { - result.hasTop = true; - result.top_ = value; + bitField0_ |= 0x00000020; + top_ = value; + return this; } + /** + * required int32 top = 6; + */ public Builder clearTop() { - result.hasTop = false; - result.top_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + top_ = 0; + return this; } - + // required int32 bottom = 7; + private int bottom_ ; + /** + * required int32 bottom = 7; + */ public boolean hasBottom() { - return result.hasBottom(); + return ((bitField0_ & 0x00000040) == 0x00000040); } + /** + * required int32 bottom = 7; + */ public int getBottom() { - return result.getBottom(); + return bottom_; } + /** + * required int32 bottom = 7; + */ public Builder setBottom(int value) { - result.hasBottom = true; - result.bottom_ = value; + bitField0_ |= 0x00000040; + bottom_ = value; + return this; } + /** + * required int32 bottom = 7; + */ public Builder clearBottom() { - result.hasBottom = false; - result.bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + bottom_ = 0; + return this; } - - // @@protoc_insertion_point(builder_scope:PoiPart) + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.PoiPart) } - + static { defaultInstance = new PoiPart(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:PoiPart) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.PoiPart) } - + + public interface MapLevelOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // required int32 left = 4; + /** + * required int32 left = 4; + */ + boolean hasLeft(); + /** + * required int32 left = 4; + */ + int getLeft(); + + // required int32 right = 5; + /** + * required int32 right = 5; + */ + boolean hasRight(); + /** + * required int32 right = 5; + */ + int getRight(); + + // required int32 top = 6; + /** + * required int32 top = 6; + */ + boolean hasTop(); + /** + * required int32 top = 6; + */ + int getTop(); + + // required int32 bottom = 7; + /** + * required int32 bottom = 7; + */ + boolean hasBottom(); + /** + * required int32 bottom = 7; + */ + int getBottom(); + + // optional int32 minzoom = 8; + /** + * optional int32 minzoom = 8; + */ + boolean hasMinzoom(); + /** + * optional int32 minzoom = 8; + */ + int getMinzoom(); + + // optional int32 maxzoom = 9; + /** + * optional int32 maxzoom = 9; + */ + boolean hasMaxzoom(); + /** + * optional int32 maxzoom = 9; + */ + int getMaxzoom(); + } + /** + * Protobuf type {@code OsmAnd.OBF.MapLevel} + */ public static final class MapLevel extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements MapLevelOrBuilder { // Use MapLevel.newBuilder() to construct. - private MapLevel() { - initFields(); + private MapLevel(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private MapLevel(boolean noInit) {} - + private static final MapLevel defaultInstance; public static MapLevel getDefaultInstance() { return defaultInstance; } - + public MapLevel getDefaultInstanceForType() { return defaultInstance; } - + + private MapLevel( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 32: { + bitField0_ |= 0x00000004; + left_ = input.readInt32(); + break; + } + case 40: { + bitField0_ |= 0x00000008; + right_ = input.readInt32(); + break; + } + case 48: { + bitField0_ |= 0x00000010; + top_ = input.readInt32(); + break; + } + case 56: { + bitField0_ |= 0x00000020; + bottom_ = input.readInt32(); + break; + } + case 64: { + bitField0_ |= 0x00000040; + minzoom_ = input.readInt32(); + break; + } + case 72: { + bitField0_ |= 0x00000080; + maxzoom_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public MapLevel parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MapLevel(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // required int32 left = 4; public static final int LEFT_FIELD_NUMBER = 4; - private boolean hasLeft; - private int left_ = 0; - public boolean hasLeft() { return hasLeft; } - public int getLeft() { return left_; } - + private int left_; + /** + * required int32 left = 4; + */ + public boolean hasLeft() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * required int32 left = 4; + */ + public int getLeft() { + return left_; + } + // required int32 right = 5; public static final int RIGHT_FIELD_NUMBER = 5; - private boolean hasRight; - private int right_ = 0; - public boolean hasRight() { return hasRight; } - public int getRight() { return right_; } - + private int right_; + /** + * required int32 right = 5; + */ + public boolean hasRight() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * required int32 right = 5; + */ + public int getRight() { + return right_; + } + // required int32 top = 6; public static final int TOP_FIELD_NUMBER = 6; - private boolean hasTop; - private int top_ = 0; - public boolean hasTop() { return hasTop; } - public int getTop() { return top_; } - + private int top_; + /** + * required int32 top = 6; + */ + public boolean hasTop() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * required int32 top = 6; + */ + public int getTop() { + return top_; + } + // required int32 bottom = 7; public static final int BOTTOM_FIELD_NUMBER = 7; - private boolean hasBottom; - private int bottom_ = 0; - public boolean hasBottom() { return hasBottom; } - public int getBottom() { return bottom_; } - + private int bottom_; + /** + * required int32 bottom = 7; + */ + public boolean hasBottom() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * required int32 bottom = 7; + */ + public int getBottom() { + return bottom_; + } + // optional int32 minzoom = 8; public static final int MINZOOM_FIELD_NUMBER = 8; - private boolean hasMinzoom; - private int minzoom_ = 0; - public boolean hasMinzoom() { return hasMinzoom; } - public int getMinzoom() { return minzoom_; } - + private int minzoom_; + /** + * optional int32 minzoom = 8; + */ + public boolean hasMinzoom() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional int32 minzoom = 8; + */ + public int getMinzoom() { + return minzoom_; + } + // optional int32 maxzoom = 9; public static final int MAXZOOM_FIELD_NUMBER = 9; - private boolean hasMaxzoom; - private int maxzoom_ = 0; - public boolean hasMaxzoom() { return hasMaxzoom; } - public int getMaxzoom() { return maxzoom_; } - - private void initFields() { + private int maxzoom_; + /** + * optional int32 maxzoom = 9; + */ + public boolean hasMaxzoom() { + return ((bitField0_ & 0x00000080) == 0x00000080); } + /** + * optional int32 maxzoom = 9; + */ + public int getMaxzoom() { + return maxzoom_; + } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + left_ = 0; + right_ = 0; + top_ = 0; + bottom_ = 0; + minzoom_ = 0; + maxzoom_ = 0; + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; - if (!hasLeft) return false; - if (!hasRight) return false; - if (!hasTop) return false; - if (!hasBottom) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLeft()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRight()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTop()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasBottom()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasLeft()) { - output.writeInt32(4, getLeft()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(4, left_); } - if (hasRight()) { - output.writeInt32(5, getRight()); + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(5, right_); } - if (hasTop()) { - output.writeInt32(6, getTop()); + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(6, top_); } - if (hasBottom()) { - output.writeInt32(7, getBottom()); + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt32(7, bottom_); } - if (hasMinzoom()) { - output.writeInt32(8, getMinzoom()); + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeInt32(8, minzoom_); } - if (hasMaxzoom()) { - output.writeInt32(9, getMaxzoom()); + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeInt32(9, maxzoom_); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasLeft()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, getLeft()); + .computeInt32Size(4, left_); } - if (hasRight()) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, getRight()); + .computeInt32Size(5, right_); } - if (hasTop()) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(6, getTop()); + .computeInt32Size(6, top_); } - if (hasBottom()) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(7, getBottom()); + .computeInt32Size(7, bottom_); } - if (hasMinzoom()) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(8, getMinzoom()); + .computeInt32Size(8, minzoom_); } - if (hasMaxzoom()) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(9, getMaxzoom()); + .computeInt32Size(9, maxzoom_); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.MapLevel parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.MapLevel parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapLevel parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.MapLevel parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapLevel parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.MapLevel parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapLevel parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.MapLevel parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapLevel parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.MapLevel parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.MapLevel prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.MapLevel} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.MapLevel, Builder> { - private net.osmand.binary.OsmandIndex.MapLevel result; - + net.osmand.binary.OsmandIndex.MapLevel, Builder> + implements net.osmand.binary.OsmandIndex.MapLevelOrBuilder { // Construct using net.osmand.binary.OsmandIndex.MapLevel.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.MapLevel(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.MapLevel internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.MapLevel(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + left_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + right_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + top_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + minzoom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + maxzoom_ = 0; + bitField0_ = (bitField0_ & ~0x00000080); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.MapLevel getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.MapLevel.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.MapLevel build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.MapLevel result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.MapLevel buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.MapLevel buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.MapLevel result = new net.osmand.binary.OsmandIndex.MapLevel(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - net.osmand.binary.OsmandIndex.MapLevel returnMe = result; - result = null; - return returnMe; + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.left_ = left_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.right_ = right_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.top_ = top_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.bottom_ = bottom_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.minzoom_ = minzoom_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000080; + } + result.maxzoom_ = maxzoom_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.MapLevel other) { if (other == net.osmand.binary.OsmandIndex.MapLevel.getDefaultInstance()) return this; if (other.hasSize()) { @@ -2944,461 +5815,800 @@ public final class OsmandIndex { } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + if (!hasLeft()) { + + return false; + } + if (!hasRight()) { + + return false; + } + if (!hasTop()) { + + return false; + } + if (!hasBottom()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 32: { - setLeft(input.readInt32()); - break; - } - case 40: { - setRight(input.readInt32()); - break; - } - case 48: { - setTop(input.readInt32()); - break; - } - case 56: { - setBottom(input.readInt32()); - break; - } - case 64: { - setMinzoom(input.readInt32()); - break; - } - case 72: { - setMaxzoom(input.readInt32()); - break; - } + net.osmand.binary.OsmandIndex.MapLevel parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.MapLevel) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // required int32 left = 4; + private int left_ ; + /** + * required int32 left = 4; + */ public boolean hasLeft() { - return result.hasLeft(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * required int32 left = 4; + */ public int getLeft() { - return result.getLeft(); + return left_; } + /** + * required int32 left = 4; + */ public Builder setLeft(int value) { - result.hasLeft = true; - result.left_ = value; + bitField0_ |= 0x00000004; + left_ = value; + return this; } + /** + * required int32 left = 4; + */ public Builder clearLeft() { - result.hasLeft = false; - result.left_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + left_ = 0; + return this; } - + // required int32 right = 5; + private int right_ ; + /** + * required int32 right = 5; + */ public boolean hasRight() { - return result.hasRight(); + return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * required int32 right = 5; + */ public int getRight() { - return result.getRight(); + return right_; } + /** + * required int32 right = 5; + */ public Builder setRight(int value) { - result.hasRight = true; - result.right_ = value; + bitField0_ |= 0x00000008; + right_ = value; + return this; } + /** + * required int32 right = 5; + */ public Builder clearRight() { - result.hasRight = false; - result.right_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + right_ = 0; + return this; } - + // required int32 top = 6; + private int top_ ; + /** + * required int32 top = 6; + */ public boolean hasTop() { - return result.hasTop(); + return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * required int32 top = 6; + */ public int getTop() { - return result.getTop(); + return top_; } + /** + * required int32 top = 6; + */ public Builder setTop(int value) { - result.hasTop = true; - result.top_ = value; + bitField0_ |= 0x00000010; + top_ = value; + return this; } + /** + * required int32 top = 6; + */ public Builder clearTop() { - result.hasTop = false; - result.top_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + top_ = 0; + return this; } - + // required int32 bottom = 7; + private int bottom_ ; + /** + * required int32 bottom = 7; + */ public boolean hasBottom() { - return result.hasBottom(); + return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * required int32 bottom = 7; + */ public int getBottom() { - return result.getBottom(); + return bottom_; } + /** + * required int32 bottom = 7; + */ public Builder setBottom(int value) { - result.hasBottom = true; - result.bottom_ = value; + bitField0_ |= 0x00000020; + bottom_ = value; + return this; } + /** + * required int32 bottom = 7; + */ public Builder clearBottom() { - result.hasBottom = false; - result.bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + bottom_ = 0; + return this; } - + // optional int32 minzoom = 8; + private int minzoom_ ; + /** + * optional int32 minzoom = 8; + */ public boolean hasMinzoom() { - return result.hasMinzoom(); + return ((bitField0_ & 0x00000040) == 0x00000040); } + /** + * optional int32 minzoom = 8; + */ public int getMinzoom() { - return result.getMinzoom(); + return minzoom_; } + /** + * optional int32 minzoom = 8; + */ public Builder setMinzoom(int value) { - result.hasMinzoom = true; - result.minzoom_ = value; + bitField0_ |= 0x00000040; + minzoom_ = value; + return this; } + /** + * optional int32 minzoom = 8; + */ public Builder clearMinzoom() { - result.hasMinzoom = false; - result.minzoom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + minzoom_ = 0; + return this; } - + // optional int32 maxzoom = 9; + private int maxzoom_ ; + /** + * optional int32 maxzoom = 9; + */ public boolean hasMaxzoom() { - return result.hasMaxzoom(); + return ((bitField0_ & 0x00000080) == 0x00000080); } + /** + * optional int32 maxzoom = 9; + */ public int getMaxzoom() { - return result.getMaxzoom(); + return maxzoom_; } + /** + * optional int32 maxzoom = 9; + */ public Builder setMaxzoom(int value) { - result.hasMaxzoom = true; - result.maxzoom_ = value; + bitField0_ |= 0x00000080; + maxzoom_ = value; + return this; } + /** + * optional int32 maxzoom = 9; + */ public Builder clearMaxzoom() { - result.hasMaxzoom = false; - result.maxzoom_ = 0; + bitField0_ = (bitField0_ & ~0x00000080); + maxzoom_ = 0; + return this; } - - // @@protoc_insertion_point(builder_scope:MapLevel) + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.MapLevel) } - + static { defaultInstance = new MapLevel(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:MapLevel) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.MapLevel) } - + + public interface MapPartOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // optional string name = 3; + /** + * optional string name = 3; + */ + boolean hasName(); + /** + * optional string name = 3; + */ + java.lang.String getName(); + /** + * optional string name = 3; + */ + com.google.protobuf.ByteString + getNameBytes(); + + // repeated .OsmAnd.OBF.MapLevel levels = 5; + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + java.util.List + getLevelsList(); + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + net.osmand.binary.OsmandIndex.MapLevel getLevels(int index); + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + int getLevelsCount(); + } + /** + * Protobuf type {@code OsmAnd.OBF.MapPart} + */ public static final class MapPart extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements MapPartOrBuilder { // Use MapPart.newBuilder() to construct. - private MapPart() { - initFields(); + private MapPart(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private MapPart(boolean noInit) {} - + private static final MapPart defaultInstance; public static MapPart getDefaultInstance() { return defaultInstance; } - + public MapPart getDefaultInstanceForType() { return defaultInstance; } - + + private MapPart( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + name_ = input.readBytes(); + break; + } + case 42: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + levels_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + levels_.add(input.readMessage(net.osmand.binary.OsmandIndex.MapLevel.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + levels_ = java.util.Collections.unmodifiableList(levels_); + } + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public MapPart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MapPart(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // optional string name = 3; public static final int NAME_FIELD_NUMBER = 3; - private boolean hasName; - private java.lang.String name_ = ""; - public boolean hasName() { return hasName; } - public java.lang.String getName() { return name_; } - - // repeated .MapLevel levels = 5; + private java.lang.Object name_; + /** + * optional string name = 3; + */ + public boolean hasName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string name = 3; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + name_ = s; + } + return s; + } + } + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .OsmAnd.OBF.MapLevel levels = 5; public static final int LEVELS_FIELD_NUMBER = 5; - private java.util.List levels_ = - java.util.Collections.emptyList(); + private java.util.List levels_; + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public java.util.List getLevelsList() { return levels_; } - public int getLevelsCount() { return levels_.size(); } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public java.util.List + getLevelsOrBuilderList() { + return levels_; + } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public int getLevelsCount() { + return levels_.size(); + } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public net.osmand.binary.OsmandIndex.MapLevel getLevels(int index) { return levels_.get(index); } - - private void initFields() { + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public net.osmand.binary.OsmandIndex.MapLevelOrBuilder getLevelsOrBuilder( + int index) { + return levels_.get(index); } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + name_ = ""; + levels_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; - for (net.osmand.binary.OsmandIndex.MapLevel element : getLevelsList()) { - if (!element.isInitialized()) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getLevelsCount(); i++) { + if (!getLevels(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasName()) { - output.writeString(3, getName()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getNameBytes()); } - for (net.osmand.binary.OsmandIndex.MapLevel element : getLevelsList()) { - output.writeMessage(5, element); + for (int i = 0; i < levels_.size(); i++) { + output.writeMessage(5, levels_.get(i)); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasName()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(3, getName()); + .computeBytesSize(3, getNameBytes()); } - for (net.osmand.binary.OsmandIndex.MapLevel element : getLevelsList()) { + for (int i = 0; i < levels_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(5, element); + .computeMessageSize(5, levels_.get(i)); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.MapPart parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.MapPart parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapPart parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.MapPart parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapPart parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.MapPart parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapPart parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.MapPart parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.MapPart parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.MapPart parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.MapPart prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.MapPart} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.MapPart, Builder> { - private net.osmand.binary.OsmandIndex.MapPart result; - + net.osmand.binary.OsmandIndex.MapPart, Builder> + implements net.osmand.binary.OsmandIndex.MapPartOrBuilder { // Construct using net.osmand.binary.OsmandIndex.MapPart.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.MapPart(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.MapPart internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.MapPart(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + levels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.MapPart getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.MapPart.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.MapPart build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.MapPart result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.MapPart buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.MapPart buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.MapPart result = new net.osmand.binary.OsmandIndex.MapPart(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - if (result.levels_ != java.util.Collections.EMPTY_LIST) { - result.levels_ = - java.util.Collections.unmodifiableList(result.levels_); + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; } - net.osmand.binary.OsmandIndex.MapPart returnMe = result; - result = null; - return returnMe; + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.name_ = name_; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + levels_ = java.util.Collections.unmodifiableList(levels_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.levels_ = levels_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.MapPart other) { if (other == net.osmand.binary.OsmandIndex.MapPart.getDefaultInstance()) return this; if (other.hasSize()) { @@ -3408,470 +6618,937 @@ public final class OsmandIndex { setOffset(other.getOffset()); } if (other.hasName()) { - setName(other.getName()); + bitField0_ |= 0x00000004; + name_ = other.name_; + } if (!other.levels_.isEmpty()) { - if (result.levels_.isEmpty()) { - result.levels_ = new java.util.ArrayList(); + if (levels_.isEmpty()) { + levels_ = other.levels_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureLevelsIsMutable(); + levels_.addAll(other.levels_); } - result.levels_.addAll(other.levels_); + } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + for (int i = 0; i < getLevelsCount(); i++) { + if (!getLevels(i).isInitialized()) { + + return false; + } + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 26: { - setName(input.readString()); - break; - } - case 42: { - net.osmand.binary.OsmandIndex.MapLevel.Builder subBuilder = net.osmand.binary.OsmandIndex.MapLevel.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addLevels(subBuilder.buildPartial()); - break; - } + net.osmand.binary.OsmandIndex.MapPart parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.MapPart) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // optional string name = 3; + private java.lang.Object name_ = ""; + /** + * optional string name = 3; + */ public boolean hasName() { - return result.hasName(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional string name = 3; + */ public java.lang.String getName() { - return result.getName(); + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - public Builder setName(java.lang.String value) { + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string name = 3; + */ + public Builder setName( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.hasName = true; - result.name_ = value; + bitField0_ |= 0x00000004; + name_ = value; + return this; } + /** + * optional string name = 3; + */ public Builder clearName() { - result.hasName = false; - result.name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + name_ = getDefaultInstance().getName(); + return this; } - - // repeated .MapLevel levels = 5; + /** + * optional string name = 3; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + name_ = value; + + return this; + } + + // repeated .OsmAnd.OBF.MapLevel levels = 5; + private java.util.List levels_ = + java.util.Collections.emptyList(); + private void ensureLevelsIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + levels_ = new java.util.ArrayList(levels_); + bitField0_ |= 0x00000008; + } + } + + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public java.util.List getLevelsList() { - return java.util.Collections.unmodifiableList(result.levels_); + return java.util.Collections.unmodifiableList(levels_); } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public int getLevelsCount() { - return result.getLevelsCount(); + return levels_.size(); } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public net.osmand.binary.OsmandIndex.MapLevel getLevels(int index) { - return result.getLevels(index); + return levels_.get(index); } - public Builder setLevels(int index, net.osmand.binary.OsmandIndex.MapLevel value) { + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public Builder setLevels( + int index, net.osmand.binary.OsmandIndex.MapLevel value) { if (value == null) { throw new NullPointerException(); } - result.levels_.set(index, value); + ensureLevelsIsMutable(); + levels_.set(index, value); + return this; } - public Builder setLevels(int index, net.osmand.binary.OsmandIndex.MapLevel.Builder builderForValue) { - result.levels_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public Builder setLevels( + int index, net.osmand.binary.OsmandIndex.MapLevel.Builder builderForValue) { + ensureLevelsIsMutable(); + levels_.set(index, builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public Builder addLevels(net.osmand.binary.OsmandIndex.MapLevel value) { if (value == null) { throw new NullPointerException(); } - if (result.levels_.isEmpty()) { - result.levels_ = new java.util.ArrayList(); - } - result.levels_.add(value); + ensureLevelsIsMutable(); + levels_.add(value); + return this; } - public Builder addLevels(net.osmand.binary.OsmandIndex.MapLevel.Builder builderForValue) { - if (result.levels_.isEmpty()) { - result.levels_ = new java.util.ArrayList(); + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public Builder addLevels( + int index, net.osmand.binary.OsmandIndex.MapLevel value) { + if (value == null) { + throw new NullPointerException(); } - result.levels_.add(builderForValue.build()); + ensureLevelsIsMutable(); + levels_.add(index, value); + return this; } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public Builder addLevels( + net.osmand.binary.OsmandIndex.MapLevel.Builder builderForValue) { + ensureLevelsIsMutable(); + levels_.add(builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public Builder addLevels( + int index, net.osmand.binary.OsmandIndex.MapLevel.Builder builderForValue) { + ensureLevelsIsMutable(); + levels_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public Builder addAllLevels( java.lang.Iterable values) { - if (result.levels_.isEmpty()) { - result.levels_ = new java.util.ArrayList(); - } - super.addAll(values, result.levels_); + ensureLevelsIsMutable(); + super.addAll(values, levels_); + return this; } + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ public Builder clearLevels() { - result.levels_ = java.util.Collections.emptyList(); + levels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + return this; } - - // @@protoc_insertion_point(builder_scope:MapPart) + /** + * repeated .OsmAnd.OBF.MapLevel levels = 5; + */ + public Builder removeLevels(int index) { + ensureLevelsIsMutable(); + levels_.remove(index); + + return this; + } + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.MapPart) } - + static { defaultInstance = new MapPart(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:MapPart) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.MapPart) } - + + public interface RoutingSubregionOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // optional bool basemap = 3; + /** + * optional bool basemap = 3; + */ + boolean hasBasemap(); + /** + * optional bool basemap = 3; + */ + boolean getBasemap(); + + // required int32 left = 4; + /** + * required int32 left = 4; + */ + boolean hasLeft(); + /** + * required int32 left = 4; + */ + int getLeft(); + + // required int32 right = 5; + /** + * required int32 right = 5; + */ + boolean hasRight(); + /** + * required int32 right = 5; + */ + int getRight(); + + // required int32 top = 6; + /** + * required int32 top = 6; + */ + boolean hasTop(); + /** + * required int32 top = 6; + */ + int getTop(); + + // required int32 bottom = 7; + /** + * required int32 bottom = 7; + */ + boolean hasBottom(); + /** + * required int32 bottom = 7; + */ + int getBottom(); + + // required uint32 shifToData = 8; + /** + * required uint32 shifToData = 8; + */ + boolean hasShifToData(); + /** + * required uint32 shifToData = 8; + */ + int getShifToData(); + } + /** + * Protobuf type {@code OsmAnd.OBF.RoutingSubregion} + */ public static final class RoutingSubregion extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements RoutingSubregionOrBuilder { // Use RoutingSubregion.newBuilder() to construct. - private RoutingSubregion() { - initFields(); + private RoutingSubregion(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private RoutingSubregion(boolean noInit) {} - + private static final RoutingSubregion defaultInstance; public static RoutingSubregion getDefaultInstance() { return defaultInstance; } - + public RoutingSubregion getDefaultInstanceForType() { return defaultInstance; } - + + private RoutingSubregion( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + basemap_ = input.readBool(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + left_ = input.readInt32(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + right_ = input.readInt32(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + top_ = input.readInt32(); + break; + } + case 56: { + bitField0_ |= 0x00000040; + bottom_ = input.readInt32(); + break; + } + case 64: { + bitField0_ |= 0x00000080; + shifToData_ = input.readUInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public RoutingSubregion parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RoutingSubregion(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // optional bool basemap = 3; public static final int BASEMAP_FIELD_NUMBER = 3; - private boolean hasBasemap; - private boolean basemap_ = false; - public boolean hasBasemap() { return hasBasemap; } - public boolean getBasemap() { return basemap_; } - + private boolean basemap_; + /** + * optional bool basemap = 3; + */ + public boolean hasBasemap() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional bool basemap = 3; + */ + public boolean getBasemap() { + return basemap_; + } + // required int32 left = 4; public static final int LEFT_FIELD_NUMBER = 4; - private boolean hasLeft; - private int left_ = 0; - public boolean hasLeft() { return hasLeft; } - public int getLeft() { return left_; } - + private int left_; + /** + * required int32 left = 4; + */ + public boolean hasLeft() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * required int32 left = 4; + */ + public int getLeft() { + return left_; + } + // required int32 right = 5; public static final int RIGHT_FIELD_NUMBER = 5; - private boolean hasRight; - private int right_ = 0; - public boolean hasRight() { return hasRight; } - public int getRight() { return right_; } - + private int right_; + /** + * required int32 right = 5; + */ + public boolean hasRight() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * required int32 right = 5; + */ + public int getRight() { + return right_; + } + // required int32 top = 6; public static final int TOP_FIELD_NUMBER = 6; - private boolean hasTop; - private int top_ = 0; - public boolean hasTop() { return hasTop; } - public int getTop() { return top_; } - + private int top_; + /** + * required int32 top = 6; + */ + public boolean hasTop() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * required int32 top = 6; + */ + public int getTop() { + return top_; + } + // required int32 bottom = 7; public static final int BOTTOM_FIELD_NUMBER = 7; - private boolean hasBottom; - private int bottom_ = 0; - public boolean hasBottom() { return hasBottom; } - public int getBottom() { return bottom_; } - + private int bottom_; + /** + * required int32 bottom = 7; + */ + public boolean hasBottom() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * required int32 bottom = 7; + */ + public int getBottom() { + return bottom_; + } + // required uint32 shifToData = 8; public static final int SHIFTODATA_FIELD_NUMBER = 8; - private boolean hasShifToData; - private int shifToData_ = 0; - public boolean hasShifToData() { return hasShifToData; } - public int getShifToData() { return shifToData_; } - - private void initFields() { + private int shifToData_; + /** + * required uint32 shifToData = 8; + */ + public boolean hasShifToData() { + return ((bitField0_ & 0x00000080) == 0x00000080); } + /** + * required uint32 shifToData = 8; + */ + public int getShifToData() { + return shifToData_; + } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + basemap_ = false; + left_ = 0; + right_ = 0; + top_ = 0; + bottom_ = 0; + shifToData_ = 0; + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; - if (!hasLeft) return false; - if (!hasRight) return false; - if (!hasTop) return false; - if (!hasBottom) return false; - if (!hasShifToData) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLeft()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRight()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTop()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasBottom()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasShifToData()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasBasemap()) { - output.writeBool(3, getBasemap()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBool(3, basemap_); } - if (hasLeft()) { - output.writeInt32(4, getLeft()); + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(4, left_); } - if (hasRight()) { - output.writeInt32(5, getRight()); + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(5, right_); } - if (hasTop()) { - output.writeInt32(6, getTop()); + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt32(6, top_); } - if (hasBottom()) { - output.writeInt32(7, getBottom()); + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeInt32(7, bottom_); } - if (hasShifToData()) { - output.writeUInt32(8, getShifToData()); + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeUInt32(8, shifToData_); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasBasemap()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeBoolSize(3, getBasemap()); + .computeBoolSize(3, basemap_); } - if (hasLeft()) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, getLeft()); + .computeInt32Size(4, left_); } - if (hasRight()) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, getRight()); + .computeInt32Size(5, right_); } - if (hasTop()) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(6, getTop()); + .computeInt32Size(6, top_); } - if (hasBottom()) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(7, getBottom()); + .computeInt32Size(7, bottom_); } - if (hasShifToData()) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(8, getShifToData()); + .computeUInt32Size(8, shifToData_); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.RoutingSubregion parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.RoutingSubregion prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.RoutingSubregion} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.RoutingSubregion, Builder> { - private net.osmand.binary.OsmandIndex.RoutingSubregion result; - + net.osmand.binary.OsmandIndex.RoutingSubregion, Builder> + implements net.osmand.binary.OsmandIndex.RoutingSubregionOrBuilder { // Construct using net.osmand.binary.OsmandIndex.RoutingSubregion.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.RoutingSubregion(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.RoutingSubregion internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.RoutingSubregion(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + basemap_ = false; + bitField0_ = (bitField0_ & ~0x00000004); + left_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + right_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + top_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + shifToData_ = 0; + bitField0_ = (bitField0_ & ~0x00000080); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.RoutingSubregion getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.RoutingSubregion.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.RoutingSubregion build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.RoutingSubregion result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.RoutingSubregion buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.RoutingSubregion buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.RoutingSubregion result = new net.osmand.binary.OsmandIndex.RoutingSubregion(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - net.osmand.binary.OsmandIndex.RoutingSubregion returnMe = result; - result = null; - return returnMe; + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.basemap_ = basemap_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.left_ = left_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.right_ = right_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.top_ = top_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.bottom_ = bottom_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000080; + } + result.shifToData_ = shifToData_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.RoutingSubregion other) { if (other == net.osmand.binary.OsmandIndex.RoutingSubregion.getDefaultInstance()) return this; if (other.hasSize()) { @@ -3900,461 +7577,804 @@ public final class OsmandIndex { } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + if (!hasLeft()) { + + return false; + } + if (!hasRight()) { + + return false; + } + if (!hasTop()) { + + return false; + } + if (!hasBottom()) { + + return false; + } + if (!hasShifToData()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 24: { - setBasemap(input.readBool()); - break; - } - case 32: { - setLeft(input.readInt32()); - break; - } - case 40: { - setRight(input.readInt32()); - break; - } - case 48: { - setTop(input.readInt32()); - break; - } - case 56: { - setBottom(input.readInt32()); - break; - } - case 64: { - setShifToData(input.readUInt32()); - break; - } + net.osmand.binary.OsmandIndex.RoutingSubregion parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.RoutingSubregion) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // optional bool basemap = 3; + private boolean basemap_ ; + /** + * optional bool basemap = 3; + */ public boolean hasBasemap() { - return result.hasBasemap(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional bool basemap = 3; + */ public boolean getBasemap() { - return result.getBasemap(); + return basemap_; } + /** + * optional bool basemap = 3; + */ public Builder setBasemap(boolean value) { - result.hasBasemap = true; - result.basemap_ = value; + bitField0_ |= 0x00000004; + basemap_ = value; + return this; } + /** + * optional bool basemap = 3; + */ public Builder clearBasemap() { - result.hasBasemap = false; - result.basemap_ = false; + bitField0_ = (bitField0_ & ~0x00000004); + basemap_ = false; + return this; } - + // required int32 left = 4; + private int left_ ; + /** + * required int32 left = 4; + */ public boolean hasLeft() { - return result.hasLeft(); + return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * required int32 left = 4; + */ public int getLeft() { - return result.getLeft(); + return left_; } + /** + * required int32 left = 4; + */ public Builder setLeft(int value) { - result.hasLeft = true; - result.left_ = value; + bitField0_ |= 0x00000008; + left_ = value; + return this; } + /** + * required int32 left = 4; + */ public Builder clearLeft() { - result.hasLeft = false; - result.left_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + left_ = 0; + return this; } - + // required int32 right = 5; + private int right_ ; + /** + * required int32 right = 5; + */ public boolean hasRight() { - return result.hasRight(); + return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * required int32 right = 5; + */ public int getRight() { - return result.getRight(); + return right_; } + /** + * required int32 right = 5; + */ public Builder setRight(int value) { - result.hasRight = true; - result.right_ = value; + bitField0_ |= 0x00000010; + right_ = value; + return this; } + /** + * required int32 right = 5; + */ public Builder clearRight() { - result.hasRight = false; - result.right_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + right_ = 0; + return this; } - + // required int32 top = 6; + private int top_ ; + /** + * required int32 top = 6; + */ public boolean hasTop() { - return result.hasTop(); + return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * required int32 top = 6; + */ public int getTop() { - return result.getTop(); + return top_; } + /** + * required int32 top = 6; + */ public Builder setTop(int value) { - result.hasTop = true; - result.top_ = value; + bitField0_ |= 0x00000020; + top_ = value; + return this; } + /** + * required int32 top = 6; + */ public Builder clearTop() { - result.hasTop = false; - result.top_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + top_ = 0; + return this; } - + // required int32 bottom = 7; + private int bottom_ ; + /** + * required int32 bottom = 7; + */ public boolean hasBottom() { - return result.hasBottom(); + return ((bitField0_ & 0x00000040) == 0x00000040); } + /** + * required int32 bottom = 7; + */ public int getBottom() { - return result.getBottom(); + return bottom_; } + /** + * required int32 bottom = 7; + */ public Builder setBottom(int value) { - result.hasBottom = true; - result.bottom_ = value; + bitField0_ |= 0x00000040; + bottom_ = value; + return this; } + /** + * required int32 bottom = 7; + */ public Builder clearBottom() { - result.hasBottom = false; - result.bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + bottom_ = 0; + return this; } - + // required uint32 shifToData = 8; + private int shifToData_ ; + /** + * required uint32 shifToData = 8; + */ public boolean hasShifToData() { - return result.hasShifToData(); + return ((bitField0_ & 0x00000080) == 0x00000080); } + /** + * required uint32 shifToData = 8; + */ public int getShifToData() { - return result.getShifToData(); + return shifToData_; } + /** + * required uint32 shifToData = 8; + */ public Builder setShifToData(int value) { - result.hasShifToData = true; - result.shifToData_ = value; + bitField0_ |= 0x00000080; + shifToData_ = value; + return this; } + /** + * required uint32 shifToData = 8; + */ public Builder clearShifToData() { - result.hasShifToData = false; - result.shifToData_ = 0; + bitField0_ = (bitField0_ & ~0x00000080); + shifToData_ = 0; + return this; } - - // @@protoc_insertion_point(builder_scope:RoutingSubregion) + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.RoutingSubregion) } - + static { defaultInstance = new RoutingSubregion(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:RoutingSubregion) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.RoutingSubregion) } - + + public interface RoutingPartOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // optional string name = 3; + /** + * optional string name = 3; + */ + boolean hasName(); + /** + * optional string name = 3; + */ + java.lang.String getName(); + /** + * optional string name = 3; + */ + com.google.protobuf.ByteString + getNameBytes(); + + // repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + java.util.List + getSubregionsList(); + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + net.osmand.binary.OsmandIndex.RoutingSubregion getSubregions(int index); + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + int getSubregionsCount(); + } + /** + * Protobuf type {@code OsmAnd.OBF.RoutingPart} + */ public static final class RoutingPart extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements RoutingPartOrBuilder { // Use RoutingPart.newBuilder() to construct. - private RoutingPart() { - initFields(); + private RoutingPart(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private RoutingPart(boolean noInit) {} - + private static final RoutingPart defaultInstance; public static RoutingPart getDefaultInstance() { return defaultInstance; } - + public RoutingPart getDefaultInstanceForType() { return defaultInstance; } - + + private RoutingPart( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + name_ = input.readBytes(); + break; + } + case 42: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + subregions_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + subregions_.add(input.readMessage(net.osmand.binary.OsmandIndex.RoutingSubregion.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + subregions_ = java.util.Collections.unmodifiableList(subregions_); + } + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public RoutingPart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RoutingPart(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // optional string name = 3; public static final int NAME_FIELD_NUMBER = 3; - private boolean hasName; - private java.lang.String name_ = ""; - public boolean hasName() { return hasName; } - public java.lang.String getName() { return name_; } - - // repeated .RoutingSubregion subregions = 5; + private java.lang.Object name_; + /** + * optional string name = 3; + */ + public boolean hasName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string name = 3; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + name_ = s; + } + return s; + } + } + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; public static final int SUBREGIONS_FIELD_NUMBER = 5; - private java.util.List subregions_ = - java.util.Collections.emptyList(); + private java.util.List subregions_; + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public java.util.List getSubregionsList() { return subregions_; } - public int getSubregionsCount() { return subregions_.size(); } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public java.util.List + getSubregionsOrBuilderList() { + return subregions_; + } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public int getSubregionsCount() { + return subregions_.size(); + } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public net.osmand.binary.OsmandIndex.RoutingSubregion getSubregions(int index) { return subregions_.get(index); } - - private void initFields() { + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public net.osmand.binary.OsmandIndex.RoutingSubregionOrBuilder getSubregionsOrBuilder( + int index) { + return subregions_.get(index); } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + name_ = ""; + subregions_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; - for (net.osmand.binary.OsmandIndex.RoutingSubregion element : getSubregionsList()) { - if (!element.isInitialized()) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getSubregionsCount(); i++) { + if (!getSubregions(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasName()) { - output.writeString(3, getName()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getNameBytes()); } - for (net.osmand.binary.OsmandIndex.RoutingSubregion element : getSubregionsList()) { - output.writeMessage(5, element); + for (int i = 0; i < subregions_.size(); i++) { + output.writeMessage(5, subregions_.get(i)); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasName()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(3, getName()); + .computeBytesSize(3, getNameBytes()); } - for (net.osmand.binary.OsmandIndex.RoutingSubregion element : getSubregionsList()) { + for (int i = 0; i < subregions_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(5, element); + .computeMessageSize(5, subregions_.get(i)); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingPart parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.RoutingPart parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.RoutingPart parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.RoutingPart prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.RoutingPart} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.RoutingPart, Builder> { - private net.osmand.binary.OsmandIndex.RoutingPart result; - + net.osmand.binary.OsmandIndex.RoutingPart, Builder> + implements net.osmand.binary.OsmandIndex.RoutingPartOrBuilder { // Construct using net.osmand.binary.OsmandIndex.RoutingPart.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.RoutingPart(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.RoutingPart internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.RoutingPart(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + subregions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.RoutingPart getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.RoutingPart.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.RoutingPart build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.RoutingPart result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.RoutingPart buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.RoutingPart buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.RoutingPart result = new net.osmand.binary.OsmandIndex.RoutingPart(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - if (result.subregions_ != java.util.Collections.EMPTY_LIST) { - result.subregions_ = - java.util.Collections.unmodifiableList(result.subregions_); + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; } - net.osmand.binary.OsmandIndex.RoutingPart returnMe = result; - result = null; - return returnMe; + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.name_ = name_; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + subregions_ = java.util.Collections.unmodifiableList(subregions_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.subregions_ = subregions_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.RoutingPart other) { if (other == net.osmand.binary.OsmandIndex.RoutingPart.getDefaultInstance()) return this; if (other.hasSize()) { @@ -4364,507 +8384,1174 @@ public final class OsmandIndex { setOffset(other.getOffset()); } if (other.hasName()) { - setName(other.getName()); + bitField0_ |= 0x00000004; + name_ = other.name_; + } if (!other.subregions_.isEmpty()) { - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); + if (subregions_.isEmpty()) { + subregions_ = other.subregions_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureSubregionsIsMutable(); + subregions_.addAll(other.subregions_); } - result.subregions_.addAll(other.subregions_); + } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + for (int i = 0; i < getSubregionsCount(); i++) { + if (!getSubregions(i).isInitialized()) { + + return false; + } + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 26: { - setName(input.readString()); - break; - } - case 42: { - net.osmand.binary.OsmandIndex.RoutingSubregion.Builder subBuilder = net.osmand.binary.OsmandIndex.RoutingSubregion.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addSubregions(subBuilder.buildPartial()); - break; - } + net.osmand.binary.OsmandIndex.RoutingPart parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.RoutingPart) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // optional string name = 3; + private java.lang.Object name_ = ""; + /** + * optional string name = 3; + */ public boolean hasName() { - return result.hasName(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional string name = 3; + */ public java.lang.String getName() { - return result.getName(); + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - public Builder setName(java.lang.String value) { + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string name = 3; + */ + public Builder setName( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.hasName = true; - result.name_ = value; + bitField0_ |= 0x00000004; + name_ = value; + return this; } + /** + * optional string name = 3; + */ public Builder clearName() { - result.hasName = false; - result.name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + name_ = getDefaultInstance().getName(); + return this; } - - // repeated .RoutingSubregion subregions = 5; + /** + * optional string name = 3; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + name_ = value; + + return this; + } + + // repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + private java.util.List subregions_ = + java.util.Collections.emptyList(); + private void ensureSubregionsIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + subregions_ = new java.util.ArrayList(subregions_); + bitField0_ |= 0x00000008; + } + } + + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public java.util.List getSubregionsList() { - return java.util.Collections.unmodifiableList(result.subregions_); + return java.util.Collections.unmodifiableList(subregions_); } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public int getSubregionsCount() { - return result.getSubregionsCount(); + return subregions_.size(); } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public net.osmand.binary.OsmandIndex.RoutingSubregion getSubregions(int index) { - return result.getSubregions(index); + return subregions_.get(index); } - public Builder setSubregions(int index, net.osmand.binary.OsmandIndex.RoutingSubregion value) { + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public Builder setSubregions( + int index, net.osmand.binary.OsmandIndex.RoutingSubregion value) { if (value == null) { throw new NullPointerException(); } - result.subregions_.set(index, value); + ensureSubregionsIsMutable(); + subregions_.set(index, value); + return this; } - public Builder setSubregions(int index, net.osmand.binary.OsmandIndex.RoutingSubregion.Builder builderForValue) { - result.subregions_.set(index, builderForValue.build()); + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public Builder setSubregions( + int index, net.osmand.binary.OsmandIndex.RoutingSubregion.Builder builderForValue) { + ensureSubregionsIsMutable(); + subregions_.set(index, builderForValue.build()); + return this; } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public Builder addSubregions(net.osmand.binary.OsmandIndex.RoutingSubregion value) { if (value == null) { throw new NullPointerException(); } - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); - } - result.subregions_.add(value); + ensureSubregionsIsMutable(); + subregions_.add(value); + return this; } - public Builder addSubregions(net.osmand.binary.OsmandIndex.RoutingSubregion.Builder builderForValue) { - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public Builder addSubregions( + int index, net.osmand.binary.OsmandIndex.RoutingSubregion value) { + if (value == null) { + throw new NullPointerException(); } - result.subregions_.add(builderForValue.build()); + ensureSubregionsIsMutable(); + subregions_.add(index, value); + return this; } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public Builder addSubregions( + net.osmand.binary.OsmandIndex.RoutingSubregion.Builder builderForValue) { + ensureSubregionsIsMutable(); + subregions_.add(builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public Builder addSubregions( + int index, net.osmand.binary.OsmandIndex.RoutingSubregion.Builder builderForValue) { + ensureSubregionsIsMutable(); + subregions_.add(index, builderForValue.build()); + + return this; + } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public Builder addAllSubregions( java.lang.Iterable values) { - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); - } - super.addAll(values, result.subregions_); + ensureSubregionsIsMutable(); + super.addAll(values, subregions_); + return this; } + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ public Builder clearSubregions() { - result.subregions_ = java.util.Collections.emptyList(); + subregions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + return this; } - - // @@protoc_insertion_point(builder_scope:RoutingPart) + /** + * repeated .OsmAnd.OBF.RoutingSubregion subregions = 5; + */ + public Builder removeSubregions(int index) { + ensureSubregionsIsMutable(); + subregions_.remove(index); + + return this; + } + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.RoutingPart) } - + static { defaultInstance = new RoutingPart(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:RoutingPart) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.RoutingPart) } - + + public interface TransportPartOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required int64 size = 1; + /** + * required int64 size = 1; + */ + boolean hasSize(); + /** + * required int64 size = 1; + */ + long getSize(); + + // required int64 offset = 2; + /** + * required int64 offset = 2; + */ + boolean hasOffset(); + /** + * required int64 offset = 2; + */ + long getOffset(); + + // optional string name = 3; + /** + * optional string name = 3; + */ + boolean hasName(); + /** + * optional string name = 3; + */ + java.lang.String getName(); + /** + * optional string name = 3; + */ + com.google.protobuf.ByteString + getNameBytes(); + + // optional int32 left = 4; + /** + * optional int32 left = 4; + */ + boolean hasLeft(); + /** + * optional int32 left = 4; + */ + int getLeft(); + + // optional int32 right = 5; + /** + * optional int32 right = 5; + */ + boolean hasRight(); + /** + * optional int32 right = 5; + */ + int getRight(); + + // optional int32 top = 6; + /** + * optional int32 top = 6; + */ + boolean hasTop(); + /** + * optional int32 top = 6; + */ + int getTop(); + + // optional int32 bottom = 7; + /** + * optional int32 bottom = 7; + */ + boolean hasBottom(); + /** + * optional int32 bottom = 7; + */ + int getBottom(); + + // optional uint32 stringTableOffset = 8; + /** + * optional uint32 stringTableOffset = 8; + */ + boolean hasStringTableOffset(); + /** + * optional uint32 stringTableOffset = 8; + */ + int getStringTableOffset(); + + // optional uint32 stringTableLength = 9; + /** + * optional uint32 stringTableLength = 9; + */ + boolean hasStringTableLength(); + /** + * optional uint32 stringTableLength = 9; + */ + int getStringTableLength(); + + // optional uint32 stopsTableOffset = 10; + /** + * optional uint32 stopsTableOffset = 10; + */ + boolean hasStopsTableOffset(); + /** + * optional uint32 stopsTableOffset = 10; + */ + int getStopsTableOffset(); + + // optional uint32 stopsTableLength = 11; + /** + * optional uint32 stopsTableLength = 11; + */ + boolean hasStopsTableLength(); + /** + * optional uint32 stopsTableLength = 11; + */ + int getStopsTableLength(); + + // optional uint32 incompleteRoutesOffset = 12; + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + boolean hasIncompleteRoutesOffset(); + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + int getIncompleteRoutesOffset(); + + // optional uint32 incompleteRoutesLength = 13; + /** + * optional uint32 incompleteRoutesLength = 13; + */ + boolean hasIncompleteRoutesLength(); + /** + * optional uint32 incompleteRoutesLength = 13; + */ + int getIncompleteRoutesLength(); + } + /** + * Protobuf type {@code OsmAnd.OBF.TransportPart} + */ public static final class TransportPart extends - com.google.protobuf.GeneratedMessageLite { + com.google.protobuf.GeneratedMessageLite + implements TransportPartOrBuilder { // Use TransportPart.newBuilder() to construct. - private TransportPart() { - initFields(); + private TransportPart(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + } private TransportPart(boolean noInit) {} - + private static final TransportPart defaultInstance; public static TransportPart getDefaultInstance() { return defaultInstance; } - + public TransportPart getDefaultInstanceForType() { return defaultInstance; } - + + private TransportPart( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + size_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + offset_ = input.readInt64(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + name_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + left_ = input.readInt32(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + right_ = input.readInt32(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + top_ = input.readInt32(); + break; + } + case 56: { + bitField0_ |= 0x00000040; + bottom_ = input.readInt32(); + break; + } + case 64: { + bitField0_ |= 0x00000080; + stringTableOffset_ = input.readUInt32(); + break; + } + case 72: { + bitField0_ |= 0x00000100; + stringTableLength_ = input.readUInt32(); + break; + } + case 80: { + bitField0_ |= 0x00000200; + stopsTableOffset_ = input.readUInt32(); + break; + } + case 88: { + bitField0_ |= 0x00000400; + stopsTableLength_ = input.readUInt32(); + break; + } + case 96: { + bitField0_ |= 0x00000800; + incompleteRoutesOffset_ = input.readUInt32(); + break; + } + case 104: { + bitField0_ |= 0x00001000; + incompleteRoutesLength_ = input.readUInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public TransportPart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TransportPart(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; // required int64 size = 1; public static final int SIZE_FIELD_NUMBER = 1; - private boolean hasSize; - private long size_ = 0L; - public boolean hasSize() { return hasSize; } - public long getSize() { return size_; } - + private long size_; + /** + * required int64 size = 1; + */ + public boolean hasSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required int64 size = 1; + */ + public long getSize() { + return size_; + } + // required int64 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; - private boolean hasOffset; - private long offset_ = 0L; - public boolean hasOffset() { return hasOffset; } - public long getOffset() { return offset_; } - + private long offset_; + /** + * required int64 offset = 2; + */ + public boolean hasOffset() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required int64 offset = 2; + */ + public long getOffset() { + return offset_; + } + // optional string name = 3; public static final int NAME_FIELD_NUMBER = 3; - private boolean hasName; - private java.lang.String name_ = ""; - public boolean hasName() { return hasName; } - public java.lang.String getName() { return name_; } - + private java.lang.Object name_; + /** + * optional string name = 3; + */ + public boolean hasName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string name = 3; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + name_ = s; + } + return s; + } + } + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + // optional int32 left = 4; public static final int LEFT_FIELD_NUMBER = 4; - private boolean hasLeft; - private int left_ = 0; - public boolean hasLeft() { return hasLeft; } - public int getLeft() { return left_; } - + private int left_; + /** + * optional int32 left = 4; + */ + public boolean hasLeft() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional int32 left = 4; + */ + public int getLeft() { + return left_; + } + // optional int32 right = 5; public static final int RIGHT_FIELD_NUMBER = 5; - private boolean hasRight; - private int right_ = 0; - public boolean hasRight() { return hasRight; } - public int getRight() { return right_; } - + private int right_; + /** + * optional int32 right = 5; + */ + public boolean hasRight() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional int32 right = 5; + */ + public int getRight() { + return right_; + } + // optional int32 top = 6; public static final int TOP_FIELD_NUMBER = 6; - private boolean hasTop; - private int top_ = 0; - public boolean hasTop() { return hasTop; } - public int getTop() { return top_; } - + private int top_; + /** + * optional int32 top = 6; + */ + public boolean hasTop() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional int32 top = 6; + */ + public int getTop() { + return top_; + } + // optional int32 bottom = 7; public static final int BOTTOM_FIELD_NUMBER = 7; - private boolean hasBottom; - private int bottom_ = 0; - public boolean hasBottom() { return hasBottom; } - public int getBottom() { return bottom_; } - + private int bottom_; + /** + * optional int32 bottom = 7; + */ + public boolean hasBottom() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional int32 bottom = 7; + */ + public int getBottom() { + return bottom_; + } + // optional uint32 stringTableOffset = 8; public static final int STRINGTABLEOFFSET_FIELD_NUMBER = 8; - private boolean hasStringTableOffset; - private int stringTableOffset_ = 0; - public boolean hasStringTableOffset() { return hasStringTableOffset; } - public int getStringTableOffset() { return stringTableOffset_; } - + private int stringTableOffset_; + /** + * optional uint32 stringTableOffset = 8; + */ + public boolean hasStringTableOffset() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + /** + * optional uint32 stringTableOffset = 8; + */ + public int getStringTableOffset() { + return stringTableOffset_; + } + // optional uint32 stringTableLength = 9; public static final int STRINGTABLELENGTH_FIELD_NUMBER = 9; - private boolean hasStringTableLength; - private int stringTableLength_ = 0; - public boolean hasStringTableLength() { return hasStringTableLength; } - public int getStringTableLength() { return stringTableLength_; } - + private int stringTableLength_; + /** + * optional uint32 stringTableLength = 9; + */ + public boolean hasStringTableLength() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + /** + * optional uint32 stringTableLength = 9; + */ + public int getStringTableLength() { + return stringTableLength_; + } + // optional uint32 stopsTableOffset = 10; public static final int STOPSTABLEOFFSET_FIELD_NUMBER = 10; - private boolean hasStopsTableOffset; - private int stopsTableOffset_ = 0; - public boolean hasStopsTableOffset() { return hasStopsTableOffset; } - public int getStopsTableOffset() { return stopsTableOffset_; } - + private int stopsTableOffset_; + /** + * optional uint32 stopsTableOffset = 10; + */ + public boolean hasStopsTableOffset() { + return ((bitField0_ & 0x00000200) == 0x00000200); + } + /** + * optional uint32 stopsTableOffset = 10; + */ + public int getStopsTableOffset() { + return stopsTableOffset_; + } + // optional uint32 stopsTableLength = 11; public static final int STOPSTABLELENGTH_FIELD_NUMBER = 11; - private boolean hasStopsTableLength; - private int stopsTableLength_ = 0; - public boolean hasStopsTableLength() { return hasStopsTableLength; } - public int getStopsTableLength() { return stopsTableLength_; } - - private void initFields() { + private int stopsTableLength_; + /** + * optional uint32 stopsTableLength = 11; + */ + public boolean hasStopsTableLength() { + return ((bitField0_ & 0x00000400) == 0x00000400); } + /** + * optional uint32 stopsTableLength = 11; + */ + public int getStopsTableLength() { + return stopsTableLength_; + } + + // optional uint32 incompleteRoutesOffset = 12; + public static final int INCOMPLETEROUTESOFFSET_FIELD_NUMBER = 12; + private int incompleteRoutesOffset_; + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + public boolean hasIncompleteRoutesOffset() { + return ((bitField0_ & 0x00000800) == 0x00000800); + } + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + public int getIncompleteRoutesOffset() { + return incompleteRoutesOffset_; + } + + // optional uint32 incompleteRoutesLength = 13; + public static final int INCOMPLETEROUTESLENGTH_FIELD_NUMBER = 13; + private int incompleteRoutesLength_; + /** + * optional uint32 incompleteRoutesLength = 13; + */ + public boolean hasIncompleteRoutesLength() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + /** + * optional uint32 incompleteRoutesLength = 13; + */ + public int getIncompleteRoutesLength() { + return incompleteRoutesLength_; + } + + private void initFields() { + size_ = 0L; + offset_ = 0L; + name_ = ""; + left_ = 0; + right_ = 0; + top_ = 0; + bottom_ = 0; + stringTableOffset_ = 0; + stringTableLength_ = 0; + stopsTableOffset_ = 0; + stopsTableLength_ = 0; + incompleteRoutesOffset_ = 0; + incompleteRoutesLength_ = 0; + } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasSize) return false; - if (!hasOffset) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSize()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; return true; } - + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasSize()) { - output.writeInt64(1, getSize()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, size_); } - if (hasOffset()) { - output.writeInt64(2, getOffset()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, offset_); } - if (hasName()) { - output.writeString(3, getName()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getNameBytes()); } - if (hasLeft()) { - output.writeInt32(4, getLeft()); + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(4, left_); } - if (hasRight()) { - output.writeInt32(5, getRight()); + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(5, right_); } - if (hasTop()) { - output.writeInt32(6, getTop()); + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt32(6, top_); } - if (hasBottom()) { - output.writeInt32(7, getBottom()); + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeInt32(7, bottom_); } - if (hasStringTableOffset()) { - output.writeUInt32(8, getStringTableOffset()); + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeUInt32(8, stringTableOffset_); } - if (hasStringTableLength()) { - output.writeUInt32(9, getStringTableLength()); + if (((bitField0_ & 0x00000100) == 0x00000100)) { + output.writeUInt32(9, stringTableLength_); } - if (hasStopsTableOffset()) { - output.writeUInt32(10, getStopsTableOffset()); + if (((bitField0_ & 0x00000200) == 0x00000200)) { + output.writeUInt32(10, stopsTableOffset_); } - if (hasStopsTableLength()) { - output.writeUInt32(11, getStopsTableLength()); + if (((bitField0_ & 0x00000400) == 0x00000400)) { + output.writeUInt32(11, stopsTableLength_); + } + if (((bitField0_ & 0x00000800) == 0x00000800)) { + output.writeUInt32(12, incompleteRoutesOffset_); + } + if (((bitField0_ & 0x00001000) == 0x00001000)) { + output.writeUInt32(13, incompleteRoutesLength_); } } - + private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; - if (hasSize()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, getSize()); + .computeInt64Size(1, size_); } - if (hasOffset()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, getOffset()); + .computeInt64Size(2, offset_); } - if (hasName()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(3, getName()); + .computeBytesSize(3, getNameBytes()); } - if (hasLeft()) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, getLeft()); + .computeInt32Size(4, left_); } - if (hasRight()) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, getRight()); + .computeInt32Size(5, right_); } - if (hasTop()) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(6, getTop()); + .computeInt32Size(6, top_); } - if (hasBottom()) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(7, getBottom()); + .computeInt32Size(7, bottom_); } - if (hasStringTableOffset()) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(8, getStringTableOffset()); + .computeUInt32Size(8, stringTableOffset_); } - if (hasStringTableLength()) { + if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(9, getStringTableLength()); + .computeUInt32Size(9, stringTableLength_); } - if (hasStopsTableOffset()) { + if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(10, getStopsTableOffset()); + .computeUInt32Size(10, stopsTableOffset_); } - if (hasStopsTableLength()) { + if (((bitField0_ & 0x00000400) == 0x00000400)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(11, getStopsTableLength()); + .computeUInt32Size(11, stopsTableLength_); + } + if (((bitField0_ & 0x00000800) == 0x00000800)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(12, incompleteRoutesOffset_); + } + if (((bitField0_ & 0x00001000) == 0x00001000)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(13, incompleteRoutesLength_); } memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static net.osmand.binary.OsmandIndex.TransportPart parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.TransportPart parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.TransportPart parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); + return PARSER.parseFrom(data); } public static net.osmand.binary.OsmandIndex.TransportPart parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(data, extensionRegistry); } public static net.osmand.binary.OsmandIndex.TransportPart parseFrom(java.io.InputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.TransportPart parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.TransportPart parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input); } public static net.osmand.binary.OsmandIndex.TransportPart parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } + return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static net.osmand.binary.OsmandIndex.TransportPart parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); + return PARSER.parseFrom(input); } public static net.osmand.binary.OsmandIndex.TransportPart parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); + return PARSER.parseFrom(input, extensionRegistry); } - + public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(net.osmand.binary.OsmandIndex.TransportPart prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } - + + /** + * Protobuf type {@code OsmAnd.OBF.TransportPart} + */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.binary.OsmandIndex.TransportPart, Builder> { - private net.osmand.binary.OsmandIndex.TransportPart result; - + net.osmand.binary.OsmandIndex.TransportPart, Builder> + implements net.osmand.binary.OsmandIndex.TransportPartOrBuilder { // Construct using net.osmand.binary.OsmandIndex.TransportPart.newBuilder() - private Builder() {} - + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandIndex.TransportPart(); - return builder; + return new Builder(); } - - protected net.osmand.binary.OsmandIndex.TransportPart internalGetResult() { - return result; - } - + public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandIndex.TransportPart(); + super.clear(); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + left_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + right_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + top_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + stringTableOffset_ = 0; + bitField0_ = (bitField0_ & ~0x00000080); + stringTableLength_ = 0; + bitField0_ = (bitField0_ & ~0x00000100); + stopsTableOffset_ = 0; + bitField0_ = (bitField0_ & ~0x00000200); + stopsTableLength_ = 0; + bitField0_ = (bitField0_ & ~0x00000400); + incompleteRoutesOffset_ = 0; + bitField0_ = (bitField0_ & ~0x00000800); + incompleteRoutesLength_ = 0; + bitField0_ = (bitField0_ & ~0x00001000); return this; } - + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - + public net.osmand.binary.OsmandIndex.TransportPart getDefaultInstanceForType() { return net.osmand.binary.OsmandIndex.TransportPart.getDefaultInstance(); } - - public boolean isInitialized() { - return result.isInitialized(); - } + public net.osmand.binary.OsmandIndex.TransportPart build() { - if (result != null && !isInitialized()) { + net.osmand.binary.OsmandIndex.TransportPart result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - - private net.osmand.binary.OsmandIndex.TransportPart buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - + public net.osmand.binary.OsmandIndex.TransportPart buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + net.osmand.binary.OsmandIndex.TransportPart result = new net.osmand.binary.OsmandIndex.TransportPart(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - net.osmand.binary.OsmandIndex.TransportPart returnMe = result; - result = null; - return returnMe; + result.size_ = size_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.name_ = name_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.left_ = left_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.right_ = right_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.top_ = top_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.bottom_ = bottom_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000080; + } + result.stringTableOffset_ = stringTableOffset_; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000100; + } + result.stringTableLength_ = stringTableLength_; + if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + to_bitField0_ |= 0x00000200; + } + result.stopsTableOffset_ = stopsTableOffset_; + if (((from_bitField0_ & 0x00000400) == 0x00000400)) { + to_bitField0_ |= 0x00000400; + } + result.stopsTableLength_ = stopsTableLength_; + if (((from_bitField0_ & 0x00000800) == 0x00000800)) { + to_bitField0_ |= 0x00000800; + } + result.incompleteRoutesOffset_ = incompleteRoutesOffset_; + if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + to_bitField0_ |= 0x00001000; + } + result.incompleteRoutesLength_ = incompleteRoutesLength_; + result.bitField0_ = to_bitField0_; + return result; } - + public Builder mergeFrom(net.osmand.binary.OsmandIndex.TransportPart other) { if (other == net.osmand.binary.OsmandIndex.TransportPart.getDefaultInstance()) return this; if (other.hasSize()) { @@ -4874,7 +9561,9 @@ public final class OsmandIndex { setOffset(other.getOffset()); } if (other.hasName()) { - setName(other.getName()); + bitField0_ |= 0x00000004; + name_ = other.name_; + } if (other.hasLeft()) { setLeft(other.getLeft()); @@ -4900,291 +9589,530 @@ public final class OsmandIndex { if (other.hasStopsTableLength()) { setStopsTableLength(other.getStopsTableLength()); } + if (other.hasIncompleteRoutesOffset()) { + setIncompleteRoutesOffset(other.getIncompleteRoutesOffset()); + } + if (other.hasIncompleteRoutesLength()) { + setIncompleteRoutesLength(other.getIncompleteRoutesLength()); + } return this; } - + + public final boolean isInitialized() { + if (!hasSize()) { + + return false; + } + if (!hasOffset()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 8: { - setSize(input.readInt64()); - break; - } - case 16: { - setOffset(input.readInt64()); - break; - } - case 26: { - setName(input.readString()); - break; - } - case 32: { - setLeft(input.readInt32()); - break; - } - case 40: { - setRight(input.readInt32()); - break; - } - case 48: { - setTop(input.readInt32()); - break; - } - case 56: { - setBottom(input.readInt32()); - break; - } - case 64: { - setStringTableOffset(input.readUInt32()); - break; - } - case 72: { - setStringTableLength(input.readUInt32()); - break; - } - case 80: { - setStopsTableOffset(input.readUInt32()); - break; - } - case 88: { - setStopsTableLength(input.readUInt32()); - break; - } + net.osmand.binary.OsmandIndex.TransportPart parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.osmand.binary.OsmandIndex.TransportPart) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } } + return this; } - - + private int bitField0_; + // required int64 size = 1; + private long size_ ; + /** + * required int64 size = 1; + */ public boolean hasSize() { - return result.hasSize(); + return ((bitField0_ & 0x00000001) == 0x00000001); } + /** + * required int64 size = 1; + */ public long getSize() { - return result.getSize(); + return size_; } + /** + * required int64 size = 1; + */ public Builder setSize(long value) { - result.hasSize = true; - result.size_ = value; + bitField0_ |= 0x00000001; + size_ = value; + return this; } + /** + * required int64 size = 1; + */ public Builder clearSize() { - result.hasSize = false; - result.size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + size_ = 0L; + return this; } - + // required int64 offset = 2; + private long offset_ ; + /** + * required int64 offset = 2; + */ public boolean hasOffset() { - return result.hasOffset(); + return ((bitField0_ & 0x00000002) == 0x00000002); } + /** + * required int64 offset = 2; + */ public long getOffset() { - return result.getOffset(); + return offset_; } + /** + * required int64 offset = 2; + */ public Builder setOffset(long value) { - result.hasOffset = true; - result.offset_ = value; + bitField0_ |= 0x00000002; + offset_ = value; + return this; } + /** + * required int64 offset = 2; + */ public Builder clearOffset() { - result.hasOffset = false; - result.offset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + offset_ = 0L; + return this; } - + // optional string name = 3; + private java.lang.Object name_ = ""; + /** + * optional string name = 3; + */ public boolean hasName() { - return result.hasName(); + return ((bitField0_ & 0x00000004) == 0x00000004); } + /** + * optional string name = 3; + */ public java.lang.String getName() { - return result.getName(); + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - public Builder setName(java.lang.String value) { + /** + * optional string name = 3; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string name = 3; + */ + public Builder setName( + java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.hasName = true; - result.name_ = value; + bitField0_ |= 0x00000004; + name_ = value; + return this; } + /** + * optional string name = 3; + */ public Builder clearName() { - result.hasName = false; - result.name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + name_ = getDefaultInstance().getName(); + return this; } - + /** + * optional string name = 3; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + name_ = value; + + return this; + } + // optional int32 left = 4; + private int left_ ; + /** + * optional int32 left = 4; + */ public boolean hasLeft() { - return result.hasLeft(); + return ((bitField0_ & 0x00000008) == 0x00000008); } + /** + * optional int32 left = 4; + */ public int getLeft() { - return result.getLeft(); + return left_; } + /** + * optional int32 left = 4; + */ public Builder setLeft(int value) { - result.hasLeft = true; - result.left_ = value; + bitField0_ |= 0x00000008; + left_ = value; + return this; } + /** + * optional int32 left = 4; + */ public Builder clearLeft() { - result.hasLeft = false; - result.left_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + left_ = 0; + return this; } - + // optional int32 right = 5; + private int right_ ; + /** + * optional int32 right = 5; + */ public boolean hasRight() { - return result.hasRight(); + return ((bitField0_ & 0x00000010) == 0x00000010); } + /** + * optional int32 right = 5; + */ public int getRight() { - return result.getRight(); + return right_; } + /** + * optional int32 right = 5; + */ public Builder setRight(int value) { - result.hasRight = true; - result.right_ = value; + bitField0_ |= 0x00000010; + right_ = value; + return this; } + /** + * optional int32 right = 5; + */ public Builder clearRight() { - result.hasRight = false; - result.right_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + right_ = 0; + return this; } - + // optional int32 top = 6; + private int top_ ; + /** + * optional int32 top = 6; + */ public boolean hasTop() { - return result.hasTop(); + return ((bitField0_ & 0x00000020) == 0x00000020); } + /** + * optional int32 top = 6; + */ public int getTop() { - return result.getTop(); + return top_; } + /** + * optional int32 top = 6; + */ public Builder setTop(int value) { - result.hasTop = true; - result.top_ = value; + bitField0_ |= 0x00000020; + top_ = value; + return this; } + /** + * optional int32 top = 6; + */ public Builder clearTop() { - result.hasTop = false; - result.top_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + top_ = 0; + return this; } - + // optional int32 bottom = 7; + private int bottom_ ; + /** + * optional int32 bottom = 7; + */ public boolean hasBottom() { - return result.hasBottom(); + return ((bitField0_ & 0x00000040) == 0x00000040); } + /** + * optional int32 bottom = 7; + */ public int getBottom() { - return result.getBottom(); + return bottom_; } + /** + * optional int32 bottom = 7; + */ public Builder setBottom(int value) { - result.hasBottom = true; - result.bottom_ = value; + bitField0_ |= 0x00000040; + bottom_ = value; + return this; } + /** + * optional int32 bottom = 7; + */ public Builder clearBottom() { - result.hasBottom = false; - result.bottom_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + bottom_ = 0; + return this; } - + // optional uint32 stringTableOffset = 8; + private int stringTableOffset_ ; + /** + * optional uint32 stringTableOffset = 8; + */ public boolean hasStringTableOffset() { - return result.hasStringTableOffset(); + return ((bitField0_ & 0x00000080) == 0x00000080); } + /** + * optional uint32 stringTableOffset = 8; + */ public int getStringTableOffset() { - return result.getStringTableOffset(); + return stringTableOffset_; } + /** + * optional uint32 stringTableOffset = 8; + */ public Builder setStringTableOffset(int value) { - result.hasStringTableOffset = true; - result.stringTableOffset_ = value; + bitField0_ |= 0x00000080; + stringTableOffset_ = value; + return this; } + /** + * optional uint32 stringTableOffset = 8; + */ public Builder clearStringTableOffset() { - result.hasStringTableOffset = false; - result.stringTableOffset_ = 0; + bitField0_ = (bitField0_ & ~0x00000080); + stringTableOffset_ = 0; + return this; } - + // optional uint32 stringTableLength = 9; + private int stringTableLength_ ; + /** + * optional uint32 stringTableLength = 9; + */ public boolean hasStringTableLength() { - return result.hasStringTableLength(); + return ((bitField0_ & 0x00000100) == 0x00000100); } + /** + * optional uint32 stringTableLength = 9; + */ public int getStringTableLength() { - return result.getStringTableLength(); + return stringTableLength_; } + /** + * optional uint32 stringTableLength = 9; + */ public Builder setStringTableLength(int value) { - result.hasStringTableLength = true; - result.stringTableLength_ = value; + bitField0_ |= 0x00000100; + stringTableLength_ = value; + return this; } + /** + * optional uint32 stringTableLength = 9; + */ public Builder clearStringTableLength() { - result.hasStringTableLength = false; - result.stringTableLength_ = 0; + bitField0_ = (bitField0_ & ~0x00000100); + stringTableLength_ = 0; + return this; } - + // optional uint32 stopsTableOffset = 10; + private int stopsTableOffset_ ; + /** + * optional uint32 stopsTableOffset = 10; + */ public boolean hasStopsTableOffset() { - return result.hasStopsTableOffset(); + return ((bitField0_ & 0x00000200) == 0x00000200); } + /** + * optional uint32 stopsTableOffset = 10; + */ public int getStopsTableOffset() { - return result.getStopsTableOffset(); + return stopsTableOffset_; } + /** + * optional uint32 stopsTableOffset = 10; + */ public Builder setStopsTableOffset(int value) { - result.hasStopsTableOffset = true; - result.stopsTableOffset_ = value; + bitField0_ |= 0x00000200; + stopsTableOffset_ = value; + return this; } + /** + * optional uint32 stopsTableOffset = 10; + */ public Builder clearStopsTableOffset() { - result.hasStopsTableOffset = false; - result.stopsTableOffset_ = 0; + bitField0_ = (bitField0_ & ~0x00000200); + stopsTableOffset_ = 0; + return this; } - + // optional uint32 stopsTableLength = 11; + private int stopsTableLength_ ; + /** + * optional uint32 stopsTableLength = 11; + */ public boolean hasStopsTableLength() { - return result.hasStopsTableLength(); + return ((bitField0_ & 0x00000400) == 0x00000400); } + /** + * optional uint32 stopsTableLength = 11; + */ public int getStopsTableLength() { - return result.getStopsTableLength(); + return stopsTableLength_; } + /** + * optional uint32 stopsTableLength = 11; + */ public Builder setStopsTableLength(int value) { - result.hasStopsTableLength = true; - result.stopsTableLength_ = value; + bitField0_ |= 0x00000400; + stopsTableLength_ = value; + return this; } + /** + * optional uint32 stopsTableLength = 11; + */ public Builder clearStopsTableLength() { - result.hasStopsTableLength = false; - result.stopsTableLength_ = 0; + bitField0_ = (bitField0_ & ~0x00000400); + stopsTableLength_ = 0; + return this; } - - // @@protoc_insertion_point(builder_scope:TransportPart) + + // optional uint32 incompleteRoutesOffset = 12; + private int incompleteRoutesOffset_ ; + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + public boolean hasIncompleteRoutesOffset() { + return ((bitField0_ & 0x00000800) == 0x00000800); + } + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + public int getIncompleteRoutesOffset() { + return incompleteRoutesOffset_; + } + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + public Builder setIncompleteRoutesOffset(int value) { + bitField0_ |= 0x00000800; + incompleteRoutesOffset_ = value; + + return this; + } + /** + * optional uint32 incompleteRoutesOffset = 12; + */ + public Builder clearIncompleteRoutesOffset() { + bitField0_ = (bitField0_ & ~0x00000800); + incompleteRoutesOffset_ = 0; + + return this; + } + + // optional uint32 incompleteRoutesLength = 13; + private int incompleteRoutesLength_ ; + /** + * optional uint32 incompleteRoutesLength = 13; + */ + public boolean hasIncompleteRoutesLength() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + /** + * optional uint32 incompleteRoutesLength = 13; + */ + public int getIncompleteRoutesLength() { + return incompleteRoutesLength_; + } + /** + * optional uint32 incompleteRoutesLength = 13; + */ + public Builder setIncompleteRoutesLength(int value) { + bitField0_ |= 0x00001000; + incompleteRoutesLength_ = value; + + return this; + } + /** + * optional uint32 incompleteRoutesLength = 13; + */ + public Builder clearIncompleteRoutesLength() { + bitField0_ = (bitField0_ & ~0x00001000); + incompleteRoutesLength_ = 0; + + return this; + } + + // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.TransportPart) } - + static { defaultInstance = new TransportPart(true); - net.osmand.binary.OsmandIndex.internalForceInit(); defaultInstance.initFields(); } - - // @@protoc_insertion_point(class_scope:TransportPart) + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.TransportPart) } - - + + static { } - - public static void internalForceInit() {} - + // @@protoc_insertion_point(outer_class_scope) } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 9ca8d2a609..06821b20bd 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -726,7 +726,6 @@ public class TransportRoutePlanner { private final int walkRadiusIn31; private final int walkChangeRadiusIn31; - private final int missingStopRadiusIn31; @@ -734,7 +733,6 @@ public class TransportRoutePlanner { this.cfg = cfg; walkRadiusIn31 = (int) (cfg.walkRadius / MapUtils.getTileDistanceWidth(31)); walkChangeRadiusIn31 = (int) (cfg.walkChangeRadius / MapUtils.getTileDistanceWidth(31)); - missingStopRadiusIn31 = (int) (MISSING_STOP_SEARCH_RADIUS / MapUtils.getTileDistanceWidth(31)); quadTree = new TLongObjectHashMap>(); this.library = library; for (BinaryMapIndexReader r : readers) { @@ -755,7 +753,6 @@ public class TransportRoutePlanner { private List loadNativeTransportStops(int sx, int sy, boolean change, List res) throws IOException { long nanoTime = System.nanoTime(); int d = change ? walkChangeRadiusIn31 : walkRadiusIn31; - int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES); @@ -770,7 +767,6 @@ public class TransportRoutePlanner { } for(TransportRouteSegment r : list) { TransportStop st = r.getStop(r.segStart); - if (Math.abs(st.x31 - sx) > walkRadiusIn31 || Math.abs(st.y31 - sy) > walkRadiusIn31) { wrongLoadedWays++; } else { From 0d96394a0e19c13d589f988987944523814041c8 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 20:15:16 +0200 Subject: [PATCH 18/24] Udpate planner --- .../java/net/osmand/router/TransportRoutePlanner.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 06821b20bd..599c664203 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -709,6 +709,9 @@ public class TransportRoutePlanner { public Map> missingStopsCache = new HashMap>(); public TLongObjectHashMap> quadTree; + // Here we don't limit files by bbox, so it could be an issue while searching for multiple unused files + // Incomplete routes usually don't need more files than around Max-BBOX of start/end, + // so here an improvement could be introduced public final Map> routeMap = new LinkedHashMap>(); @@ -834,7 +837,7 @@ public class TransportRoutePlanner { } } } - //there should go stops with complete routes: + // There should go stops with complete routes: loadTransportSegments(loadedTransportStops.valueCollection(), lst); readTime += System.nanoTime() - nanoTime; @@ -1101,7 +1104,7 @@ public class TransportRoutePlanner { private LinkedList> parseRoutePartsToSegments(List routeParts) { LinkedList> segs = new LinkedList>(); // here we assume that missing stops come in pairs - // TODO check generation that are doubles + // we don't add segments with 1 stop cause they are irrelevant further for (TransportRoute part : routeParts) { List newSeg = new ArrayList(); for (TransportStop s : part.getForwardStops()) { @@ -1122,8 +1125,8 @@ public class TransportRoutePlanner { private List findIncompleteRouteParts(TransportRoute baseRoute) throws IOException { List allRoutes = null; - // TODO completely irrelevant always reiteration over all maps (especially not in bbox of the route probabl) for (BinaryMapIndexReader bmir : routeMap.keySet()) { + // here we could limit routeMap indexes by only certain bbox around start / end (check comment on field) IncompleteTransportRoute ptr = bmir.getIncompleteTransportRoutes().get(baseRoute.getId()); if (ptr != null) { TIntArrayList lst = new TIntArrayList(); From a01a4ad63e24e96f37d125b22803513989cf9832 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 21:28:00 +0200 Subject: [PATCH 19/24] Fix broken geometry --- .../java/net/osmand/data/DataTileManager.java | 6 +-- .../osmand/router/TransportRoutePlanner.java | 49 +++++++++++-------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/DataTileManager.java b/OsmAnd-java/src/main/java/net/osmand/data/DataTileManager.java index ca76753bfa..aeed49c9dd 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/DataTileManager.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/DataTileManager.java @@ -44,10 +44,10 @@ public class DataTileManager { return x; } - private void putObjects(int tx, int ty, List r){ - if(objects.containsKey(evTile(tx, ty))){ + private void putObjects(int tx, int ty, List r) { + if (objects.containsKey(evTile(tx, ty))) { r.addAll(objects.get(evTile(tx, ty))); - } + } } @SuppressWarnings({ "rawtypes", "unchecked" }) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 599c664203..84e257323b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -36,6 +36,7 @@ public class TransportRoutePlanner { private static final boolean MEASURE_TIME = false; private static final int MISSING_STOP_SEARCH_RADIUS = 15000; + private static final int MIN_DIST_STOP_TO_GEOMETRY = 150; public static final long GEOMETRY_WAY_ID = -1; public static final long STOPS_WAY_ID = -2; @@ -381,8 +382,7 @@ public class TransportRoutePlanner { } public List getGeometry() { - List list = new ArrayList<>(); - route.mergeForwardWays(); //TODO merge ways of all Route parts + route.mergeForwardWays(); if (DISPLAY_FULL_SEGMENT_ROUTE) { System.out.println("TOTAL SEGMENTS: " + route.getForwardWays().size()); if (route.getForwardWays().size() > DISPLAY_SEGMENT_IND) { @@ -390,30 +390,40 @@ public class TransportRoutePlanner { } return route.getForwardWays(); } - List fw = route.getForwardWays(); - double minStart = 150; - double minEnd = 150; - LatLon str = getStart().getLocation(); - LatLon en = getEnd().getLocation(); - int endInd = -1; - List res = new ArrayList<>(); - for (int i = 0; i < fw.size() ; i++) { - List nodes = fw.get(i).getNodes(); + List ways = route.getForwardWays(); + + final LatLon startLoc = getStart().getLocation(); + final LatLon endLoc = getEnd().getLocation(); + + List finalr = Collections.emptyList(); + int fendInd = -1; + double fminStartDist = MIN_DIST_STOP_TO_GEOMETRY; + for (int i = 0; i < ways.size() ; i++) { + List nodes = ways.get(i).getNodes(); + List res = new ArrayList<>(); + double minStartDist = MIN_DIST_STOP_TO_GEOMETRY; + double minDistEnd = MIN_DIST_STOP_TO_GEOMETRY; + int endInd = -1; for (int j = 0; j < nodes.size(); j++) { Node n = nodes.get(j); - if (MapUtils.getDistance(str, n.getLatitude(), n.getLongitude()) < minStart) { - minStart = MapUtils.getDistance(str, n.getLatitude(), n.getLongitude()); + if (MapUtils.getDistance(startLoc, n.getLatitude(), n.getLongitude()) < minStartDist) { + minStartDist = MapUtils.getDistance(startLoc, n.getLatitude(), n.getLongitude()); res.clear(); } res.add(n); - if (MapUtils.getDistance(en, n.getLatitude(), n.getLongitude()) < minEnd) { + if (MapUtils.getDistance(endLoc, n.getLatitude(), n.getLongitude()) < minDistEnd) { endInd = res.size(); - minEnd = MapUtils.getDistance(en, n.getLatitude(), n.getLongitude()); + minDistEnd = MapUtils.getDistance(endLoc, n.getLatitude(), n.getLongitude()); } } + if(endInd != -1 && res.size() > 0 && minStartDist < fminStartDist) { + finalr = res; + fendInd = endInd; + fminStartDist = minStartDist; + } } Way way; - if (res.isEmpty() || endInd == -1) { + if (finalr.isEmpty() || fendInd == -1) { way = new Way(STOPS_WAY_ID); for (int i = start; i <= end; i++) { LatLon l = getStop(i).getLocation(); @@ -422,12 +432,11 @@ public class TransportRoutePlanner { } } else { way = new Way(GEOMETRY_WAY_ID); - for(int k = 0; k < res.size() && k < endInd; k++) { - way.addNode(res.get(k)); + for(int k = 0; k < finalr.size() && k < fendInd; k++) { + way.addNode(finalr.get(k)); } } - list.add(way); - return list; + return Collections.singletonList(way); } public double getTravelDist() { From f529dfad5d0989c7695ea18c0949832b83e7002b Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 22:24:08 +0200 Subject: [PATCH 20/24] Optimize drawing geometry --- .../osmand/router/TransportRoutePlanner.java | 80 ++++++++++++------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 84e257323b..c401f58319 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -380,6 +380,12 @@ public class TransportRoutePlanner { } return nodes; } + + private static class SearchNodeInd { + int ind = -1; + Way way = null; + double dist = MIN_DIST_STOP_TO_GEOMETRY; + } public List getGeometry() { route.mergeForwardWays(); @@ -394,47 +400,63 @@ public class TransportRoutePlanner { final LatLon startLoc = getStart().getLocation(); final LatLon endLoc = getEnd().getLocation(); - - List finalr = Collections.emptyList(); - int fendInd = -1; - double fminStartDist = MIN_DIST_STOP_TO_GEOMETRY; + SearchNodeInd startInd = new SearchNodeInd(); + SearchNodeInd endInd = new SearchNodeInd(); for (int i = 0; i < ways.size() ; i++) { List nodes = ways.get(i).getNodes(); - List res = new ArrayList<>(); - double minStartDist = MIN_DIST_STOP_TO_GEOMETRY; - double minDistEnd = MIN_DIST_STOP_TO_GEOMETRY; - int endInd = -1; for (int j = 0; j < nodes.size(); j++) { Node n = nodes.get(j); - if (MapUtils.getDistance(startLoc, n.getLatitude(), n.getLongitude()) < minStartDist) { - minStartDist = MapUtils.getDistance(startLoc, n.getLatitude(), n.getLongitude()); - res.clear(); + if (MapUtils.getDistance(startLoc, n.getLatitude(), n.getLongitude()) < startInd.dist) { + startInd.dist = MapUtils.getDistance(startLoc, n.getLatitude(), n.getLongitude()); + startInd.ind = j; + startInd.way = ways.get(i); } - res.add(n); - if (MapUtils.getDistance(endLoc, n.getLatitude(), n.getLongitude()) < minDistEnd) { - endInd = res.size(); - minDistEnd = MapUtils.getDistance(endLoc, n.getLatitude(), n.getLongitude()); + if (MapUtils.getDistance(endLoc, n.getLatitude(), n.getLongitude()) < endInd.dist) { + endInd.dist = MapUtils.getDistance(endLoc, n.getLatitude(), n.getLongitude()); + endInd.ind = j; + endInd.way = ways.get(i); } } - if(endInd != -1 && res.size() > 0 && minStartDist < fminStartDist) { - finalr = res; - fendInd = endInd; - fminStartDist = minStartDist; + } + boolean validOneWay = startInd.way != null && startInd.way == endInd.way && startInd.ind <= endInd.ind; + if (validOneWay) { + Way way = new Way(GEOMETRY_WAY_ID); + for (int k = startInd.ind; k <= endInd.ind; k++) { + way.addNode(startInd.way.getNodes().get(k)); + } + return Collections.singletonList(way); + } + boolean validContinuation = startInd.way != null && endInd.way != null && + startInd.way != endInd.way; + if (validContinuation) { + Node ln = startInd.way.getLastNode(); + Node fn = endInd.way.getFirstNode(); + // HERE we need to check other ways for continuation + if (ln != null && fn != null && MapUtils.getDistance(ln.getLatLon(), fn.getLatLon()) < MISSING_STOP_SEARCH_RADIUS) { + validContinuation = true; + } else { + validContinuation = false; } } - Way way; - if (finalr.isEmpty() || fendInd == -1) { - way = new Way(STOPS_WAY_ID); - for (int i = start; i <= end; i++) { - LatLon l = getStop(i).getLocation(); - Node n = new Node(l.getLatitude(), l.getLongitude(), -1); - way.addNode(n); + if (validContinuation) { + List two = new ArrayList(); + Way way = new Way(GEOMETRY_WAY_ID); + for (int k = startInd.ind; k < startInd.way.getNodes().size(); k++) { + way.addNode(startInd.way.getNodes().get(k)); } - } else { + two.add(way); way = new Way(GEOMETRY_WAY_ID); - for(int k = 0; k < finalr.size() && k < fendInd; k++) { - way.addNode(finalr.get(k)); + for (int k = 0; k <= endInd.ind; k++) { + way.addNode(endInd.way.getNodes().get(k)); } + two.add(way); + return two; + } + Way way = new Way(STOPS_WAY_ID); + for (int i = start; i <= end; i++) { + LatLon l = getStop(i).getLocation(); + Node n = new Node(l.getLatitude(), l.getLongitude(), -1); + way.addNode(n); } return Collections.singletonList(way); } From ee1f8c683b544861d646053e5e75afd0d140a7ba Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 22:35:30 +0200 Subject: [PATCH 21/24] Optimize drawing geometry --- .../src/main/java/net/osmand/data/TransportRoute.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index 4fd2b7d03a..f35f7aacc2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -92,7 +92,8 @@ public class TransportRoute extends MapObject { resortWaysToStopsOrder(forwardWays, forwardStops); } - public static void mergeRouteWays(List forwardWays) { + // intrusive operation cause it changes ways itself! + private static void mergeRouteWays(List forwardWays) { boolean changed = true; // combine as many ways as possible while (changed && forwardWays != null) { @@ -159,7 +160,7 @@ public class TransportRoute extends MapObject { } } - public static Map resortWaysToStopsOrder(List forwardWays, List forwardStops) { + private static Map resortWaysToStopsOrder(List forwardWays, List forwardStops) { final Map orderWays = new HashMap(); if (forwardWays != null && forwardStops.size() > 0) { // resort ways to stops order From 30fe9c86983c46593d4610c9a90623e0cfecec7a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 22:41:21 +0200 Subject: [PATCH 22/24] Add more info --- .../main/java/net/osmand/router/TransportRoutePlanner.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index c401f58319..6448cd67a1 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -609,8 +609,8 @@ public class TransportRoutePlanner { if(aTime != -1) { arriveTime = String.format("and arrive at %s", formatTransporTime(aTime)); } - bld.append(String.format(" %d. %s: walk %.1f m to '%s' and travel %s to '%s' by %s %d stops %s\n", - i + 1, s.route.getRef(), s.walkDist, s.getStart().getName(), + bld.append(String.format(" %d. %s [%d]: walk %.1f m to '%s' and travel %s to '%s' by %s %d stops %s\n", + i + 1, s.route.getRef(), s.route.getId() / 2, s.walkDist, s.getStart().getName(), time, s.getEnd().getName(),s.route.getName(), (s.end - s.start), arriveTime)); } bld.append(String.format(" F. Walk %.1f m to reach your destination", finishWalkDist)); From 7589610a278f86fe3eaeca86f02dcba21e0ed074 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 16 May 2020 22:55:40 +0200 Subject: [PATCH 23/24] Fix routing --- .../src/main/java/net/osmand/router/TransportRoutePlanner.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 6448cd67a1..457fbe856b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -999,6 +999,7 @@ public class TransportRoutePlanner { List> sortedSegments = new ArrayList>(); if(firstSegment != null) { sortedSegments.add(firstSegment); + mergedSegments.remove(firstSegment); while(!mergedSegments.isEmpty()) { List last = sortedSegments.get(sortedSegments.size() - 1); List add = findAndDeleteMinDistance(last.get(last.size() - 1).getLocation(), mergedSegments, true); @@ -1007,6 +1008,7 @@ public class TransportRoutePlanner { } else if(lastSegment != null) { sortedSegments.add(lastSegment); + mergedSegments.remove(lastSegment); while(!mergedSegments.isEmpty()) { List first = sortedSegments.get(0); List add = findAndDeleteMinDistance(first.get(0).getLocation(), mergedSegments, false); @@ -1059,6 +1061,7 @@ public class TransportRoutePlanner { while (it.hasNext()) { List segmentToMerge = it.next(); merged = tryToMerge(firstSegment, segmentToMerge); + if (merged) { it.remove(); break; From 684e2d3d366a48e9ae33eca87a68aae29a0bc6c9 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 17 May 2020 13:21:59 +0200 Subject: [PATCH 24/24] Fix routing --- .../java/net/osmand/router/TransportRoutePlanner.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 457fbe856b..8726a5a33f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -840,14 +840,8 @@ public class TransportRoutePlanner { long stopId = stop.getId(); TransportStop multifileStop = loadedTransportStops.get(stopId); int[] rrs = stop.getReferencesToRoutes(); - // TODO what is this? - if (multifileStop == stop) { - // clear up so it won't be used as it is multi file stop - stop.setReferencesToRoutes(null); - } else { - // add other routes - stop.setReferencesToRoutes(null); - } + // clear up so it won't be used as it is multi file stop + stop.setReferencesToRoutes(null); if (rrs != null && !multifileStop.isDeleted()) { for (int rr : rrs) { TransportRoute route = localFileRoutes.get(rr);