Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.AgencyAndId


            String parentStation = stop.getParentStation();
            if (parentStation != null) {
                Vertex stopVertex = context.stationStopNodes.get(stop);

                String agencyId = stop.getId().getAgencyId();
                AgencyAndId parentStationId = new AgencyAndId(agencyId, parentStation);

                Stop parentStop = _dao.getStopForId(parentStationId);
                Vertex parentStopVertex = context.stationStopNodes.get(parentStop);

                new FreeEdge(parentStopVertex, stopVertex);
View Full Code Here


        for (Stop stop : _dao.getAllStops()) {
            String parentStation = stop.getParentStation();
            if (parentStation != null) {
                TransitStop stopVertex = (TransitStop) context.stationStopNodes.get(stop);
                String agencyId = stop.getId().getAgencyId();
                AgencyAndId parentStationId = new AgencyAndId(agencyId, parentStation);
                Stop parentStop = _dao.getStopForId(parentStationId);
                if(context.stationStopNodes.get(parentStop) instanceof TransitStation) {
                    TransitStation parentStopVertex = (TransitStation)
                            context.stationStopNodes.get(parentStop);
                    new StationStopEdge(parentStopVertex, stopVertex);
View Full Code Here

                continue;
            }
            n++;

            try {
                AgencyAndId stopId = GtfsLibrary.convertIdFromString(stopString);
                retval.agencyAndStopIds.add(stopId);
            } catch (IllegalArgumentException e) {
                throw new IllegalArgumentException("Wrong stop spec format: " + stopString);
            }
        }
View Full Code Here

            }
            // Check whether parent stop is matched
            else if (stop.getParentStation() != null
                    && !stop.getParentStation().isEmpty()) {
                // This stop has a parent
                AgencyAndId parentId = new AgencyAndId(stop.getId().getAgencyId(), stop.getParentStation());
                if (matches(parentId)) {
                    return true;   
                }
            }
        }
View Full Code Here

    public static AgencyAndId convertIdFromString(String value) {
        int index = value.indexOf(ID_SEPARATOR);
        if (index == -1) {
            throw new IllegalArgumentException("invalid agency-and-id: " + value);
        } else {
            return new AgencyAndId(value.substring(0, index), value.substring(index + 1));
        }
    }
View Full Code Here

     * This only works if the Collection of TripPattern includes every TripPattern for the agency.
     */
    public static void generateUniqueIds(Collection<TripPattern> tripPatterns) {
        Multimap<Route, TripPattern> patternsForRoute = HashMultimap.create();
        for (TripPattern pattern : tripPatterns) {
            AgencyAndId routeId = pattern.route.getId();
            patternsForRoute.put(pattern.route, pattern);
            int count = patternsForRoute.get(pattern.route).size();
            // OBA library uses underscore as separator, we're moving toward colon.
            String id = String.format("%s:%s:%02d", routeId.getAgencyId(), routeId.getId(), count);
            pattern.code = (id);
        }
    }
View Full Code Here

    public void testTransfers() throws Exception {
        TransferTable transferTable = graph.getTransferTable();
       
        // create dummy routes and trips
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("agency", "1"));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("agency", "1.1"));
        fromTrip.setRoute(fromRoute);
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("agency", "2"));
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("agency", "2.1"));
        toTrip.setRoute(toRoute);
        Trip toTrip2 = new Trip();
        toTrip2.setId(new AgencyAndId("agency", "2.2"));
        toTrip2.setRoute(toRoute);
       
        // find stops
        Stop stopK = ((TransitStopArrive)graph.getVertex("agency:K_arrive")).getStop();
        Stop stopN = ((TransitStopDepart)graph.getVertex("agency:N_depart")).getStop();
View Full Code Here

        assertNotSame(resolver, newResolver);
    }

    @Test
    public void testHandleCanceledTrip() throws InvalidProtocolBufferException {
        AgencyAndId tripId = new AgencyAndId("agency", "1.1");
        AgencyAndId tripId2 = new AgencyAndId("agency", "1.2");
        Trip trip = graph.index.tripForId.get(tripId);
        TripPattern pattern = graph.index.patternForTrip.get(trip);
        int tripIndex = pattern.scheduledTimetable.getTripIndex(tripId);
        int tripIndex2 = pattern.scheduledTimetable.getTripIndex(tripId2);
View Full Code Here

        }
    }

    @Test
    public void testHandleModifiedTrip() {
        AgencyAndId tripId = new AgencyAndId("agency", "1.1");
        AgencyAndId tripId2 = new AgencyAndId("agency", "1.2");
        Trip trip = graph.index.tripForId.get(tripId);
        TripPattern pattern = graph.index.patternForTrip.get(trip);
        int tripIndex = pattern.scheduledTimetable.getTripIndex(tripId);
        int tripIndex2 = pattern.scheduledTimetable.getTripIndex(tripId2);
View Full Code Here

        assertEquals(1, forToday.getTripTimes(tripIndex).getDepartureDelay(1));
    }

    @Test
    public void testPurgeExpiredData() throws InvalidProtocolBufferException {
        AgencyAndId tripId = new AgencyAndId("agency", "1.1");
        ServiceDate previously = serviceDate.previous().previous(); // Just to be safe...
        Trip trip = graph.index.tripForId.get(tripId);
        TripPattern pattern = graph.index.patternForTrip.get(trip);

        updater.maxSnapshotFrequency = (0);
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.