private static int getVisitNumber(HashMap<String, Integer> visitNumberForStop, StopBean stop) { int visitNumber; if (visitNumberForStop.containsKey(stop.getId())) { visitNumber = visitNumberForStop.get(stop.getId()) + 1; } else { visitNumber = 1; } visitNumberForStop.put(stop.getId(), visitNumber); return visitNumber; }
private Map<String, StopBean> getStopsById(StopsForRouteBean stopsForRoute) { Map<String, StopBean> stopsById = new HashMap<String, StopBean>(); for (StopBean stop : stopsForRoute.getStops()) stopsById.put(stop.getId(), stop); return stopsById; }
private Map<String, StopBean> getStopsById(StopsForRouteBean stopsForRoute) { Map<String, StopBean> stopsById = new HashMap<String, StopBean>(); for (StopBean stop : stopsForRoute.getStops()) stopsById.put(stop.getId(), stop); return stopsById; }
private String getValueAsString(Object value) { if (value instanceof StopBean) { StopBean stop = (StopBean) value; _factory.addToReferences(stop); return stop.getId(); } else { return value.toString(); } }
public static String getCodeForStop(StopBean stop) { if( stop.getCode() != null) return stop.getCode(); return stop.getId(); } }
public static String getCodeForStop(StopBean stop) { if( stop.getCode() != null) return stop.getCode(); return stop.getId(); } }
public StopItem(StopBean stopBean, List<DistanceAway> distanceAways) { this(idParser.parseIdWithoutAgency(stopBean.getId()), stopBean.getName(), distanceAways); }
@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; } }
@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; } }
public void addToReferences(StopBean stop) { if (!shouldAddReferenceWithId(_references.getStops(), stop.getId())) return; StopV2Bean bean = getStop(stop); _references.addStop(bean); }
public void addToReferences(StopBean stop) { if (!shouldAddReferenceWithId(_references.getStops(), stop.getId())) return; StopV2Bean bean = getStop(stop); _references.addStop(bean); }
private void tryAsStopName(SearchResultCollection results, String q, SearchResultFactory resultFactory){ StopsBean beans =_transitDataService.getStopsByName(q); int count = 0; if (beans == null || beans.getStops() == null) return; for (StopBean stopBean : beans.getStops()) { String agencyId = AgencyAndIdLibrary.convertFromString(stopBean.getId()).getAgencyId(); // filter out stops not in service if (_transitDataService.stopHasRevenueService(agencyId, stopBean.getId())) { // this is a fuzzy match so just a suggestion results.addSuggestion(resultFactory.getStopResult(stopBean, results.getRouteFilter())); count++; } if (count > MAX_STOPS) { break; } } return; }
public LocationV2Bean getLocation(LocationBean location) { LocationV2Bean bean = new LocationV2Bean(); bean.setLocation(location.getLocation()); bean.setName(location.getName()); StopBean stop = location.getStopBean(); if (stop != null) { bean.setStopId(stop.getId()); _factory.addToReferences(stop); } return bean; }
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; }
public StopTimeV2Bean getStopTime(StopTimeBean stopTime) { StopTimeV2Bean bean = new StopTimeV2Bean(); bean.setArrivalTime(stopTime.getArrivalTime()); bean.setDepartureTime(stopTime.getDepartureTime()); bean.setDropOffType(stopTime.getDropOffType()); bean.setPickupType(stopTime.getPickupType()); bean.setStopId(stopTime.getStop().getId()); addToReferences(stopTime.getStop()); return bean; }
public StopTimeV2Bean getStopTime(StopTimeBean stopTime) { StopTimeV2Bean bean = new StopTimeV2Bean(); bean.setArrivalTime(stopTime.getArrivalTime()); bean.setDepartureTime(stopTime.getDepartureTime()); bean.setDropOffType(stopTime.getDropOffType()); bean.setPickupType(stopTime.getPickupType()); bean.setStopId(stopTime.getStop().getId()); addToReferences(stopTime.getStop()); return bean; }
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); } }