private Stop doMap(org.onebusaway.gtfs.model.Stop rhs) { Stop lhs = new Stop(); lhs.setId(mapAgencyAndId(rhs.getId())); lhs.setName(rhs.getName()); lhs.setLat(rhs.getLat()); lhs.setLon(rhs.getLon()); lhs.setCode(rhs.getCode()); lhs.setDesc(rhs.getDesc()); lhs.setZoneId(rhs.getZoneId()); lhs.setUrl(rhs.getUrl()); lhs.setLocationType(rhs.getLocationType()); lhs.setParentStation(rhs.getParentStation()); lhs.setWheelchairBoarding(rhs.getWheelchairBoarding()); lhs.setDirection(rhs.getDirection()); lhs.setTimezone(rhs.getTimezone()); lhs.setVehicleType(rhs.getVehicleType()); lhs.setPlatformCode(rhs.getPlatformCode()); return lhs; } }
@Override public boolean equals(Object o) { if (!(o instanceof StopGroup)) return false; return parent.equals(((StopGroup) o).parent); } }
public TransitStop(String id, double lon, double lat, String name, String stopId, Stop stop) { super(id, lon, lat, name, stopId); if (stop != null) { this.wheelchairEntrance = stop.getWheelchairBoarding() == 1; } isEntrance = stop == null ? false : stop.getLocationType() == 2; }
referenceStops.put(stop.getId().getId(), stop); AgencyAndId agencyAndId = dao.getAllStops().iterator().next().getId(); String parentStation = stop.getParentStation(); if (parentStation != null) { Stop existingStop = dao.getStopForId(new AgencyAndId(agencyAndId.getAgencyId(), parentStation)); if (existingStop == null && !stopsAdded.contains(referenceStops.get(parentStation).getId())) { Stop stopToAdd = new Stop(); stopToAdd.setId(referenceStops.get(parentStation).getId()); stopToAdd.setName(referenceStops.get(parentStation).getName()); stopToAdd.setLat(referenceStops.get(parentStation).getLat()); stopToAdd.setLon(referenceStops.get(parentStation).getLon()); stopToAdd.setLocationType(referenceStops.get(parentStation).getLocationType()); stopsAdded.add(referenceStops.get(parentStation).getId()); stopsToAdd.add(stopToAdd);
stop.getId().setAgencyId(reader.getDefaultAgencyId());
private Stop createStop(Stop stop, int locationType, int wheelchairAccessible, String suffix) { if (stop == null) return null; Stop entrance = new Stop(); AgencyAndId id = new AgencyAndId(); id.setAgencyId(agencyId); id.setId(stop.getId().getId() + "-" + suffix); entrance.setId(id); entrance.setName(stop.getName()); entrance.setLat(stop.getLat()); entrance.setLon(stop.getLon()); entrance.setLocationType(locationType); entrance.setWheelchairBoarding(wheelchairAccessible); entrance.setParentStation(stop.getId().getId()); newStops.add(entrance); return entrance; }
private StopBean fillStopBean(Stop stop, StopBean bean) { bean.setId(ApplicationBeanLibrary.getId(stop.getId())); bean.setLat(stop.getLat()); bean.setLon(stop.getLon()); StopNarrative stopNarrative = _narrativeService.getStopForId(stop.getId()); if (stopNarrative != null) bean.setDirection(stopNarrative.getDireciton()); bean.setName(stop.getName()); bean.setCode(StringLibrary.getBestName(stop.getCode(), stop.getId().getId())); bean.setLocationType(stop.getLocationType()); return bean; }
@Override public List<Stop> getStopsForStation(Stop station) { if (_stopsByStation == null) { _stopsByStation = new HashMap<Stop, List<Stop>>(); for (Stop stop : getAllStops()) { if (stop.getLocationType() == 0 && stop.getParentStation() != null) { Stop parentStation = getStopForId(new AgencyAndId( stop.getId().getAgencyId(), stop.getParentStation())); List<Stop> subStops = _stopsByStation.get(parentStation); if (subStops == null) { subStops = new ArrayList<Stop>(2); _stopsByStation.put(parentStation, subStops); } subStops.add(stop); } } } return list(_stopsByStation.get(station)); }
referenceStops.put(stop.getId().getId(), stop); AgencyAndId agencyAndId = dao.getAllStops().iterator().next().getId(); if (stopsAdded.containsKey(refStop.getId())) { duplicate++; Stop persistStop = dao.getStopForId(stopsAdded.get(refStop.getId())); stopsToRemove.add(new AgencyAndId(agencyAndId.getAgencyId(), atisId)); stopTime.setStop(persistStop); _log.info("Duplicate stops keep: {} remove: {} ", persistStop.getId().getId(), atisStop.getId().getId()); continue; atisStop.setName(refStop.getName()); atisStop.setDirection(refStop.getDirection()); atisStop.setId(refStop.getId()); atisStop.setParentStation(refStop.getParentStation()); atisStop.setLocationType(refStop.getLocationType()); stopsAdded.put(atisStop.getId(), new AgencyAndId(agencyAndId.getAgencyId(), atisId));
if (allStopIds.contains(stopTime.getStop().getId().getId())) { duplicateStopIds.add(stopTime.getStop().getId().getId()); allStopIds.add(stopTime.getStop().getId().getId()); for (Stop stop : stops) { mStopIds.add(stop.getId().getId()); mStopToLocationTypeMap.put(stop.getId().getId(), stop.getLocationType()); stopBuilder.pointXY(stop.getLon(), stop.getLat());
private Map<String, Stop> getStopMap(GtfsDao dao) { Map<String, Stop> map = new HashMap<>(); for (Stop stop : dao.getAllStops()) { if (stop.getLocationType() == 0) { map.put(stop.getId().getId(), stop); } } return map; }
atisStop.setName(gtfsStop.getName()); atisStop.setDirection(gtfsStop.getDirection()); atisStop.setId(gtfsStop.getId());
@Override public void run(TransformContext context, GtfsMutableRelationalDao dao) { Map<Route, Route> shuttleRoutes = new HashMap<>(); for (Trip trip : dao.getAllTrips()) { if (trip.getTripHeadsign().endsWith(SHUTTLE_HEADSIGN_SUFFIX)) { Route shuttleRoute = shuttleRoutes.computeIfAbsent(trip.getRoute(), r -> getShuttleRoute(dao, r)); trip.setRoute(shuttleRoute); dao.updateEntity(trip); } } // Shuttle stops share mta_stop_id with non-shuttle version Map<String, String> parentStopByMtaStopId = new HashMap<>(); for (Stop stop : dao.getAllStops()) { if (!stop.getName().endsWith(SHUTTLE_STOP_SUFFIX) && stop.getParentStation() != null) { parentStopByMtaStopId.put(stop.getMtaStopId(), stop.getParentStation()); } } for (Stop stop : dao.getAllStops()) { if (stop.getName().endsWith(SHUTTLE_STOP_SUFFIX)) { String parent = parentStopByMtaStopId.get(stop.getMtaStopId()); if (parent == null) { _log.info("No parent for shuttle stop {}", stop.getId()); } stop.setParentStation(parent); dao.updateEntity(stop); } } }
private Document getStopAsDocument(Stop stop) { Document document = new Document(); // Id AgencyAndId id = stop.getId(); document.add(new Field(FIELD_AGENCY_ID, id.getAgencyId(), Field.Store.YES, Field.Index.NO)); document.add(new Field(FIELD_STOP_ID, id.getId(), Field.Store.YES, Field.Index.ANALYZED)); // Code if (stop.getCode() != null && stop.getCode().length() > 0) document.add(new Field(FIELD_STOP_CODE, stop.getCode(), Field.Store.NO, Field.Index.ANALYZED)); else document.add(new Field(FIELD_STOP_CODE, stop.getId().getId(), Field.Store.NO, Field.Index.ANALYZED)); if (stop.getName() != null && stop.getName().length() > 0) document.add(new Field(FIELD_STOP_NAME, stop.getName(), Field.Store.YES, Field.Index.ANALYZED)); return document; } }
public void generateStopNarratives(NarrativeProviderImpl provider) { Map<AgencyAndId, List<ProjectedPoint>> shapePointCache = new HashMap<AgencyAndId, List<ProjectedPoint>>(); int index = 0; Collection<Stop> allStops = _gtfsDao.getAllStops(); Map<AgencyAndId, Stop> stopsById = MappingLibrary.mapToValue(allStops, "id"); for (StopEntry stopEntry : _transitGraphDao.getAllStops()) { if (index % 10 == 0) _log.info("stops=" + index); index++; Stop stop = stopsById.get(stopEntry.getId()); StopNarrative.Builder narrative = StopNarrative.builder(); narrative.setCode(deduplicate(stop.getCode())); narrative.setDescription(deduplicate(stop.getDesc())); narrative.setName(deduplicate(stop.getName())); narrative.setUrl(deduplicate(stop.getUrl())); String direction = computeStopDirection(provider, shapePointCache, stop, stopEntry); narrative.setDirection(deduplicate(direction)); provider.setNarrativeForStop(stopEntry.getId(), narrative.create()); } }
MTAStationDirection dir = dirByStation.get(st.getStop().getParentStation()); if (dir == null) { _log.debug("Missing station ID = {}", st.getStop().getParentStation()); continue; String stopId = st.getStop().getId().getId(); String direction = stopId.substring(stopId.length() - 1); String headsign = null;
referenceStops.put(stop.getId().getId(), stop); if (stop.getMtaStopId() != null) { if (existingStops.contains(stop.getMtaStopId())) { es.publishMessage(getTopic(), "Agency: " + dao.getAllAgencies().iterator().next().getId() + dao.getAllAgencies().iterator().next().getName() + " has duplicate stop id: " + stop.getMtaStopId()); _log.error("*** MtaStopId {} already exists", stop.getMtaStopId()); stopsToDelete.add(stop); existingStops.add(stop.getMtaStopId()); Stop refStop = referenceStops.get(stop.getMtaStopId()); if (refStop != null) { stop.setName(refStop.getName()); stop.setId(new AgencyAndId(stop.getId().getAgencyId(), stop.getMtaStopId()));