Important changes for transport stop generation

This commit is contained in:
Victor Shcherb 2019-07-29 15:36:38 +02:00
parent 3904d82342
commit ac7cfffdd4
2 changed files with 13 additions and 2 deletions

View file

@ -19,10 +19,18 @@ public class TransportStop extends MapObject {
public int x31;
public int y31;
private List<TransportStopExit> exits;
private List<TransportRoute> routes = null;
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() {
@ -38,10 +46,12 @@ public class TransportStop extends MapObject {
}
public void setRoutesIds(long[] routesIds) {
// CHECK route ids are sorted (used later)
this.routesIds = routesIds;
}
public boolean hasRoute(long routeId) {
// make assumption that ids are sorted
return routesIds != null && Arrays.binarySearch(routesIds, routeId) >= 0;
}
@ -62,6 +72,7 @@ public class TransportStop extends MapObject {
}
public void addRouteId(long routeId) {
// make assumption that ids are sorted
routesIds = Algorithms.addToArrayL(routesIds, routeId, true);
}
@ -69,7 +80,6 @@ public class TransportStop extends MapObject {
deletedRoutesIds = Algorithms.addToArrayL(deletedRoutesIds, routeId, true);
}
public boolean isRouteDeleted(long routeId) {
return deletedRoutesIds != null && Arrays.binarySearch(deletedRoutesIds, routeId) >= 0;
}

View file

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