Examples of TripTimes


Examples of org.opentripplanner.routing.trippattern.TripTimes

        stopTimes.add(stopDwellTime);
        stopTimes.add(stopArriveTime);
        trip.setId(agencyAndId);
        trip.setTripHeadsign("The right");

        TripTimes tripTimes = new TripTimes(trip, stopTimes, new Deduplicator());
        StopPattern stopPattern = new StopPattern(stopTimes);
        TripPattern tripPattern = new TripPattern(route, stopPattern);

        when(depart.getTripPattern()).thenReturn(tripPattern);
        when(dwell.getTripPattern()).thenReturn(tripPattern);
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

        stopArriveTime.setStop(stopArrive);
        stopTimes.add(stopDepartTime);
        stopTimes.add(stopArriveTime);
        trip.setId(agencyAndId);

        TripTimes tripTimes = new TripTimes(trip, stopTimes, new Deduplicator());
        StopPattern stopPattern = new StopPattern(stopTimes);
        TripPattern tripPattern = new TripPattern(route, stopPattern);

        when(depart.getTripPattern()).thenReturn(tripPattern);
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

        stopTimes.add(stopDepartTime);
        stopTimes.add(stopDwellTime);
        stopTimes.add(stopArriveTime);
        trip.setId(agencyAndId);

        TripTimes tripTimes = new TripTimes(trip, stopTimes, new Deduplicator());
        StopPattern stopPattern = new StopPattern(stopTimes);
        TripPattern tripPattern = new TripPattern(route, stopPattern);

        when(depart.getTripPattern()).thenReturn(tripPattern);
        when(dwell.getTripPattern()).thenReturn(tripPattern);
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

        tripUpdateBuilder = TripUpdate.newBuilder();
        tripUpdateBuilder.setTrip(tripDescriptorBuilder);
        tripUpdate = tripUpdateBuilder.build();
        assertTrue(timetable.update(tripUpdate, timeZone, serviceDate));

        TripTimes tripTimes = timetable.getTripTimes(trip_1_1_index);
        for (int i = 0; i < tripTimes.getNumStops(); i++) {
            assertEquals(TripTimes.UNAVAILABLE, tripTimes.getDepartureTime(i));
            assertEquals(TripTimes.UNAVAILABLE, tripTimes.getArrivalTime(i));
        }

        //---
        options.setRoutingContext(graph, stop_a, stop_c);
        spt = aStar.getShortestPathTree(options);
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

        Timetable schedule = resolver.resolve(pattern, null);
        assertNotSame(forToday, schedule);
        assertNotSame(forToday.getTripTimes(tripIndex), schedule.getTripTimes(tripIndex));
        assertSame(forToday.getTripTimes(tripIndex2), schedule.getTripTimes(tripIndex2));

        TripTimes tripTimes = forToday.getTripTimes(tripIndex);
        for (int i = 0; i < tripTimes.getNumStops(); i++) {
            assertEquals(TripTimes.UNAVAILABLE, tripTimes.getDepartureTime(i));
            assertEquals(TripTimes.UNAVAILABLE, tripTimes.getArrivalTime(i));
        }
    }
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

                tripPattern = new TripPattern(trip.getRoute(), stopPattern);
                tripPatterns.put(stopPattern, tripPattern);
            }

            /* Create a TripTimes object for this list of stoptimes, which form one trip. */
            TripTimes tripTimes = new TripTimes(trip, stopTimes, graph.deduplicator);

            /* If this trip is referenced by one or more lines in frequencies.txt, wrap it in a FrequencyEntry. */
            List<Frequency> frequencies = frequenciesForTrip.get(trip);
            if (frequencies != null && !(frequencies.isEmpty())) {
                for (Frequency freq : frequencies) {
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

         */
        SERVICE_BLOCK :
        for (BlockIdAndServiceId block : tripTimesForBlock.keySet()) {
            List<TripTimes> blockTripTimes = tripTimesForBlock.get(block);
            Collections.sort(blockTripTimes);
            TripTimes prev = null;
            for (TripTimes curr : blockTripTimes) {
                if (prev != null) {
                    if (prev.getDepartureTime(prev.getNumStops() - 1) > curr.getArrivalTime(0)) {
                        LOG.error("Trip times within block {} on service {} are not increasing on service {} after trip {}.",
                                block.blockId, block.serviceId, prev.trip.getId());
                        continue SERVICE_BLOCK;
                    }
                    TripPattern prevPattern = patternForTripTimes.get(prev);
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

        HashFunction murmur = Hashing.murmur3_32();
        BaseEncoding encoder = BaseEncoding.base64Url().omitPadding();
        StringBuilder sb = new StringBuilder(50);
        sb.append(encoder.encode(stopPattern.semanticHash(murmur).asBytes()));
        if (trip != null) {
            TripTimes tripTimes = scheduledTimetable.getTripTimes(trip);
            if (tripTimes == null) return null;
            sb.append(':');
            sb.append(encoder.encode(tripTimes.semanticHash(murmur).asBytes()));
        }
        return sb.toString();
    }
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

        for (TripTimes tt : this.tripTimes) {
            tt.serviceCode = serviceCodes.get(tt.trip.getServiceId());
        }
        // Repeated code... bad sign...
        for (FrequencyEntry freq : this.frequencyEntries) {
            TripTimes tt = freq.tripTimes;
            tt.serviceCode = serviceCodes.get(tt.trip.getServiceId());
        }
    }
View Full Code Here

Examples of org.opentripplanner.routing.trippattern.TripTimes

                ++s.num;
            }
        }
        /* Do the same thing for any frequency-based trips. */
        for (FrequencyEntry freq : pattern.scheduledTimetable.frequencyEntries) {
            TripTimes tt = freq.tripTimes;
            int overlap = window.overlap(freq.startTime, freq.endTime, tt.serviceCode);
            if (overlap == 0) continue;
            int n = overlap / freq.headway + 1; // number of trip instances in the overlap. round up, avoid zeros.
            int depart = tt.getDepartureTime(stop0);
            int arrive = tt.getArrivalTime(stop1);
            int t = arrive - depart;
            if (t < s.min) s.min = t;
            if (t > s.max) s.max = t;
            s.avg += (t * n);
            s.num += n;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.