src/main/java/com/conveyal/gtfs/stats/StopStats.java
public int getHeadwayForStopByRoute (String stop_id, String route_id, LocalDate date, LocalTime from, LocalTime to) {

        List<Trip> tripsForStop = feed.getDistinctTripsForStop(stop_id).stream()
                .filter(trip -> feed.trips.get(trip.trip_id).route_id.equals(route_id))
                .filter(trip -> feed.services.get(trip.service_id).activeOn(date))
                .collect(Collectors.toList());

        return getStopHeadwayForTrips(stop_id, tripsForStop, from, to);
    }
public int getHeadwayForStopByRoute (String stop_id, String route_id, LocalDate date, LocalTime from, LocalTime to) {

        List<Trip> tripsForStop = feed.getDistinctTripsForStop(stop_id).stream()
                .filter(trip -> feed.trips.get(trip.trip_id).route_id.equals(route_id))
                .filter(trip -> feed.services.get(trip.service_id).activeOn(date))
                .collect(Collectors.toList());

        return getStopHeadwayForTrips(stop_id, tripsForStop, from, to);
    }
public int getHeadwayForStopByRoute ( String stop_id , String route_id , LocalDate date , LocalTime from , LocalTime to ) { List < Trip > tripsForStop = feed . getDistinctTripsForStop ( stop_id ) . stream ( ) . filter ( trip -> feed . trips . get ( trip . trip_id ) . route_id . equals ( route_id ) ) . filter ( trip -> feed . services . get ( trip . service_id ) . activeOn ( date ) ) . collect ( Collectors . toList ( ) ) ; return getStopHeadwayForTrips ( stop_id , tripsForStop , from , to ) ; }
Get the average headway, in seconds, for a route at a stop over a time window.
@param stop_id
@param route_id
@param date
@param from
@param to
@return avg. headway (in seconds)
Get the average headway in seconds for a route at a stop over a time window .