Package org.onebusaway.transit_data_federation.services.transit_graph

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


        for (BlockStopTimeEntry blockStopTime : stopTimes) {

          if (prevBlockStopTime != null) {

            StopTimeEntry from = prevBlockStopTime.getStopTime();
            StopTimeEntry to = blockStopTime.getStopTime();
            int time = to.getArrivalTime() - from.getDepartureTime();

            StopEntry stopFrom = from.getStop();
            StopEntry stopTo = to.getStop();

            Pair<StopEntry> stopPair = Tuples.pair(stopFrom, stopTo);

            Integer prevTime = minTravelTimes.get(stopPair);
            if (prevTime == null || time < prevTime)
View Full Code Here


    StopEntry toStop = toStopTimeInstance.getStop();
    StopBean toStopBean = _stopBeanService.getStopForId(toStop.getId());
    transitLeg.setToStop(toStopBean);

    BlockStopTimeEntry blockStopTime = toStopTimeInstance.getBlockStopTime();
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    transitLeg.setToStopSequence(stopTime.getSequence());

    leg.setTo(toStop.getStopLocation());

    BlockLocation blockLocation = toStopTimeInstance.getBlockLocation();
    if (blockLocation != null) {
View Full Code Here

    return totalBlockDistance;
  }

  @Override
  public int getArrivalTimeForIndex(int index) {
    StopTimeEntry stopTime = getStopTimeForIndex(index);
    return stopTime.getArrivalTime();
  }
View Full Code Here

    return stopTime.getArrivalTime();
  }

  @Override
  public int getDepartureTimeForIndex(int index) {
    StopTimeEntry stopTime = getStopTimeForIndex(index);
    return stopTime.getDepartureTime();
  }
View Full Code Here

    List<BlockSequence> sequences = _index.getSequences();
    BlockStopTimeEntry fromBst = sequences.get(0).getStopTimes().get(stopIndex);
    BlockStopTimeEntry toBst = sequences.get(sequences.size() - 1).getStopTimes().get(
        stopIndex);

    StopTimeEntry fromSt = fromBst.getStopTime();
    StopTimeEntry toSt = toBst.getStopTime();

    return new ServiceInterval(fromSt.getArrivalTime(),
        fromSt.getDepartureTime(), toSt.getArrivalTime(),
        toSt.getDepartureTime());
  }
View Full Code Here

    for (T entry : entries) {

      ServiceInterval interval = null;

      List<BlockStopTimeEntry> stopTimes = entry.getStopTimes();
      StopTimeEntry first = stopTimes.get(0).getStopTime();
      StopTimeEntry last = stopTimes.get(stopTimes.size() - 1).getStopTime();
      interval = extend(interval, first);
      interval = extend(interval, last);

      minArrivals[index] = interval.getMinArrival();
      minDepartures[index] = interval.getMinDeparture();
View Full Code Here

  public static int computeSlackToNextStop(
      ScheduledBlockLocation scheduledBlockLocation) {

    BlockStopTimeEntry nextStop = scheduledBlockLocation.getNextStop();
    StopTimeEntry stopTime = nextStop.getStopTime();
    int t = scheduledBlockLocation.getScheduledTime();

    /**
     * If we are actually at the next stop already, we return a negative value:
     * the amount of slack time already consumed.
     */
    if (stopTime.getArrivalTime() <= t && t <= stopTime.getDepartureTime())
      return stopTime.getArrivalTime() - t;

    int sequence = nextStop.getBlockSequence();

    /**
     * Are we before the first stop in the block? Are we already at the stop or
     * on our way there? Not sure, for now, let's assume there is no slack to be
     * had
     */
    if (sequence == 0)
      return 0;

    BlockConfigurationEntry blockConfig = nextStop.getTrip().getBlockConfiguration();
    BlockStopTimeEntry previousStop = blockConfig.getStopTimes().get(
        sequence - 1);

    int slack = nextStop.getAccumulatedSlackTime()
        - previousStop.getAccumulatedSlackTime();
    slack -= previousStop.getStopTime().getSlackTime();

    int timeToNextStop = stopTime.getArrivalTime() - t;

    if (timeToNextStop > slack)
      return slack;
    else
      return timeToNextStop;
View Full Code Here

      BlockStopTimeEntry blockStopTime) {

    BlockTripEntry blockTrip = blockStopTime.getTrip();
    BlockConfigurationEntry blockConfig = blockTrip.getBlockConfiguration();

    StopTimeEntry stopTime = blockStopTime.getStopTime();
    StopEntry stop = stopTime.getStop();

    return new BlockStopTimeKey(blockConfig.getServiceIds(), stop.getId());
  }
View Full Code Here

    ServiceInterval interval = null;

    for (int i = 0; i < n; i++) {
      BlockStopTimeEntry blockStopTime = group.get(i);
      StopTimeEntry stopTime = blockStopTime.getStopTime();
      blockConfigs.add(blockStopTime.getTrip().getBlockConfiguration());
      stopIndices[i] = blockStopTime.getBlockSequence();
      interval = ServiceInterval.extend(interval, stopTime.getArrivalTime(),
          stopTime.getDepartureTime());
    }

    return new BlockStopTimeIndex(blockConfigs, stopIndices, interval);
  }
View Full Code Here

    if (prevTrip == null)
      throw new IllegalStateException(
          "blockTrip had no incoming trip, thus no layover");
    List<BlockStopTimeEntry> stopTimes = prevTrip.getStopTimes();
    BlockStopTimeEntry blockStopTime = stopTimes.get(stopTimes.size() - 1);
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    return stopTime.getDepartureTime();
  }
View Full Code Here

TOP

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

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.