Package org.onebusaway.transit_data_federation.services.transit_graph

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


  @Override
  public ArrivalAndDepartureInstance getNextStopArrivalAndDeparture(
      ArrivalAndDepartureInstance instance) {

    BlockStopTimeEntry stopTime = instance.getBlockStopTime();
    BlockTripEntry trip = stopTime.getTrip();
    BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();
    List<BlockStopTimeEntry> stopTimes = blockConfig.getStopTimes();

    int index = stopTime.getBlockSequence() + 1;
    if (index >= stopTimes.size())
      return null;

    BlockStopTimeEntry nextStopTime = stopTimes.get(index);
    InstanceState state = instance.getStopTimeInstance().getState();

    ArrivalAndDepartureTime scheduledTime = ArrivalAndDepartureTime.getScheduledTime(
        state, nextStopTime);

    if (state.getFrequency() != null) {

      StopTimeEntry nStopTime = nextStopTime.getStopTime();

      int betweenStopDelta = nStopTime.getArrivalTime()
          - stopTime.getStopTime().getDepartureTime();
      int atStopDelta = nStopTime.getDepartureTime()
          - nStopTime.getArrivalTime();
View Full Code Here


  @Override
  public ArrivalAndDepartureInstance getNextTransferStopArrivalAndDeparture(
      ArrivalAndDepartureInstance instance) {

    BlockStopTimeEntry blockStopTime = instance.getBlockStopTime();
    BlockTripEntry trip = blockStopTime.getTrip();
    BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();
    List<BlockStopTimeEntry> stopTimes = blockConfig.getStopTimes();

    int index = blockStopTime.getBlockSequence() + 1;

    while (true) {

      if (index >= stopTimes.size())
        return null;

      BlockStopTimeEntry nextBlockStopTime = stopTimes.get(index);

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

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

      if (!transfers.isEmpty()) {
View Full Code Here

    Map<BlockInstance, List<StopTimeInstance>> r = new FactoryMap<BlockInstance, List<StopTimeInstance>>(
        new ArrayList<StopTimeInstance>());

    for (StopTimeInstance stopTime : stopTimes) {
      BlockStopTimeEntry blockStopTime = stopTime.getStopTime();
      BlockTripEntry blockTrip = blockStopTime.getTrip();
      BlockConfigurationEntry blockConfiguration = blockTrip.getBlockConfiguration();
      long serviceDate = stopTime.getServiceDate();
      BlockInstance blockInstance = new BlockInstance(blockConfiguration,
          serviceDate, stopTime.getFrequency());
      r.get(blockInstance).add(stopTime);
View Full Code Here

  private void setPredictedTimesFromScheduleDeviation(
      ArrivalAndDepartureInstance instance, BlockLocation blockLocation,
      int scheduleDeviation, long targetTime) {

    BlockStopTimeEntry blockStopTime = instance.getBlockStopTime();

    int effectiveScheduleTime = (int) (((targetTime - instance.getServiceDate()) / 1000) - scheduleDeviation);

    int arrivalDeviation = calculateArrivalDeviation(
        blockLocation.getNextStop(), blockStopTime, effectiveScheduleTime,
View Full Code Here

  private TimeIntervalBean computePredictedArrivalTimeInterval(
      ArrivalAndDepartureInstance instance, BlockLocation blockLocation,
      long targetTime) {

    BlockStopTimeEntry blockStopTime = instance.getBlockStopTime();
    StopTimeEntry stopTime = blockStopTime.getStopTime();

    // If the vehicle has already passed the stop, then there is no prediction
    // interval
    if (stopTime.getArrivalTime() <= blockLocation.getEffectiveScheduleTime())
      return null;
View Full Code Here

  private TimeIntervalBean computePredictedDepartureTimeInterval(
      ArrivalAndDepartureInstance instance, BlockLocation blockLocation,
      long targetTime) {

    BlockStopTimeEntry blockStopTime = instance.getBlockStopTime();
    StopTimeEntry stopTime = blockStopTime.getStopTime();

    // If the vehicle has already passed the stop, then there is no prediction
    // interval
    if (stopTime.getDepartureTime() <= blockLocation.getEffectiveScheduleTime())
      return null;
View Full Code Here

        blockInstance, tripId);

    if (blockTripInstance == null)
      return null;

    BlockStopTimeEntry blockStopTime = getBlockStopTime(blockTripInstance,
        stopId, stopSequence, timeOfServiceDate);
    StopTimeInstance stopTimeInstance = new StopTimeInstance(blockStopTime,
        blockTripInstance.getState());

    return createArrivalAndDeparture(stopTimeInstance, prevFrequencyTime,
View Full Code Here

      /**
       * We need to make sure the arrival time is adjusted relative to the
       * departure time and the layover at the stop.
       */
      BlockStopTimeEntry blockStopTime = stopTimeInstance.getStopTime();
      StopTimeEntry stopTime = blockStopTime.getStopTime();
      int delta = stopTime.getDepartureTime() - stopTime.getArrivalTime();

      long arrivalTime = departureTime - delta * 1000;

      return new ArrivalAndDepartureTime(arrivalTime, departureTime);
View Full Code Here

    BlockSequence first = _sequences.get(0);
    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

    } else {
      _log.warn("no active block trip for block location: blockInstance="
          + blockLocation.getBlockInstance() + " time=" + time);
    }

    BlockStopTimeEntry closestStop = blockLocation.getClosestStop();
    if (closestStop != null) {
      StopTimeEntry stopTime = closestStop.getStopTime();
      StopBean stopBean = _stopBeanService.getStopForId(stopTime.getStop().getId());
      bean.setClosestStop(stopBean);
      bean.setClosestStopTimeOffset(blockLocation.getClosestStopTimeOffset());
    }

    BlockStopTimeEntry nextStop = blockLocation.getNextStop();
    if (nextStop != null) {
      StopTimeEntry stopTime = nextStop.getStopTime();
      StopBean stopBean = _stopBeanService.getStopForId(stopTime.getStop().getId());
      bean.setNextStop(stopBean);
      bean.setNextStopTimeOffset(blockLocation.getNextStopTimeOffset());
      bean.setNextStopDistanceFromVehicle(blockLocation.getNextStop().getDistanceAlongBlock()
          - blockLocation.getDistanceAlongBlock());
    }
   
    BlockStopTimeEntry previousStop = blockLocation.getPreviousStop();
    if (previousStop != null) {
      StopTimeEntry stopTime = previousStop.getStopTime();
      StopBean stopBean = _stopBeanService.getStopForId(stopTime.getStop().getId());
      bean.setPreviousStop(stopBean);
      bean.setPreviousStopTimeOffset(blockLocation.getPreviousStopTimeOffset());
      bean.setPreviousStopDistanceFromVehicle(blockLocation.getPreviousStop().getDistanceAlongBlock()
          - blockLocation.getDistanceAlongBlock());
View Full Code Here

TOP

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

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.