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

org.opentripplanner.graph_builder.issues.GraphConnectivity Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.DataImportIssue;
import org.opentripplanner.routing.graph.Vertex;

public class GraphConnectivity implements DataImportIssue {

    public static final String FMT = "Removed/depedestrianized disconnected subgraph containing vertex '%s' at (%f, %f), with %d edges";
    public static final String HTMLFMT = "Removed/depedestrianized disconnected subgraph containing vertex '%s', with %d edges";

    final Vertex vertex;
    final int size;
    
    public GraphConnectivity(Vertex vertex, int size){
    	this.vertex = vertex;
    	this.size = size;
    }

    @Override
    public String getMessage() {
        return String.format(FMT, vertex, vertex.getCoordinate().x, vertex.getCoordinate().y, size);
    }

    @Override
    public String getHTMLMessage() {
        String label = vertex.getLabel();
        if (label.startsWith("osm:")) {
            String osmNodeId = label.split(":")[2];
            return String.format(HTMLFMT, osmNodeId, osmNodeId, size);
        } else {
            return this.getMessage();
        }
    }

    @Override
    public Vertex getReferencedVertex() {
        return vertex;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy