Skip to content

Commit

Permalink
REFACTOR: NAV-16 - Minor cleanup and tuning of generator parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
clukas1 committed May 26, 2024
1 parent ded19f1 commit d5bcb17
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/ch/naviqore/api/controller/DummyData.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ public static List<EarliestArrival> getIsolines(String fromStopId, LocalDateTime
HashMap<Stop, Leg> earliestArrivals = new HashMap<>();

// find nearest stop and walk there by foot
List<DistanceToStop> closestStops = getNearestStops(from.getCoordinates().getLatitude(),
List<DistanceToStop> closestStops = getNearestStops(stops, from.getCoordinates().getLatitude(),
from.getCoordinates().getLongitude(), Integer.MAX_VALUE, 10);
Stop nearestStop = closestStops.get(0).getStop();
Stop nearestStop = closestStops.getFirst().getStop();
spawnStops.add(nearestStop);
stops.remove(nearestStop);
earliestArrivals.put(nearestStop, buildFootpathLeg(from, nearestStop, departureTime));
Expand All @@ -388,8 +388,11 @@ public static List<EarliestArrival> getIsolines(String fromStopId, LocalDateTime
} else {
spawnStop = spawnStops.removeFirst();
}
int maxConnections = stops.size() / 3;
int numConnections = random.nextInt(maxConnections + 2);
int maxConnections = stops.size() / 4;
if (maxConnections < 2) {
maxConnections = 2;
}
int numConnections = random.nextInt(maxConnections);

List<DistanceToStop> nearestStops = getNearestStops(stops, spawnStop.getCoordinates().getLatitude(),
spawnStop.getCoordinates().getLongitude(), Integer.MAX_VALUE, 5 + numConnections);
Expand Down

0 comments on commit d5bcb17

Please sign in to comment.