Package org.onebusaway.transit_data_federation.services.transit_graph

Examples of org.onebusaway.transit_data_federation.services.transit_graph.StopEntry


    if (stopsFrom == stopsTo)
      return;

    int mid = (stopsFrom + stopsTo) / 2;
    StopEntry stop = stops.get(mid);
    short stopIndex = (short) stop.getIndex();
    int index = Arrays.binarySearch(_stopIndices, stopArrayIndexFrom,
        stopArrayIndexTo, stopIndex);

    int indexLower = -1;
    int indexUpper = -1;
View Full Code Here


      boolean exitAllowed, TransferParent root) {

    if (leafIndex < 0)
      return root;

    StopEntry toStop = _allStops.get(_stopIndices[leafIndex]);
    int leafIndexB = _parentIndices[leafIndex];
    if (leafIndexB < 0)
      throw new IllegalStateException();
    StopEntry fromStop = _allStops.get(_stopIndices[leafIndexB]);
    int leafIndexC = _parentIndices[leafIndexB];

    TransferParent parent = getTransferForLeafIndex(leafIndexC, false, root);

    /**
 
View Full Code Here

    task.setShapePointHelper(shapePointHelper);

    TransitGraphDao transitGraphDao = Mockito.mock(TransitGraphDao.class);
    task.setTransitGraphDao(transitGraphDao);

    StopEntry stopA = stop("stopA", 47.65, -122.32);
    StopEntry stopB = stop("stopB", 47.67, -122.30);

    Mockito.when(transitGraphDao.getAllStops()).thenReturn(
        Arrays.asList(stopA, stopB));

    TripEntryImpl tripA = trip("tripA");
View Full Code Here

    WhereGeospatialServiceImpl service = new WhereGeospatialServiceImpl();

    TransitGraphDao dao = Mockito.mock(TransitGraphDao.class);
    service.setTransitGraphDao(dao);

    StopEntry stopA = stop("a", -0.5, -0.5);
    StopEntry stopB = stop("b", -0.5, 0.5);
    StopEntry stopC = stop("c", 0.5, -0.5);
    StopEntry stopD = stop("d", 0.5, 0.5);
    List<StopEntry> allStops = Arrays.asList(stopA, stopB, stopC, stopD);

    Mockito.when(dao.getAllStops()).thenReturn(allStops);

    service.initialize();

    List<AgencyAndId> stops = service.getStopsByBounds(new CoordinateBounds(-1,
        -1, 0, 0));
    assertEquals(1, stops.size());
    assertTrue(stops.contains(stopA.getId()));

    stops = service.getStopsByBounds(new CoordinateBounds(0, -1, 1, 0));
    assertEquals(1, stops.size());
    assertTrue(stops.contains(stopC.getId()));

    stops = service.getStopsByBounds(new CoordinateBounds(-1, -1, 1, 0));
    assertEquals(2, stops.size());
    assertTrue(stops.contains(stopA.getId()));
    assertTrue(stops.contains(stopC.getId()));

    stops = service.getStopsByBounds(new CoordinateBounds(-1, -1, 1, 1));
    assertEquals(4, stops.size());
    assertTrue(stops.contains(stopA.getId()));
    assertTrue(stops.contains(stopB.getId()));
    assertTrue(stops.contains(stopC.getId()));
    assertTrue(stops.contains(stopD.getId()));

    stops = service.getStopsByBounds(new CoordinateBounds(0.8, 0.8, 1, 1));
    assertEquals(0, stops.size());
  }
View Full Code Here

          if (stopId == null || predictedTime == 0)
            continue;

          for (BlockStopTimeEntry blockStopTime : blockConfig.getStopTimes()) {
            StopTimeEntry stopTime = blockStopTime.getStopTime();
            StopEntry stop = stopTime.getStop();
            if (stopId.equals(stop.getId())) {
              int arrivalTime = stopTime.getArrivalTime();
              int deviation = (int) ((tpr.getTimepointPredictedTime() - blockInstance.getServiceDate()) / 1000 - arrivalTime);
              scheduleDeviations.put(arrivalTime, (double) deviation);
            }
          }
View Full Code Here

      bean.setTrip(_tripBeanService.getTripForId(tripId));
    }

    if (tripId != null && stopId != null) {
      TripEntry trip = _graph.getTripEntryForId(tripId);
      StopEntry stop = _graph.getStopEntryForId(stopId);
      if (trip != null && stop != null) {

        AgencyAndId vehicleId = record.getMatchedVehicleId();
        if (vehicleId == null)
          vehicleId = record.getVehicleId();
View Full Code Here

  @Override
  public ArrivalAndDepartureInstance getArrivalAndDepartureForStop(
      ArrivalAndDepartureQuery query) {

    StopEntry stop = query.getStop();
    int stopSequence = query.getStopSequence();
    TripEntry trip = query.getTrip();
    long serviceDate = query.getServiceDate();
    AgencyAndId vehicleId = query.getVehicleId();
    long time = query.getTime();

    Map<BlockInstance, List<BlockLocation>> locationsByInstance = _blockStatusService.getBlocks(
        trip.getBlock().getId(), serviceDate, vehicleId, time);

    if (locationsByInstance.isEmpty())
      return null;

    Map.Entry<BlockInstance, List<BlockLocation>> entry = locationsByInstance.entrySet().iterator().next();

    BlockInstance blockInstance = entry.getKey();
    List<BlockLocation> locations = entry.getValue();

    int timeOfServiceDate = (int) ((time - serviceDate) / 1000);

    ArrivalAndDepartureInstance instance = createArrivalAndDeparture(
        blockInstance, trip.getId(), stop.getId(), stopSequence, serviceDate,
        timeOfServiceDate, time);

    if (!locations.isEmpty()) {

      /**
 
View Full Code Here

        return null;

      BlockStopTimeEntry nextBlockStopTime = stopTimes.get(index);

      StopTimeEntry nextStopTime = nextBlockStopTime.getStopTime();
      StopEntry nextStop = nextStopTime.getStop();

      List<StopTransfer> transfers = _stopTransferService.getTransfersFromStop(nextStop);

      if (!transfers.isEmpty()) {
        InstanceState state = instance.getStopTimeInstance().getState();
View Full Code Here

  private boolean isMatch(List<StopTimeEntry> stopTimes, AgencyAndId stopId,
      int index) {
    if (index < 0 || index >= stopTimes.size())
      return false;
    StopTimeEntry stopTime = stopTimes.get(index);
    StopEntry stop = stopTime.getStop();
    return stop.getId().equals(stopId);
  }
View Full Code Here

    BlockConfigurationEntry blockConfig = first.getBlockConfig();
    BlockEntry block = blockConfig.getBlock();
    List<BlockStopTimeEntry> bsts = first.getStopTimes();
    BlockStopTimeEntry firstBst = bsts.get(0);
    BlockStopTimeEntry lastBst = bsts.get(bsts.size() - 1);
    StopEntry fromStop = firstBst.getStopTime().getStop();
    StopEntry toStop = lastBst.getStopTime().getStop();
    return "BlockSequenceIndex [ex: block=" + block.getId() + " fromStop="
        + fromStop.getId() + " toStop=" + toStop.getId() + " serviceIds="
        + getServiceIds() + "]";
  }
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.transit_graph.StopEntry

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.