Skip to content

Commit

Permalink
Include stop places without parents
Browse files Browse the repository at this point in the history
  • Loading branch information
Gard Mellemstrand committed Apr 27, 2021
1 parent 4e17541 commit 2ec51b3
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,19 @@ else if("all".equals(multiModalMode)) {
});
return result;
}
// Default "parent" - Multi modal parent stop places without their mono modal children
// Default "parent" - Multi modal parent stop places without their mono modal children, but add
// mono modal stop places if they have no parent stop place
else if("parent".equals(multiModalMode)){
return stations
.map(it -> routingService.getMultiModalStationForStations().get(it))
.filter(Objects::nonNull)
.distinct()
.map(MonoOrMultiModalStation::new)
.collect(Collectors.toUnmodifiableList());
Set<MonoOrMultiModalStation> result = new HashSet<>();
stations.forEach(it -> {
MultiModalStation p = routingService.getMultiModalStationForStations().get(it);
if(p != null) {
result.add(new MonoOrMultiModalStation(p));
} else {
result.add(new MonoOrMultiModalStation(it, null));
}
});
return result;
}
else {
throw new IllegalArgumentException("Unexpected multiModalMode: " + multiModalMode);
Expand Down

0 comments on commit 2ec51b3

Please sign in to comment.