public StopV2Bean getStop(StopBean stop) { StopV2Bean bean = new StopV2Bean(); bean.setCode(stop.getCode()); bean.setDirection(stop.getDirection()); bean.setId(stop.getId()); bean.setLat(stop.getLat()); bean.setLon(stop.getLon()); bean.setLocationType(stop.getLocationType()); bean.setName(stop.getName()); bean.setWheelchairBoarding(stop.getWheelchairBoarding()); List<String> routeIds = new ArrayList<String>(); for (RouteBean route : stop.getRoutes()) { routeIds.add(route.getId()); addToReferences(route); } bean.setRouteIds(routeIds); return bean; }
private void fillStopBean(StopEntry stop, StopNarrative narrative, StopBean bean) { bean.setId(ApplicationBeanLibrary.getId(stop.getId())); bean.setLat(stop.getStopLat()); bean.setLon(stop.getStopLon()); bean.setName(narrative.getName()); bean.setCode(StringLibrary.getBestName(narrative.getCode(), stop.getId().getId())); bean.setLocationType(narrative.getLocationType()); bean.setDirection(narrative.getDirection()); bean.setWheelchairBoarding(stop.getWheelchairBoarding()); }
@Override public int compare(StopBean o1, StopBean o2) { double d1 = SphericalGeometryLibrary.distanceFaster(this.lat, this.lon, o1.getLat(), o1.getLon()); double d2 = SphericalGeometryLibrary.distanceFaster(this.lat, this.lon, o2.getLat(), o2.getLon()); if (d1 < d2) { return -1; } else if (d1 > d2) { return +1; } else { return 0; } } }
private StopSearchResult makeStopSearchResult(StopBean stopBean, Mode m) { ConfigurationBean config = configurationService.getConfiguration(); String stopId = stopBean.getId(); String stopName = stopBean.getName(); String stopDirection = stopBean.getDirection(); List<Double> latLng = Arrays.asList(new Double[] {stopBean.getLat(), stopBean.getLon()}); List<RouteBean> routes = stopBean.getRoutes();
private void groupByStop(StopSelectionTreeBean tree, Iterable<StopBean> stops) { for (StopBean stop : stops) { StopSelectionTreeBean subTree = tree; if (_splitStopNames) { List<NameBean> names = _locationNameSplitStrategy.splitLocationNameIntoParts(stop.getName()); for (NameBean name : names) subTree = subTree.getSubTree(name); } else { NameBean name = new NameBean(SelectionNameTypes.STOP_NAME, stop.getName()); subTree = subTree.getSubTree(name); } // As a last resort, we extend the tree by the stop number (guaranteed to // be unique) String code = stop.getCode() != null ? stop.getCode() : stop.getId(); NameBean name = new NameBean(SelectionNameTypes.STOP_DESCRIPTION, "Stop # " + code); subTree = subTree.getSubTree(name); subTree.setStop(stop); } }
addText(_destinationPronunciation.modify(stop.getName())); String direction = _directionPronunciation.modify(stop.getDirection()); addMessage(Messages.DIRECTION_BOUND, direction); addText(stop.getCode()); arrivalInfoAction.putParam("stopIds", Arrays.asList(stop.getId()));
private void updateCurrentUser() { // Save the last selected stop id _currentUserService.setLastSelectedStopIds(_stopIds); _user = _currentUserService.getCurrentUser(); if (_user == null || !_user.hasDefaultLocation()) { List<StopBean> stops = _result.getStops(); StopBean stop = stops.get(0); _defaultSearchLocationService.setDefaultLocationForCurrentUser( stop.getName(), stop.getLat(), stop.getLon()); } }
@Cacheable public List<AgencyAndId> getNearbyStops( @CacheableArgument(keyProperty = "id") StopBean stopBean, double radius) { CoordinateBounds bounds = SphericalGeometryLibrary.bounds( stopBean.getLat(), stopBean.getLon(), radius); List<AgencyAndId> ids = _geospatialBeanService.getStopsByBounds(bounds); List<AgencyAndId> excludingSource = new ArrayList<AgencyAndId>(); for (AgencyAndId id : ids) { if (!ApplicationBeanLibrary.getId(id).equals(stopBean.getId())) excludingSource.add(id); } return excludingSource; } }
db.beginTransaction(); String sql = "INSERT INTO stop(atco_code, name, locality, bearing, latitude, longitude) VALUES (?,?,?,?,?,?)"; SQLiteStatement stmt = db.compileStatement(sql); for(StopBean stop : stopList){ stmt.bindString(1, stop.getAtco_code()); stmt.bindString(2, stop.getName()); stmt.bindString(3, stop.getLocality(); stmt.bindString(4, stop.getBearing()); stmt.bindDouble(5, stop.getLatitude()); stmt.bindDouble(6, stop.getLongitude()); stmt.execute(); stmt.clearBindings(); } db.setTransactionSuccessful(); db.endTransaction();
private Set<String> getRouteIdsForMatchingRoutes() { StopsWithArrivalsAndDeparturesBean result = _model.getResult(); Set<String> ids = new HashSet<String>(); for (StopBean stop : result.getStops()) { for (RouteBean route : stop.getRoutes()) { if (route.getShortName().equals(_route)) ids.add(route.getId()); } } return ids; } }
String agencyId = AgencyAndIdLibrary.convertFromString(stopBean.getId()).getAgencyId(); if (!_transitDataService.stopHasRevenueService(agencyId, stopBean.getId())) { continue; for (RouteBean route : stopBean.getRoutes()) { if (stopGroup.getStopIds().contains(stopBean.getId())) { if (!routesByDirection.containsKey(directionId)) { routesByDirection.put(directionId,
@Override public String getNameForStops(List<StopBean> stops) { StringBuilder b = new StringBuilder(); for (int i = 0; i < stops.size(); i++) { if (i > 0) { if (i < stops.size() - 1) b.append(", "); else b.append(" and "); } StopBean stop = stops.get(i); b.append(stop.getName()); } return b.toString(); }
@Cacheable public StopBean getStopForId(AgencyAndId id) { Stop stop = _gtfsDao.getStopForId(id); if (stop == null) return null; StopBean sb = new StopBean(); fillStopBean(stop, sb); fillRoutesForStopBean(stop, sb); return sb; }
private void groupByStop(StopSelectionTreeBean tree, Iterable<StopBean> stops) { for (StopBean stop : stops) { StopSelectionTreeBean subTree = tree; if (_splitStopNames) { List<NameBean> names = _locationNameSplitStrategy.splitLocationNameIntoParts(stop.getName()); for (NameBean name : names) subTree = subTree.getSubTree(name); } else { NameBean name = new NameBean(SelectionNameTypes.STOP_NAME, stop.getName()); subTree = subTree.getSubTree(name); } // As a last resort, we extend the tree by the stop number (guaranteed to // be unique) String code = stop.getCode() != null ? stop.getCode() : stop.getId(); NameBean name = new NameBean(SelectionNameTypes.STOP_DESCRIPTION, "Stop # " + code); subTree = subTree.getSubTree(name); subTree.setStop(stop); } }
private void updateCurrentUser() { // Save the last selected stop id _currentUserService.setLastSelectedStopIds(_stopIds); _user = _currentUserService.getCurrentUser(); if (_user == null || !_user.hasDefaultLocation()) { List<StopBean> stops = _result.getStops(); StopBean stop = stops.get(0); _defaultSearchLocationService.setDefaultLocationForCurrentUser( stop.getName(), stop.getLat(), stop.getLon()); } }