private StopTime doMap(org.onebusaway.gtfs.model.StopTime rhs) { StopTime lhs = new StopTime(); lhs.setTrip(tripMapper.map(rhs.getTrip())); lhs.setStop(stopMapper.map(rhs.getStop())); lhs.setArrivalTime(rhs.getArrivalTime()); lhs.setDepartureTime(rhs.getDepartureTime()); lhs.setTimepoint(rhs.getTimepoint()); lhs.setStopSequence(rhs.getStopSequence()); lhs.setStopHeadsign(rhs.getStopHeadsign()); lhs.setRouteShortName(rhs.getRouteShortName()); lhs.setPickupType(rhs.getPickupType()); lhs.setDropOffType(rhs.getDropOffType()); lhs.setShapeDistTraveled(rhs.getShapeDistTraveled()); lhs.setFarePeriodId(rhs.getFarePeriodId()); // Skip mapping of proxy // private transient StopTimeProxy proxy; if (rhs.getProxy() != null) { throw new IllegalStateException("Did not expect proxy to be set!"); } return lhs; }
public Stop getStartStop() { return start.getStop(); }
@Override public String toString() { return "StopTime(seq=" + getStopSequence() + " stop=" + (getStop() == null?"NuLl":getStop().getId()) + " trip=" + (getTrip() == null?"NuLl":getTrip().getId()) + " times=" + StopTimeFieldMappingFactory.getSecondsAsString(getArrivalTime()) + "-" + StopTimeFieldMappingFactory.getSecondsAsString(getDepartureTime()) + ")"; } }
public Stop getEndStop() { return end.getStop(); }
@Override public String toString() { return "StopTime(seq=" + getStopSequence() + " stop=" + getStop().getId() + " trip=" + getTrip().getId() + " times=" + StopTimeFieldMappingFactory.getSecondsAsString(getArrivalTime()) + "-" + StopTimeFieldMappingFactory.getSecondsAsString(getDepartureTime()) + ")"; } }
@Override public Boolean call() { List<StopTime> stops = _dao.getStopTimesForTrip(trips.get(0)); Stop orig = stops.get(0).getStop(), dest = stops.get(1).getStop(); _log.info("Submitting WSF block task for {} ({}, {})", cal, orig, dest); SchedResponse resp = _scheduleService.getSchedule(date(cal), id(orig), id(dest)); setBlockIdsFromSchedResponse(resp); return true; }
private Set<Stop> getStopsForTrip(GtfsRelationalDao dao, Trip trip) { Set<Stop> stops = new HashSet<Stop>(); for (StopTime stopTime : dao.getStopTimesForTrip(trip)) { stops.add(stopTime.getStop()); } return stops; } }
@Override public SortedSet<Stop> getItemForEntity(GtfsRelationalDao dao, Trip trip) { SortedSet<Stop> stops = new TreeSet<Stop>(stopComparator); for (StopTime stopTime : dao.getStopTimesForTrip(trip)) { stops.add(stopTime.getStop()); } return stops; } };
private Map<String, Integer> getStopIndices(List<StopTime> stopTimes) { Map<String, Integer> indices = new HashMap<String, Integer>(); int index = 0; for (StopTime stopTime : stopTimes) { String id = stopTime.getStop().getId().getId(); if (!indices.containsKey(id)) { indices.put(id, index); } index++; } return indices; }
private Map<String, Integer> getStopIndices(List<StopTime> stopTimes) { Map<String, Integer> indices = new HashMap<String, Integer>(); int index = 0; for (StopTime stopTime : stopTimes) { String id = stopTime.getStop().getId().getId(); if (!indices.containsKey(id)) { indices.put(id, index); } index++; } return indices; }
private Set<Stop> getAllStopsForRoute(GtfsRelationalDao dao, Route route) { Set<Stop> stops = new HashSet<Stop>(); for (Trip trip : dao.getTripsForRoute(route)) { for (StopTime stopTime : dao.getStopTimesForTrip(trip)) { stops.add(stopTime.getStop()); } } return stops; } }
public static StopPattern stopPatternfromTrip(Trip trip, GtfsRelationalDao dao) { Vector<Stop> stops = new Vector<Stop>(); Vector<Boolean> pickups = new Vector<Boolean>(); Vector<Boolean> dropoffs = new Vector<Boolean>(); for (StopTime stoptime : dao.getStopTimesForTrip(trip)) { stops.add(stoptime.getStop()); pickups.add(stoptime.getPickupType() != 1); dropoffs.add(stoptime.getDropOffType() != 1); } StopPattern pattern = new StopPattern(stops, pickups, dropoffs, trip.getServiceId()); return pattern; }
public static TripKey getTripKeyForTrip(GtfsMutableRelationalDao dao, Trip trip) { List<StopTime> stopTimes = dao.getStopTimesForTrip(trip); Stop[] stops = new Stop[stopTimes.size()]; int[] arrivalTimes = new int[stopTimes.size()]; int[] departureTimes = new int[stopTimes.size()]; for (int i = 0; i < stopTimes.size(); i++) { StopTime stopTime = stopTimes.get(i); stops[i] = stopTime.getStop(); arrivalTimes[i] = stopTime.getArrivalTime(); departureTimes[i] = stopTime.getDepartureTime(); } return new TripKey(stops, arrivalTimes, departureTimes); }
public Geometry getGeometry() { if (geometry == null) { GeometryFactory factory = new GeometryFactory(new PrecisionModel( PrecisionModel.FLOATING), 4326); Stop stop1 = start.getStop(); Stop stop2 = end.getStop(); Coordinate c1 = new Coordinate(stop1.getLon(), stop1.getLat()); Coordinate c2 = new Coordinate(stop2.getLon(), stop2.getLat()); geometry = factory.createLineString(new Coordinate[] { c1, c2 }); } return geometry; }
@Override public void run(TransformContext context, GtfsMutableRelationalDao dao) { for (Trip trip: dao.getAllTrips()){ List<StopTime> stopTimes = dao.getStopTimesForTrip(trip); Stop lastStop = stopTimes.get(stopTimes.size() - 1).getStop(); trip.setTripHeadsign(lastStop.getName()); } }
public static StopSequencePattern getPatternForStopTimes(List<StopTime> stopTimes) { int n = stopTimes.size(); AgencyAndId[] stopIds = new AgencyAndId[n]; int[] arrivalTimes = new int[n]; int[] departureTimes = new int[n]; for (int i = 0; i < n; i++) { StopTime stopTime = stopTimes.get(i); stopIds[i] = stopTime.getStop().getId(); arrivalTimes[i] = stopTime.getArrivalTime(); departureTimes[i] = stopTime.getDepartureTime(); } return new StopSequencePattern(stopIds, arrivalTimes, departureTimes); } }
@Cacheable @Transactional public Collection<AgencyAndId> getStopsForRouteCollection(AgencyAndId id) { Set<AgencyAndId> stopIds = new HashSet<AgencyAndId>(); RouteCollection routeCollection = _whereDao.getRouteCollectionForId(id); for (Route route : routeCollection.getRoutes()) { List<Trip> trips = _gtfsDao.getTripsForRoute(route); for (Trip trip : trips) { List<StopTime> stopTimes = _gtfsDao.getStopTimesForTrip(trip); for (StopTime stopTime : stopTimes) stopIds.add(stopTime.getStop().getId()); } } return new ArrayList<AgencyAndId>(stopIds); }
private void retainStopTime(StopTime stopTime, boolean retainUp) { if (!retainUp) { retainDown(stopTime.getStop()); if (_retainAllStopTimesForTrip) retainUp(stopTime.getTrip()); else retainDown(stopTime.getTrip()); } }
private Pattern getPatternForTrip(GtfsMutableRelationalDao dao, Trip trip) { List<StopTime> stopTimes = dao.getStopTimesForTrip(trip); int n = stopTimes.size(); AgencyAndId[] stopIds = new AgencyAndId[n]; int[] arrivalTimes = new int[n]; int[] departureTimes = new int[n]; for (int i = 0; i < n; i++) { StopTime stopTime = stopTimes.get(i); stopIds[i] = stopTime.getStop().getId(); arrivalTimes[i] = stopTime.getArrivalTime(); departureTimes[i] = stopTime.getDepartureTime(); } return new Pattern(trip.getRoute().getId(), trip.getServiceId(), stopIds, arrivalTimes, departureTimes); }