Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.Trip


        LOG.info("Finding interlining trips based on block IDs.");
        for (TripPattern pattern : tripPatterns) {
            Timetable timetable = pattern.scheduledTimetable;
            /* TODO: Block semantics seem undefined for frequency trips, so skip them? */
            for (TripTimes tripTimes : timetable.tripTimes) {
                Trip trip = tripTimes.trip;
                if ( ! Strings.isNullOrEmpty(trip.getBlockId())) {
                    tripTimesForBlock.put(new BlockIdAndServiceId(trip), tripTimes);
                    // For space efficiency, only record times that are part of a block.
                    patternForTripTimes.put(tripTimes, pattern);
                }
            }
View Full Code Here


        for (Transfer t : transfers) {
            Stop fromStop = t.getFromStop();
            Stop toStop = t.getToStop();
            Route fromRoute = t.getFromRoute();
            Route toRoute = t.getToRoute();
            Trip fromTrip = t.getFromTrip();
            Trip toTrip = t.getToTrip();
            Vertex fromVertex = context.stopArriveNodes.get(fromStop);
            Vertex toVertex = context.stopDepartNodes.get(toStop);
            switch (t.getTransferType()) {
            case 1:
                // timed (synchronized) transfer
View Full Code Here

    public void apply(Graph graph) {
        Agency agency = this.agency != null ? graph.index.agencyForId.get(this.agency) : null;
        Route route = this.route != null ? graph.index.routeForId.get(this.route) : null;
        Stop stop = this.stop != null ? graph.index.stopForId.get(this.stop) : null;
        Trip trip = this.trip != null ? graph.index.tripForId.get(this.trip) : null;

        if (route != null || trip != null || agency != null) {
            Collection<TripPattern> tripPatterns;

            if(trip != null) {
View Full Code Here

    public void remove(Graph graph) {
        Agency agency = this.agency != null ? graph.index.agencyForId.get(this.agency) : null;
        Route route = this.route != null ? graph.index.routeForId.get(this.route) : null;
        Stop stop = this.stop != null ? graph.index.stopForId.get(this.stop) : null;
        Trip trip = this.trip != null ? graph.index.tripForId.get(this.trip) : null;

        if (route != null || trip != null || agency != null) {
            Collection<TripPattern> tripPatterns;

            if(trip != null) {
View Full Code Here

        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();
        Stop stopM = ((TransitStopDepart)graph.getVertex("agency:M_depart")).getStop();
View Full Code Here

    @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);

        updater.applyTripUpdates(Arrays.asList(TripUpdate.parseFrom(cancellation)), "agency");
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);

        TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder();
View Full Code Here

    @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);
        updater.purgeExpiredData = (false);
View Full Code Here

    }

    @Test
    public void testBikesAllowed() {
        Graph graph = new Graph();
        Trip trip = new Trip();
        Route route = new Route();
        trip.setRoute(route);
        List<StopTime> stopTimes = Arrays.asList(new StopTime(), new StopTime());
        TripTimes s = new TripTimes(trip, stopTimes, new Deduplicator());

        RoutingRequest request = new RoutingRequest(TraverseMode.BICYCLE);
        Vertex v = new SimpleConcreteVertex(graph, "", 0.0, 0.0);
View Full Code Here

        }
    }

    @Test
    public void testApply() {
        Trip trip = new Trip();
        trip.setId(tripId);

        List<StopTime> stopTimes = new LinkedList<StopTime>();

        StopTime stopTime0 = new StopTime();
        StopTime stopTime1 = new StopTime();
View Full Code Here

TOP

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

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.