Important changes for transport stop generation

Conflicts:
	OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java
This commit is contained in:
Victor Shcherb 2019-07-29 15:36:38 +02:00
parent b03c9cd73a
commit 7854ee01dd
2 changed files with 17 additions and 5 deletions

View file

@ -20,10 +20,18 @@ public class TransportStop extends MapObject {
public int x31; public int x31;
public int y31; public int y31;
private List<TransportStopExit> exits; private List<TransportStopExit> exits;
private List<TransportRoute> routes = null;
private TransportStopAggregated transportStopAggregated; private TransportStopAggregated transportStopAggregated;
public TransportStop() { public TransportStop() {}
public List<TransportRoute> getRoutes() {
return routes;
}
public void setRoutes(List<TransportRoute> routes) {
this.routes = routes;
} }
public int[] getReferencesToRoutes() { public int[] getReferencesToRoutes() {
@ -39,14 +47,12 @@ public class TransportStop extends MapObject {
} }
public void setRoutesIds(long[] routesIds) { public void setRoutesIds(long[] routesIds) {
// CHECK route ids are sorted (used later)
this.routesIds = routesIds; this.routesIds = routesIds;
} }
public void addRouteId(long routeId) {
routesIds = Algorithms.addToArrayL(routesIds, routeId, true);
}
public boolean hasRoute(long routeId) { public boolean hasRoute(long routeId) {
// make assumption that ids are sorted
return routesIds != null && Arrays.binarySearch(routesIds, routeId) >= 0; return routesIds != null && Arrays.binarySearch(routesIds, routeId) >= 0;
} }
@ -66,6 +72,11 @@ public class TransportStop extends MapObject {
this.deletedRoutesIds = deletedRoutesIds; this.deletedRoutesIds = deletedRoutesIds;
} }
public void addRouteId(long routeId) {
// make assumption that ids are sorted
routesIds = Algorithms.addToArrayL(routesIds, routeId, true);
}
public void addDeletedRouteId(long routeId) { public void addDeletedRouteId(long routeId) {
deletedRoutesIds = Algorithms.addToArrayL(deletedRoutesIds, routeId, true); deletedRoutesIds = Algorithms.addToArrayL(deletedRoutesIds, routeId, true);
} }

View file

@ -794,6 +794,7 @@ public class Algorithms {
result = new long[array.length + 1]; result = new long[array.length + 1];
System.arraycopy(array, 0, result, 0, array.length); System.arraycopy(array, 0, result, 0, array.length);
result[result.length - 1] = value; result[result.length - 1] = value;
Arrays.sort(result);
} }
return result; return result;
} }