Examples of Trip


Examples of models.transit.Trip

    public static void deleteTrip(Long id) {
        if(id == null)
            badRequest();

        Trip trip = Trip.findById(id);

        if(trip == null)
            badRequest();

        StopTime.delete("trip = ?", trip);
        trip.delete();

        ok();
    }
View Full Code Here

Examples of models.transit.Trip

     */
    public static class TripWithStopTimes extends Trip {
        List<StopTimeWithDeletion> stopTimes;
       
        public Trip toTrip () {
            Trip ret = new Trip();
            ret.blockId = this.blockId;
            ret.endTime = this.endTime;
            ret.gtfsTripId = this.gtfsTripId;
            ret.headway = this.headway;
            ret.id = this.id;
View Full Code Here

Examples of models.transit.Trip

             }
             else if(lineNum > 6)
             {
               if(!csvLine[0].isEmpty())
               {
                 Trip trip = new Trip();
                
                 trip.pattern = pattern;
                 trip.serviceCalendar = calendar;
                
                 trip.blockId = csvLine[2];
                 trip.tripHeadsign = csvLine[3];
                 trip.tripShortName = csvLine[4];
                
                 trip.useFrequency = false;
                
                 trip.save();
                
                 Integer firstTimepoint = null;
                 Integer columnCount = 0;
                 Integer previousTime = 0;
                 Integer dayOffset = 0;
View Full Code Here

Examples of org.onebusaway.gtfs.model.Trip

      for (int i = 0; i < journies.size(); ++i) {
        JourneyHeaderElement journey = journies.get(i);
        if (journey.getOperatorId().equals("EU")) {
          continue;
        }
        Trip trip = new Trip();
        String id = journey.getOperatorId() + "-"
            + journey.getJourneyIdentifier();
        if (journies.size() > 1) {
          id += "-" + i;
        }
        trip.setId(new AgencyAndId(journey.getOperatorId(), id));
        trip.setRoute(getRouteForJourney(journey));
        trip.setServiceId(getServiceIdForJourney(journey));

        AgencyAndId routeId = trip.getRoute().getId();
        RouteMetadata metadata = getMetadataForRouteId(routeId);

        String directionName = metadata.getDirectionNameForDirectionId(journey.getRouteDirection());
        if (!isEmpty(directionName)) {
          trip.setTripHeadsign(directionName);
        }
        Integer directionId = metadata.getDirectionIdForDirection(journey.getRouteDirection());
        if (directionId != null) {
          trip.setDirectionId(directionId.toString());
        }

        if (constructTimepoints(journey, trip)) {
          _dao.saveEntity(trip);
        }
View Full Code Here

Examples of org.onebusaway.gtfs.model.Trip

          rides.add(newRide);

          newRide.firstStop = ((HopEdge) backEdge).getBeginStop();

          newRide.route = routeId;
          Trip trip = state.getBackTrip();
          Route route = trip.getRoute();
          int type = route.getType();
          newRide.classifier = type;
          String shortName = route.getShortName();
          if (shortName == null ) {
            newRide.classifier = SUBWAY;
View Full Code Here

Examples of org.onebusaway.gtfs.model.Trip

    /** @return A list containing one AgencyAndId (trip_id) for each vehicle boarded in this path,
     * in the chronological order they are boarded. */
    public List<AgencyAndId> getTrips() {
        List<AgencyAndId> ret = new LinkedList<AgencyAndId>();
        Trip lastTrip = null;
        for (State s : states) {
            if (s.getBackEdge() != null) {
                Trip trip = s.getBackTrip();
                if (trip != null && trip != lastTrip) {
                    ret.add(trip.getId());
                    lastTrip = trip;
                }
            }
        }
        return ret;
View Full Code Here

Examples of org.onebusaway.gtfs.model.Trip

        RoutingRequest opt = ctx.opt;
        opt.rctx = ctx;

        /* 1. Get the list of PatternHop for the given trip ID. */
        AgencyAndId tripId = opt.startingTransitTripId;
        Trip trip = ctx.graph.index.tripForId.get(tripId);
        TripPattern tripPattern = ctx.graph.index.patternForTrip.get(trip);
        if (tripPattern == null) {
            // TODO Shouldn't we bailout on a normal trip plan here, returning null ?
            throw new IllegalArgumentException("Unknown/invalid trip ID: " + tripId);
        }
View Full Code Here

Examples of org.onebusaway.gtfs.model.Trip

                        bestTripTimes  = tripTimes;
                    }
                }
            }
            if (bestWait < 0) return null; // no appropriate trip was found
            Trip trip = bestTripTimes.trip;
           
            /* check if route and/or Agency are banned for this plan */
            // FIXME this should be done WHILE searching for a trip.
            if (options.tripIsBanned(trip)) return null;

            /* Check if route is preferred by the user. */
            long preferences_penalty = options.preferencesPenaltyForRoute(getPattern().route);
           
            /* Compute penalty for non-preferred transfers. */
            int transferPenalty = 0;
            /* If this is not the first boarding, then we are transferring. */
            if (s0.isEverBoarded()) {
                TransferTable transferTable = options.getRoutingContext().transferTable;
                int transferTime = transferTable.getTransferTime(s0.getPreviousStop(),
                                   getStop(), s0.getPreviousTrip(), trip, boarding);
                transferPenalty  = transferTable.determineTransferPenalty(transferTime,
                                   options.nonpreferredTransferPenalty);
            }           

            /* Found a trip to board. Now make the child state. */
            StateEditor s1 = s0.edit(this);
            s1.setBackMode(getMode());
            s1.setServiceDay(bestServiceDay);
            // Save the trip times in the State to ensure that router has a consistent view
            // and constant-time access to them.
            s1.setTripTimes(bestTripTimes);
            s1.incrementTimeInSeconds(bestWait);
            s1.incrementNumBoardings();
            s1.setTripId(trip.getId());
            s1.setPreviousTrip(trip);
            s1.setZone(getPattern().getZone(stopIndex));
            s1.setRoute(trip.getRoute().getId());

            double wait_cost = bestWait;

            if (!s0.isEverBoarded() && !options.reverseOptimizing) {
                wait_cost *= options.waitAtBeginningFactor;
View Full Code Here

Examples of org.onebusaway.gtfs.model.Trip

            for (Trip trip : graphIndex.tripForId.values()) {
                map.put(trip.getId().getId(), trip);
            }
            graphIndex.tripForIdWithoutAgency = map;
        }
        Trip trip = graphIndex.tripForIdWithoutAgency.get(tripIdWithoutAgency);
        TripPattern pattern = graphIndex.patternForTrip.get(trip);
        return pattern;
    }
View Full Code Here

Examples of org.onebusaway.gtfs.model.Trip

    @Override
    public State traverse(State state0) {

        RoutingRequest options = state0.getOptions();
        Trip oldTrip = state0.getBackTrip();
        Trip newTrip = options.arriveBy ? trips.inverse().get(oldTrip) : trips.get(oldTrip);
        if (newTrip == null) return null;

        TripPattern newPattern;
        TripTimes newTripTimes;
        TripTimes oldTripTimes = state0.getTripTimes();
        int arrivalTime;
        int departureTime;
        AgencyAndId tripId = state0.getTripId();

        if (options.arriveBy) {
            // traversing backward
            newPattern = ((OnboardVertex) fromv).getTripPattern();
            newTripTimes = newPattern.getResolvedTripTimes(newTrip, state0);
            arrivalTime = newTripTimes.getArrivalTime(newTripTimes.getNumStops() - 1); // FIXME with getLastTime method
            departureTime = oldTripTimes.getDepartureTime(0);
        } else {
            // traversing forward
            newPattern = ((OnboardVertex) tov).getTripPattern();
            newTripTimes = newPattern.getResolvedTripTimes(newTrip, state0);
            arrivalTime = oldTripTimes.getArrivalTime(oldTripTimes.getNumStops() - 1); // FIXME with getLastTime method
            departureTime = newTripTimes.getDepartureTime(0);
        }

//        BannedStopSet banned = options.bannedTrips.get(newTrip.getId());
//        if (banned != null && banned.contains(0)) // i.e. if the first stop is banned.
//            return null;

        int dwellTime = departureTime - arrivalTime;
        if (dwellTime < 0) return null;

        StateEditor s1 = state0.edit(this);
        s1.incrementTimeInSeconds(dwellTime);
        s1.setTripId(newTrip.getId()); // TODO check meaning
        s1.setPreviousTrip(oldTrip);   // TODO check meaning
        s1.setTripTimes(newTripTimes);
        s1.incrementWeight(dwellTime);
        // Mode should not change.
        return s1.makeState();
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.