Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.time.temporal.ChronoUnit;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
Expand Down Expand Up @@ -62,7 +63,8 @@ public LocationsAwareSolverModel<?> enrich(LocationsAwareSolverModel<?> solverMo
}

private LocationsAwareSolverModel<?> enrichSingleMatrix(LocationsAwareSolverModel<?> solverModel) {
List<Location> locations = solverModel.getLocations(); // Get all the locations from the model only once.
// Get all the locations from the model only once.
List<Location> locations = Objects.requireNonNull(solverModel.getLocations(), "List of locations cannot be null.");
TravelTimeAndDistanceWithMetadata travelTimeAndDistance;
try {
travelTimeAndDistance =
Expand All @@ -85,7 +87,7 @@ private LocationsAwareSolverModel<?> enrichSingleMatrix(LocationsAwareSolverMode
}

private LocationsAwareSolverModel<?> enrichAllTimeframes(LocationsAwareSolverModel<?> solverModel) {
List<Location> locations = solverModel.getLocations();
List<Location> locations = Objects.requireNonNull(solverModel.getLocations(), "List of locations cannot be null.");
TravelTimesByTimeframeWithMetadata result;
try {
result = mapService.getTravelTimeAndDistanceByTimeframe(locations, optionsSupplier.getOptions());
Comment thread
rsynek marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ public interface LocationsAwareSolverModel<Score_ extends Score<Score_>> extends

List<Location> getLocations();

Optional<String> getLocationSetName();
/**
* Returns the optional name of the location set used for map-service requests.
*
* @return the location-set name, or {@link Optional#empty()} when no name is configured
*/
default Optional<String> getLocationSetName() {
return Optional.empty();
Comment thread
rsynek marked this conversation as resolved.
}

void setLocationsNotInMap(List<Location> locationsNotInMap);

Expand Down
Loading