Examples of TripEntry


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

  private BlockDescriptor getTripDescriptorAsBlockDescriptor(MonitoredResult result,
      TripDescriptor trip, boolean includeVehicleIds) {
    if (!trip.hasTripId()) {
      return null;
    }
    TripEntry tripEntry = _entitySource.getTrip(trip.getTripId());
    if (tripEntry == null) {
      if (result != null) {
        _log.debug("reporting unmatched trip with id=" + trip.getTripId());
        result.addUnmatchedTripId(trip.getTripId());
      } else {
        _log.warn("no trip found with id=" + trip.getTripId());
      }
     
      return null;
    }
    BlockEntry block = tripEntry.getBlock();
    BlockDescriptor blockDescriptor = new BlockDescriptor();
    blockDescriptor.setBlockEntry(block);
    if (trip.hasStartDate())
      blockDescriptor.setStartDate(trip.getStartDate());
    if (trip.hasStartTime())
View Full Code Here

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

    int currentTime = (int) ((t - instance.getServiceDate()) / 1000);
    BestScheduleDeviation best = new BestScheduleDeviation();

    for (BlockTripEntry blockTrip : blockTrips) {
      TripEntry trip = blockTrip.getTrip();
      AgencyAndId tripId = trip.getId();
      List<TripUpdate> updatesForTrip = tripUpdatesByTripId.get(tripId.getId());
      if (updatesForTrip != null) {
        for (TripUpdate tripUpdate : updatesForTrip) {

          if (tripUpdate.hasExtension(GtfsRealtimeOneBusAway.obaTripUpdate)) {
View Full Code Here

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

      Set<AgencyAndId> shapeIdsForIndex = new HashSet<AgencyAndId>();

      for (BlockSequence sequence : index.getSequences()) {
        for (BlockStopTimeEntry bst : sequence.getStopTimes()) {
          BlockTripEntry blockTrip = bst.getTrip();
          TripEntry trip = blockTrip.getTrip();
          AgencyAndId shapeId = trip.getShapeId();
          if (shapeId != null)
            shapeIdsForIndex.add(shapeId);
        }
      }
View Full Code Here

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

    return ServiceAlertLibrary.id(id);
  }

  public Id getTripId(String tripId) {

    TripEntry trip = getTrip(tripId);
    if (trip != null)
      return ServiceAlertLibrary.id(trip.getId());

    _log.warn("trip not found with id \"{}\"", tripId);

    AgencyAndId id = new AgencyAndId(_agencyIds.get(0), tripId);
    return ServiceAlertLibrary.id(id);
View Full Code Here

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

  public TripEntry getTrip(String tripId) {

    for (String agencyId : _agencyIds) {
      AgencyAndId id = new AgencyAndId(agencyId, tripId);
      TripEntry trip = _transitGraphDao.getTripEntryForId(id);
      if (trip != null)
        return trip;
    }

    try {
      AgencyAndId id = AgencyAndId.convertFromString(tripId);
      TripEntry trip = _transitGraphDao.getTripEntryForId(id);
      if (trip != null)
        return trip;
    } catch (IllegalArgumentException ex) {

    }
View Full Code Here

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

        continue;

      // No matter what our active trip is, we let our current trip be the the
      // trip of our next stop
      BlockTripEntry activeBlockTrip = nextBlockStop.getTrip();
      TripEntry activeTrip = activeBlockTrip.getTrip();
      StopTimeEntry nextStopTime = nextBlockStop.getStopTime();
      StopEntry stop = nextStopTime.getStop();

      TripUpdate.Builder tripUpdate = TripUpdate.newBuilder();

      StopTimeUpdate.Builder stopTimeUpdate = StopTimeUpdate.newBuilder();
      stopTimeUpdate.setStopId(AgencyAndId.convertToString(stop.getId()));
      stopTimeUpdate.setStopSequence(nextStopTime.getSequence());
      stopTimeUpdate.setScheduleRelationship(com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeUpdate.ScheduleRelationship.SCHEDULED);
      tripUpdate.addStopTimeUpdate(stopTimeUpdate);

      StopTimeEvent.Builder stopTimeEvent = StopTimeEvent.newBuilder();
      stopTimeEvent.setDelay((int) activeBlock.getScheduleDeviation());
      stopTimeUpdate.setDeparture(stopTimeEvent);

      AgencyAndId routeId = activeTrip.getRouteCollection().getId();
      AgencyAndId tripId = activeTrip.getId();
      BlockInstance blockInstance = activeBlock.getBlockInstance();
      String startDate = String.format("%1$ty%1$tm%1$td", new Date(
          blockInstance.getServiceDate()));

      TripDescriptor.Builder tripDescriptor = TripDescriptor.newBuilder();
View Full Code Here

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

  private PointAndOrientation getLocationAlongShape(
      BlockTripEntry activeBlockTrip, double distanceAlongBlock,
      int shapePointIndexFrom, int shapePointIndexTo) {

    TripEntry activeTrip = activeBlockTrip.getTrip();
    AgencyAndId shapeId = activeTrip.getShapeId();

    if (shapeId == null)
      return null;

    ShapePoints shapePoints = _shapePointService.getShapePointsForShapeId(shapeId);
View Full Code Here

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

        }

        distanceTraveledSet = true;
      } catch (StopIsTooFarFromShapeException ex) {
        StopTimeEntry stopTime = ex.getStopTime();
        TripEntry trip = stopTime.getTrip();
        StopEntry stop = stopTime.getStop();
        AgencyAndId shapeId = trip.getShapeId();
        CoordinatePoint point = ex.getPoint();
        PointAndIndex pindex = ex.getPointAndIndex();

        _log.warn("Stop is too far from shape: trip=" + trip.getId() + " stop="
            + stop.getId() + " stopLat=" + stop.getStopLat() + " stopLon="
            + stop.getStopLon() + " shapeId=" + shapeId + " shapePoint="
            + point + " index=" + pindex.index + " distance="
            + pindex.distanceFromTarget);
      } catch (DistanceAlongShapeException ex) {
View Full Code Here

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

  private void processRawFrequency(TransitGraphImpl graph, Frequency frequency,
      Map<AgencyAndId, List<FrequencyEntry>> frequenciesByTripId,
      Map<FrequencyRouteLabelKey, List<FrequencyEntry>> frequencyLabelsByKey) {
    AgencyAndId tripId = frequency.getTrip().getId();
    TripEntry trip = graph.getTripEntryForId(tripId);

    FrequencyEntryImpl entry = new FrequencyEntryImpl(frequency.getStartTime(),
        frequency.getEndTime(), frequency.getHeadwaySecs());

    FrequencyRouteLabelKey key = getFrequencyLabelKeyForTrip(frequency, trip);
View Full Code Here

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

      Map<AgencyAndId, List<FrequencyEntry>> frequenciesAlongBlock) {

    List<FrequencyEntry> frequencies = null;

    for (BlockTripEntry blockTrip : trips) {
      TripEntry trip = blockTrip.getTrip();
      List<FrequencyEntry> potentialFrequencies = frequenciesAlongBlock.get(trip.getId());

      if (frequencies == null) {
        frequencies = potentialFrequencies;
      } else {
        if (!frequencies.equals(potentialFrequencies)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.