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

org.opentripplanner.graph_builder.module.stopsAlerts.UnconnectedStop Maven / Gradle / Ivy

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

import org.opentripplanner.routing.edgetype.PathwayEdge;
import org.opentripplanner.routing.edgetype.StreetTransitLink;
import org.opentripplanner.routing.graph.Edge;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.vertextype.TransitStopVertex;

import java.util.List;

public class UnconnectedStop extends AbstractStopTester {


    /**
     * @return true if the stop is not connected to any street
     */
    @Override
    public boolean fulfillDemands(TransitStopVertex ts, Graph graph) {
        List outgoingStreets = ts.getOutgoingStreetEdges();
        boolean hasStreetLink = false;
        for(Edge e:ts.getIncoming()){
            if(e instanceof StreetTransitLink || e instanceof PathwayEdge){
                hasStreetLink = true;
                break;
            }
        }
        if(!hasStreetLink){
            //TODO: see what if there is incoming and not outgoing
            for(Edge e:ts.getOutgoing()){
                if(e instanceof StreetTransitLink){
                    hasStreetLink = true;
                    break;
                }
            }
        }
        return !(hasStreetLink || (outgoingStreets.size() > 0));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy