Package org.onebusaway.transit_data_federation.services.transit_graph

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


  }
 
  public static int getLayoverEndTimeForTrip(BlockTripEntry blockTrip) {
    List<BlockStopTimeEntry> stopTimes = blockTrip.getStopTimes();
    BlockStopTimeEntry blockStopTime = stopTimes.get(0);
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    return stopTime.getArrivalTime();
  }
View Full Code Here


    pab.setServiceDate(instance.getServiceDate());

    BlockStopTimeEntry blockStopTime = instance.getBlockStopTime();
    BlockTripEntry blockTrip = blockStopTime.getTrip();
    BlockConfigurationEntry blockConfig = blockTrip.getBlockConfiguration();
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    StopEntry stop = stopTime.getStop();
    TripEntry trip = stopTime.getTrip();

    TripBean tripBean = _tripBeanService.getTripForId(trip.getId());
    pab.setTrip(tripBean);
    pab.setBlockTripSequence(blockTrip.getSequence());

    pab.setArrivalEnabled(blockStopTime.getBlockSequence() > 0);
    pab.setDepartureEnabled(blockStopTime.getBlockSequence() + 1 < blockConfig.getStopTimes().size());

    StopTimeNarrative stopTimeNarrative = _narrativeService.getStopTimeForEntry(stopTime);
    pab.setRouteShortName(stopTimeNarrative.getRouteShortName());
    pab.setTripHeadsign(stopTimeNarrative.getStopHeadsign());

    StopBean stopBean = stopBeanCache.get(stop.getId());

    if (stopBean == null) {
      stopBean = _stopBeanService.getStopForId(stop.getId());
      stopBeanCache.put(stop.getId(), stopBean);
    }

    pab.setStop(stopBean);
    pab.setStopSequence(stopTime.getSequence());

    pab.setStatus("default");

    pab.setScheduledArrivalTime(instance.getScheduledArrivalTime());
    pab.setScheduledDepartureTime(instance.getScheduledDepartureTime());
View Full Code Here

    BlockTripEntry blockTrip = trips.get(tripIndex);
    TripEntry trip = blockTrip.getTrip();

    List<StopTimeEntry> stopTimes = trip.getStopTimes();
    int stopTimeIndex = index - accumulatedStopTimeIndices[tripIndex];
    StopTimeEntry stopTime = stopTimes.get(stopTimeIndex);

    return blockTrip.getDistanceAlongBlock() + stopTime.getShapeDistTraveled();
  }
View Full Code Here

    BlockTripEntry blockTrip = trips.get(tripIndex);
    TripEntry trip = blockTrip.getTrip();

    List<StopTimeEntry> stopTimes = trip.getStopTimes();
    int stopTimeIndex = index - accumulatedStopTimeIndices[tripIndex];
    StopTimeEntry stopTime = stopTimes.get(stopTimeIndex);
    return stopTime;
  }
View Full Code Here

      short accumulatedStopTimeIndex = 0;
      int accumulatedSlackTime = 0;
      double distanceAlongBlock = 0;

      BlockTripEntryImpl prevTrip = null;
      StopTimeEntry prevTripStopTime = null;
      double prevTripAvgVelocity = 0;

      for (short i = 0; i < trips.size(); i++) {

        TripEntry tripEntry = trips.get(i);
        List<StopTimeEntry> stopTimes = tripEntry.getStopTimes();

        /**
         * See if there is any slack time in the schedule in the transition
         * between the two trips. We take the distance between the last stop of
         * the previous trip and the first stop of the next trip, along with the
         * average travel velocity from the previous trip, and compute the
         * estimated travel time. Any time that's left over is slack.
         */
        if (prevTripStopTime != null) {
          StopTimeEntry nextStopTime = stopTimes.get(0);
          int slackTime = nextStopTime.getArrivalTime()
              - prevTripStopTime.getDepartureTime();
          double distance = (distanceAlongBlock - (prevTrip.getDistanceAlongBlock() + prevTripStopTime.getShapeDistTraveled()))
              + nextStopTime.getShapeDistTraveled();
          if (prevTripAvgVelocity > 0) {
            int timeToTravel = (int) (distance / prevTripAvgVelocity);
            slackTime -= Math.min(timeToTravel, slackTime);
          }

View Full Code Here

    private double computeAverageTripTravelVelocity(
        List<StopTimeEntry> stopTimes) {

      int accumulatedTravelTime = 0;
      double accumulatedTravelDistance = 0;
      StopTimeEntry prevStopTime = null;

      for (StopTimeEntry stopTime : stopTimes) {
        if (prevStopTime != null) {
          accumulatedTravelTime += stopTime.getArrivalTime()
              - prevStopTime.getDepartureTime();
          accumulatedTravelDistance += stopTime.getShapeDistTraveled()
              - prevStopTime.getShapeDistTraveled();
        }
        prevStopTime = stopTime;
      }

      if (accumulatedTravelTime == 0)
View Full Code Here

   
    if( history == null)
      return null;

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

    double[] values = getScheduleDeviationsForScheduleTime(history,
        stopTime.getDepartureTime());
    return createHistogramFromValues(values, stepSizeInSeconds);
  }
View Full Code Here

      BlockTripEntry blockTrip = trips.get(tripIndex);
      TripEntry trip = blockTrip.getTrip();

      List<StopTimeEntry> stopTimes = trip.getStopTimes();
      int stopTimeIndex = index - accumulatedStopTimeIndices[tripIndex];
      StopTimeEntry stopTime = stopTimes.get(stopTimeIndex);

      boolean hasNextStop = index + 1 < tripIndices.length;

      return new BlockStopTimeEntryImpl(stopTime, index, blockTrip, hasNextStop);
    }
View Full Code Here

  @Override
  public State traverse(State s0) {

    BlockStopTimeEntry bst = _instance.getBlockStopTime();
    StopTimeEntry stopTime = bst.getStopTime();
    int dwellTime = stopTime.getSlackTime();

    EdgeNarrative narrative = createNarrative(s0);
    StateEditor edit = s0.edit(this, narrative);
    edit.incrementTimeInSeconds(dwellTime);
    edit.incrementWeight(dwellTime);
View Full Code Here

        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

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.