Package org.onebusaway.transit_data_federation.services.transit_graph

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


  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


      /**
       * 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

          + 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

  }

  public static ArrivalAndDepartureTime getScheduledTime(long serviceDate,
      BlockStopTimeEntry blockStopTime, int offset) {

    StopTimeEntry stopTime = blockStopTime.getStopTime();

    long arrivalTime = serviceDate + (stopTime.getArrivalTime() + offset)
        * 1000;
    long departureTime = serviceDate + (stopTime.getDepartureTime() + offset)
        * 1000;

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

    }

    int sequence = stopTimes.size();

    if (!stopTimes.isEmpty()) {
      StopTimeEntry prev = stopTimes.get(stopTimes.size() - 1);
      stopTime.setAccumulatedSlackTime(prev.getAccumulatedSlackTime()
          + prev.getSlackTime());
    }

    stopTimes.add(stopTime);
    stopTime.setTrip(trip);
    stopTime.setSequence(sequence);
View Full Code Here

      throws DistanceAlongShapeException {

    int stIndex = 0;
    for (List<PointAndIndex> assignments : possibleAssignments) {
      if (assignments.isEmpty()) {
        StopTimeEntry stopTime = stopTimes.get(stIndex);
        throw new InvalidStopToShapeMappingException(stopTime.getTrip());
      }
      Min<PointAndIndex> m = new Min<PointAndIndex>();
      for (PointAndIndex pindex : assignments)
        m.add(pindex.distanceFromTarget, pindex);
      if (m.getMinValue() > _maxDistanceFromStopToShapePoint) {
        StopTimeEntry stopTime = stopTimes.get(stIndex);
        PointAndIndex pindex = m.getMinElement();
        CoordinatePoint point = shapePoints.getPointForIndex(pindex.index);
        throw new StopIsTooFarFromShapeException(stopTime, pindex, point);
      }
      stIndex++;
View Full Code Here

    BlockTripEntry blockTrip = blockStopTime.getTrip();
    TripEntry trip = blockTrip.getTrip();
    AgencyAndId tripId = trip.getId();
    AgencyAndId lineId = trip.getRouteCollection().getId();
    String directionId = trip.getDirectionId();
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    StopEntry stop = stopTime.getStop();
    AgencyAndId stopId = stop.getId();

    Set<AgencyAndId> serviceAlertIds = new HashSet<AgencyAndId>();
    /*
     * TODO: Temporarily disable
View Full Code Here

    List<BlockTripEntry> trips = blockIndex.getTrips();

    for (BlockTripEntry trip : trips) {

      BlockStopTimeEntry blockStopTime = trip.getStopTimes().get(blockSequence);
      StopTimeEntry stopTime = blockStopTime.getStopTime();

      serviceInterval = ServiceInterval.extend(serviceInterval,
          stopTime.getArrivalTime(), stopTime.getDepartureTime());
    }

    return serviceInterval;
  }
View Full Code Here

      int maxBlockSequence = Math.min(obaState.getMaxBlockSequence(),
          stopTimes.size());

      BlockStopTimeEntry blockStopTime = instance.getBlockStopTime();
      int sequence = blockStopTime.getBlockSequence();
      StopTimeEntry origStopTime = blockStopTime.getStopTime();

      double minTime = Double.POSITIVE_INFINITY;

      while (sequence < maxBlockSequence) {

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

        double d = SphericalGeometryLibrary.distance(stop.getStopLat(),
            stop.getStopLon(), target.getY(), target.getX());

        double transitTime = Math.max(0, stopTime.getArrivalTime()
            - origStopTime.getDepartureTime());
        double walkingTime = d / _options.speed;
        minTime = Math.min(minTime, transitTime + walkingTime);

        sequence++;
View Full Code Here

    if (fromStopTimeInstance == null)
      return;

    BlockStopTimeEntry bstFrom = fromStopTimeInstance.getBlockStopTime();

    StopTimeEntry fromStopTime = bstFrom.getStopTime();
    StopTimeNarrative stopTimeNarrative = _narrativeService.getStopTimeForEntry(fromStopTime);
    transitLeg.setRouteShortName(stopTimeNarrative.getRouteShortName());
    transitLeg.setTripHeadsign(stopTimeNarrative.getStopHeadsign());

    StopEntry fromStop = fromStopTimeInstance.getStop();
    StopBean fromStopBean = _stopBeanService.getStopForId(fromStop.getId());
    transitLeg.setFromStop(fromStopBean);

    transitLeg.setFromStopSequence(fromStopTime.getSequence());

    leg.setFrom(fromStop.getStopLocation());

    BlockLocation blockLocation = fromStopTimeInstance.getBlockLocation();
    if (blockLocation != null) {
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.