private String getName(StopGroupBean bean) { StringBuilder b = new StringBuilder(); for (String name : bean.getName().getNames()) b.append(name); return b.toString(); } });
private String getName(StopGroupBean bean) { StringBuilder b = new StringBuilder(); for (String name : bean.getName().getNames()) b.append(name); return b.toString(); } });
private void groupByDirection(StopSelectionTreeBean tree, StopsForRouteBean stopsForRoute, StopGroupingBean byDirection, Map<String, StopBean> stopsById) { List<StopGroupBean> groups = byDirection.getStopGroups(); if (groups.isEmpty()) { groupByStop(tree, stopsForRoute.getStops()); return; } for (StopGroupBean group : groups) { StopSelectionTreeBean subTree = tree.getSubTree(group.getName()); List<StopBean> stops = new ArrayList<StopBean>(); for (String stopId : group.getStopIds()) stops.add(stopsById.get(stopId)); groupByStop(subTree, stops); } }
private void groupByDirection(StopSelectionTreeBean tree, StopsForRouteBean stopsForRoute, StopGroupingBean byDirection, Map<String, StopBean> stopsById) { List<StopGroupBean> groups = byDirection.getStopGroups(); if (groups.isEmpty()) { groupByStop(tree, stopsForRoute.getStops()); return; } for (StopGroupBean group : groups) { StopSelectionTreeBean subTree = tree.getSubTree(group.getName()); List<StopBean> stops = new ArrayList<StopBean>(); for (String stopId : group.getStopIds()) stops.add(stopsById.get(stopId)); groupByStop(subTree, stops); } }
private Map<String, List<StopBean>> createDirectionToStopBeansMap(String routeId) { Map<String, List<StopBean>> directionIdToStopBeans = new HashMap<String, List<StopBean>>(); StopsForRouteBean stopsForRoute = transitService.getStopsForRoute(routeId); List<StopBean> stopBeansList = stopsForRoute.getStops(); List<StopGroupingBean> stopGroupings = stopsForRoute.getStopGroupings(); for (StopGroupingBean stopGroupingBean : stopGroupings) { List<StopGroupBean> stopGroups = stopGroupingBean.getStopGroups(); for (StopGroupBean stopGroupBean : stopGroups) { NameBean name = stopGroupBean.getName(); String type = name.getType(); if (!type.equals("destination")) continue; List<StopBean> stopsForDirection = new ArrayList<StopBean>(); String directionId = stopGroupBean.getId(); Set<String> stopIds = new HashSet<String>(stopGroupBean.getStopIds()); for (StopBean stopBean : stopBeansList) { String stopBeanId = stopBean.getId(); if (stopIds.contains(stopBeanId)) stopsForDirection.add(stopBean); } directionIdToStopBeans.put(directionId, stopsForDirection); } } return directionIdToStopBeans; }