Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.AgencyAndId


     */
    private void addTripToTripTransferTimeToTable(TransferTable table, String fromStopId,
            String toStopId, String fromRouteId, String toRouteId, String fromTripId,
            String toTripId, int transferTime) {
        Stop fromStop = new Stop();
        fromStop.setId(new AgencyAndId("TriMet", fromStopId));
        Stop toStop = new Stop();
        toStop.setId(new AgencyAndId("TriMet", toStopId));
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("TriMet", fromRouteId));
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("TriMet", toRouteId));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("TriMet", fromTripId));
        fromTrip.setRoute(fromRoute);
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("TriMet", toTripId));
        toTrip.setRoute(toRoute);
        table.addTransferTime(fromStop, toStop, null, null, fromTrip, toTrip, transferTime);
        assertEquals(transferTime, table.getTransferTime(fromStop, toStop, fromTrip, toTrip, true));
    }
View Full Code Here


     * Add a stop-to-stop transfer time to a transfer table and check the result
     */
    private void addStopToStopTransferTimeToTable(TransferTable table, String fromStopId,
            String toStopId, int transferTime) {
        Stop fromStop = new Stop();
        fromStop.setId(new AgencyAndId("TriMet", fromStopId));
        Stop toStop = new Stop();
        toStop.setId(new AgencyAndId("TriMet", toStopId));
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("TriMet", "dummy"));
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("TriMet", "dummy"));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("TriMet", "dummy"));
        fromTrip.setRoute(fromRoute);
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("TriMet", "dummy"));
        toTrip.setRoute(toRoute);
        table.addTransferTime(fromStop, toStop, null, null, null, null, transferTime);
        assertEquals(transferTime, table.getTransferTime(fromStop, toStop, fromTrip, toTrip, true));
    }
View Full Code Here

        Graph graph = new Graph();
        _builder.buildGraph(graph, _extra);
        graph.index(new DefaultStreetVertexIndexFactory());

        Trip trip = graph.index.tripForId.get(new AgencyAndId("a0", "t0"));
        TripPattern pattern = graph.index.patternForTrip.get(trip);
        List<Trip> trips = pattern.getTrips();
        assertEquals(BikeAccess.UNKNOWN,
                BikeAccess.fromTrip(withId(trips, new AgencyAndId("a0", "t0"))));
        assertEquals(BikeAccess.ALLOWED,
                BikeAccess.fromTrip(withId(trips, new AgencyAndId("a0", "t1"))));
    }
View Full Code Here

        Graph graph = new Graph();
        _builder.buildGraph(graph, _extra);
        graph.index(new DefaultStreetVertexIndexFactory());

        Trip trip = graph.index.tripForId.get(new AgencyAndId("a0", "t0"));
        TripPattern pattern = graph.index.patternForTrip.get(trip);
        List<Trip> trips = pattern.getTrips();
        assertEquals(BikeAccess.ALLOWED,
                BikeAccess.fromTrip(withId(trips, new AgencyAndId("a0", "t0"))));
        assertEquals(BikeAccess.NOT_ALLOWED,
                BikeAccess.fromTrip(withId(trips, new AgencyAndId("a0", "t1"))));
    }
View Full Code Here

                    patternIndex.put(trip.getId(), pattern);
                }
            }
        }
       
        pattern = patternIndex.get(new AgencyAndId("agency", "1.1"));
        timetable = pattern.scheduledTimetable;
    }
View Full Code Here

        TripUpdate.Builder tripUpdateBuilder;
        TripDescriptor.Builder tripDescriptorBuilder;
        StopTimeUpdate.Builder stopTimeUpdateBuilder;
        StopTimeEvent.Builder stopTimeEventBuilder;

        int trip_1_1_index = timetable.getTripIndex(new AgencyAndId("agency", "1.1"));

        Vertex stop_a = graph.getVertex("agency:A");
        Vertex stop_c = graph.getVertex("agency:C");
        RoutingRequest options = new RoutingRequest();
View Full Code Here

    private void readFareRules(GtfsRelationalDao dao) {
        Collection<FareRule> rules = dao.getAllFareRules();
        for (FareRule rule : rules) {
            FareAttribute fare = rule.getFare();
            AgencyAndId id = fare.getId();
            FareRuleSet fareRule = fareRules.get(id);
            if (fareRule == null) {
                fareRule = new FareRuleSet();
                fareRules.put(id, fareRule);
            }
            String contains = rule.getContainsId();
            if (contains != null) {
                fareRule.addContains(contains);
            }
            String origin = rule.getOriginId();
            String destination = rule.getDestinationId();
            if (origin != null || destination != null) {
                fareRule.addOriginDestination(origin, destination);
            }
            Route route = rule.getRoute();
            if (route != null) {
                AgencyAndId routeId = route.getId();
                fareRule.addRoute(routeId);
            }
        }
    }
View Full Code Here

        }

        alertPatch.apply(graph);
        alertPatches.put(alertPatch.getId(), alertPatch);

        AgencyAndId stop = alertPatch.getStop();
        if (stop != null) {
            patchesByStop.put(stop, alertPatch);
        }
        AgencyAndId route = alertPatch.getRoute();
        if (route != null) {
            patchesByRoute.put(route, alertPatch);
        }
    }
View Full Code Here

        }
        alertPatches.keySet().removeAll(toRemove);
    }

    private void expire(AlertPatch alertPatch) {
        AgencyAndId stop = alertPatch.getStop();
        if (stop != null) {
            patchesByStop.remove(stop, alertPatch);
        }
        AgencyAndId route = alertPatch.getRoute();
        if (route != null) {
            patchesByRoute.remove(route, alertPatch);
        }

        alertPatch.remove(graph);
View Full Code Here

        }
        LOG.info("Done finding interlining trips and creating the corresponding edges.");
    }

    private LineString[] createGeometry(Graph graph, Trip trip, List<StopTime> stopTimes) {
        AgencyAndId shapeId = trip.getShapeId();
       
        // one less geometry than stoptime as these are hops not stops (fencepost problem)
        LineString[] geoms = new LineString[stopTimes.size() - 1];
       
        /* Detect presence or absence of shape_dist_traveled on a per-trip basis */
 
View Full Code Here

TOP

Related Classes of org.onebusaway.gtfs.model.AgencyAndId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.