All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.ext.transferanalyzer.annotations.TransferCouldNotBeRouted Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.ext.transferanalyzer.annotations;

import org.opentripplanner.graph_builder.DataImportIssue;
import org.opentripplanner.model.Stop;

/**
 * Represents two stops that are close to each other where no route is found between them using OSM data
 */
public class TransferCouldNotBeRouted implements DataImportIssue {

    private static final String FMT = "Connection between stop %s and stop %s could not be routed. " +
            "Euclidean distance is %.0f.";

    private static final String HTMLFMT = "Connection between stop " +
            "\"%s\" (%s) and stop " +
            "\"%s\" (%s) could not be routed. " +
            "Euclidean distance is %.0f.";

    private final Stop origin;
    private final Stop destination;
    private final double directDistance;

    public TransferCouldNotBeRouted(Stop origin, Stop destination, double directDistance) {
        this.origin = origin;
        this.destination = destination;
        this.directDistance = directDistance;
    }

    @Override
    public String getMessage() {
        return String.format(FMT, origin, destination, directDistance);
    }

    @Override
    public String getHTMLMessage() {
        return String.format(HTMLFMT, origin.getLat(), origin.getLon(),
                origin.getName(), origin.getId(), destination.getLat(),
                destination.getLon(), destination.getName(), destination.getId(),
                directDistance);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy