Package org.onebusaway.transit_data.model

Examples of org.onebusaway.transit_data.model.StopsForRouteBean


    Mockito.when(_shapeBeanService.getMergedPolylinesForShapeIds(shapeIds)).thenReturn(
        Arrays.asList(polyline));

    // Setup complete

    StopsForRouteBean stopsForRoute = _service.getStopsForRoute(routeId);

    List<StopBean> stops = stopsForRoute.getStops();
    assertEquals(3, stops.size());
    assertSame(stopBeanA, stops.get(0));
    assertSame(stopBeanB, stops.get(1));
    assertSame(stopBeanC, stops.get(2));

    List<EncodedPolylineBean> polylines = stopsForRoute.getPolylines();
    assertEquals(1, polylines.size());
    assertSame(polyline, polylines.get(0));

    List<StopGroupingBean> groupings = stopsForRoute.getStopGroupings();
    assertEquals(1, groupings.size());
    StopGroupingBean grouping = groupings.get(0);
    assertEquals("direction", grouping.getType());

    List<StopGroupBean> groups = grouping.getStopGroups();
View Full Code Here


  }

  private StopsForRouteBean getStopsForRouteCollectionAndNarrative(
      RouteCollectionEntry routeCollection, RouteCollectionNarrative narrative) {

    StopsForRouteBean result = new StopsForRouteBean();

    AgencyAndId routeCollectionId = routeCollection.getId();
    result.setRoute(getRouteBeanForRouteCollection(routeCollectionId, narrative));
    result.setStops(getStopBeansForRoute(routeCollectionId));

    result.setPolylines(getEncodedPolylinesForRoute(routeCollection));

    StopGroupingBean directionGrouping = new StopGroupingBean();
    directionGrouping.setType(TransitDataConstants.STOP_GROUPING_TYPE_DIRECTION);
    List<StopGroupBean> directionGroups = new ArrayList<StopGroupBean>();
    directionGrouping.setStopGroups(directionGroups);
    directionGrouping.setOrdered(true);
    result.addGrouping(directionGrouping);

    List<BlockTripIndex> blockIndices = _blockIndexService.getBlockTripIndicesForRouteCollectionId(routeCollectionId);
    List<FrequencyBlockTripIndex> frequencyBlockIndices = _blockIndexService.getFrequencyBlockTripIndicesForRouteCollectionId(routeCollectionId);

    List<BlockTripEntry> blockTrips = new ArrayList<BlockTripEntry>();
View Full Code Here

  public DefaultHttpHeaders show() throws ServiceException {

    if (hasErrors())
      return setValidationErrorsResponse();

    StopsForRouteBean result = _service.getStopsForRoute(_id);

    if (result == null)
      return setResourceNotFoundResponse();

    if (isVersion(V1)) {
View Full Code Here

  }

  @Override
  public String execute() throws Exception {

    StopsForRouteBean stopsForRoute = _transitDataService.getStopsForRoute(_route.getId());
    List<Integer> selectionIndices = Collections.emptyList();
    StopSelectionBean selection = _stopSelectionService.getSelectedStops(
        stopsForRoute, selectionIndices);
    List<NameBean> names = new ArrayList<NameBean>(selection.getNames());
View Full Code Here

    if (_id == null || _id.length() == 0)
      return INPUT;

    _route = _transitDataService.getRouteForId(_id);
    StopsForRouteBean stopsForRoute = _transitDataService.getStopsForRoute(_id);

    Map<String, StopGroupingBean> groupingsByType = MappingLibrary.mapToValue(
        stopsForRoute.getStopGroupings(), "type", String.class);
    StopGroupingBean byDirection = groupingsByType.get(TransitDataConstants.STOP_GROUPING_TYPE_DIRECTION);

    if (_groupIndex == -1) {
      if (byDirection != null) {
        for (StopGroupBean group : byDirection.getStopGroups())
          _directionNames.add(group.getName());
      }
      _stops = stopsForRoute.getStops();
      Collections.sort(_stops, _stopNameComparator);
    } else {
      if (byDirection == null)
        return INPUT;
      List<StopGroupBean> groups = byDirection.getStopGroups();
      if (_groupIndex < 0 && groups.size() <= _groupIndex)
        return INPUT;
      Map<String, StopBean> stopById = MappingLibrary.mapToValue(
          stopsForRoute.getStops(), "id", String.class);

      StopGroupBean stopGroup = groups.get(_groupIndex);
      _stops = new ArrayList<StopBean>();
      for (String stopId : stopGroup.getStopIds())
        _stops.add(stopById.get(stopId));
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data.model.StopsForRouteBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.