Examples of TripEntry


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

  private Set<AgencyAndId> getShapeIdsForStopSequenceBlock(
      StopSequenceCollection block) {
    Set<AgencyAndId> shapeIds = new HashSet<AgencyAndId>();
    for (StopSequence sequence : block.getStopSequences()) {
      for (BlockTripEntry blockTrip : sequence.getTrips()) {
        TripEntry trip = blockTrip.getTrip();
        AgencyAndId shapeId = trip.getShapeId();
        if (shapeId != null && shapeId.hasValues())
          shapeIds.add(shapeId);
      }
    }
    return shapeIds;
View Full Code Here

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

    Map<StopSequenceKey, List<BlockTripEntry>> tripsByStopSequenceKey = new FactoryMap<StopSequenceKey, List<BlockTripEntry>>(
        new ArrayList<BlockTripEntry>());

    for (BlockTripEntry blockTrip : trips) {
      TripEntry trip = blockTrip.getTrip();
      String directionId = trip.getDirectionId();
      if (directionId == null)
        directionId = NO_DIRECTION_ID;
      AgencyAndId shapeId = trip.getShapeId();
      if (shapeId == null || !shapeId.hasValues())
        shapeId = NO_SHAPE_ID;
      List<StopEntry> stops = getStopTimesAsStops(trip.getStopTimes());
      StopSequenceKey key = new StopSequenceKey(stops, directionId, shapeId);
      tripsByStopSequenceKey.get(key).add(blockTrip);
    }

    List<StopSequence> sequences = new ArrayList<StopSequence>();
View Full Code Here

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

  public List<ServiceAlert> getServiceAlertsForStopCall(long time,
      BlockInstance blockInstance, BlockStopTimeEntry blockStopTime,
      AgencyAndId vehicleId) {

    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
     */
    /*
     * getServiceAlertIdsForKey(_serviceAlertsIdsByAgencyId,
     * lineId.getAgencyId(), serviceAlertIds);
     */
    getServiceAlertIdsForKey(_serviceAlertIdsByRouteId, lineId, serviceAlertIds);
    RouteAndStopCallRef routeAndStopCallRef = new RouteAndStopCallRef(lineId,
        stopId);
    getServiceAlertIdsForKey(_serviceAlertIdsByRouteAndStop,
        routeAndStopCallRef, serviceAlertIds);

    /**
     * Remember that direction is optional
     */
    if (directionId != null) {
      RouteAndDirectionRef lineAndDirectionRef = new RouteAndDirectionRef(
          lineId, directionId);
      RouteDirectionAndStopCallRef lineDirectionAndStopCallRef = new RouteDirectionAndStopCallRef(
          lineId, directionId, stopId);

      getServiceAlertIdsForKey(_serviceAlertIdsByRouteAndDirectionId,
          lineAndDirectionRef, serviceAlertIds);
      getServiceAlertIdsForKey(_serviceAlertIdsByRouteDirectionAndStopCall,
          lineDirectionAndStopCallRef, serviceAlertIds);
    }

    getServiceAlertIdsForKey(_serviceAlertIdsByTripId, trip.getId(),
        serviceAlertIds);
    TripAndStopCallRef tripAndStopCallRef = new TripAndStopCallRef(tripId,
        stopId);
    getServiceAlertIdsForKey(_serviceAlertIdsByTripAndStopId,
        tripAndStopCallRef, serviceAlertIds);
View Full Code Here

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

  @Override
  public List<ServiceAlert> getServiceAlertsForVehicleJourney(long time,
      BlockTripInstance blockTripInstance, AgencyAndId vehicleId) {

    BlockTripEntry blockTrip = blockTripInstance.getBlockTrip();
    TripEntry trip = blockTrip.getTrip();
    AgencyAndId lineId = trip.getRouteCollection().getId();
    RouteAndDirectionRef lineAndDirectionRef = new RouteAndDirectionRef(lineId,
        trip.getDirectionId());

    Set<AgencyAndId> serviceAlertIds = new HashSet<AgencyAndId>();
    getServiceAlertIdsForKey(_serviceAlertIdsByAgencyId, lineId.getAgencyId(),
        serviceAlertIds);
    getServiceAlertIdsForKey(_serviceAlertIdsByRouteId, lineId, serviceAlertIds);
    getServiceAlertIdsForKey(_serviceAlertIdsByRouteAndDirectionId,
        lineAndDirectionRef, serviceAlertIds);
    getServiceAlertIdsForKey(_serviceAlertIdsByTripId, trip.getId(),
        serviceAlertIds);
    return getServiceAlertIdsAsObjects(serviceAlertIds, time);
  }
View Full Code Here

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

  public StopNarrative getNarrativeForStopId(AgencyAndId stopId) {
    return _stopNarratives.get(stopId);
  }

  public StopTimeNarrative getNarrativeForStopTimeEntry(StopTimeEntry entry) {
    TripEntry trip = entry.getTrip();
    List<StopTimeNarrative> narratives = _stopTimeNarrativesByTripIdAndStopTimeSequence.get(trip.getId());
    if (narratives == null)
      return null;
    int index = entry.getSequence();
    return narratives.get(index);
  }
View Full Code Here

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

    double distance = getTransitLegBuilderAsDistance(builder);
    leg.setDistance(distance);

    leg.setMode(MODE_TRANSIT);

    TripEntry trip = blockTripInstanceFrom.getBlockTrip().getTrip();

    TransitLegBean transitLeg = new TransitLegBean();
    leg.setTransitLeg(transitLeg);

    transitLeg.setServiceDate(blockTripInstanceFrom.getServiceDate());

    FrequencyEntry frequencyLabel = blockTripInstanceFrom.getFrequencyLabel();
    if (frequencyLabel != null) {
      FrequencyBean frequency = FrequencyBeanLibrary.getBeanForFrequency(
          blockTripInstanceFrom.getServiceDate(), frequencyLabel);
      transitLeg.setFrequency(frequency);
    }

    TripBean tripBean = _tripBeanService.getTripForId(trip.getId());
    transitLeg.setTrip(tripBean);

    transitLeg.setScheduledDepartureTime(builder.getScheduledDepartureTime());
    transitLeg.setScheduledArrivalTime(builder.getScheduledArrivalTime());
View Full Code Here

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

  private String getTransitLegBuilderAsPath(TransitLegBuilder builder) {

    BlockTripInstance blockTripInstanceFrom = builder.getBlockTripInstanceFrom();
    BlockTripEntry blockTrip = blockTripInstanceFrom.getBlockTrip();
    TripEntry trip = blockTrip.getTrip();

    AgencyAndId shapeId = trip.getShapeId();

    if (shapeId == null)
      return null;

    ShapePoints shapePoints = _shapePointService.getShapePointsForShapeId(shapeId);

    BlockStopTimeEntry fromStop = null;
    BlockStopTimeEntry toStop = null;

    if (builder.getFromStop() != null)
      fromStop = builder.getFromStop().getBlockStopTime();

    if (builder.getToStop() != null)
      toStop = builder.getToStop().getBlockStopTime();

    CoordinatePoint nextPoint = null;

    BlockTripEntry nextBlockTrip = builder.getNextTrip();
    if (nextBlockTrip != null) {
      TripEntry nextTrip = nextBlockTrip.getTrip();
      AgencyAndId nextShapeId = nextTrip.getShapeId();
      if (nextShapeId != null) {
        ShapePoints nextShapePoints = _shapePointService.getShapePointsForShapeId(nextShapeId);
        nextPoint = nextShapePoints.getPointForIndex(0);
      }
    }
View Full Code Here

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

      OBATraverseOptions options) {

    TransitLegBuilder b = new TransitLegBuilder();

    AgencyAndId tripId = AgencyAndIdLibrary.convertFromString(transitLeg.getTrip().getId());
    TripEntry trip = _transitGraphDao.getTripEntryForId(tripId);

    if (trip == null)
      throw new NoSuchTripServiceException(transitLeg.getTrip().getId());

    long serviceDate = transitLeg.getServiceDate();

    AgencyAndId vehicleId = null;
    if (transitLeg.getVehicleId() != null)
      vehicleId = AgencyAndIdLibrary.convertFromString(transitLeg.getVehicleId());

    if (transitLeg.getFromStop() != null
        && transitLeg.getFromStop().getId() != null) {

      AgencyAndId fromStopId = AgencyAndIdLibrary.convertFromString(transitLeg.getFromStop().getId());
      StopEntry fromStop = _transitGraphDao.getStopEntryForId(fromStopId, true);
      int fromStopSequence = transitLeg.getFromStopSequence();

      ArrivalAndDepartureQuery query = new ArrivalAndDepartureQuery();
      query.setStop(fromStop);
      query.setStopSequence(fromStopSequence);
      query.setTrip(trip);
      query.setServiceDate(serviceDate);
      query.setVehicleId(vehicleId);
      query.setTime(options.currentTime);

      ArrivalAndDepartureInstance instance = _arrivalAndDepartureService.getArrivalAndDepartureForStop(query);

      b.setFromStop(instance);
      b.setBlockTripInstanceFrom(instance.getBlockTripInstance());
      b.setScheduledDepartureTime(instance.getScheduledDepartureTime());
      b.setPredictedDepartureTime(instance.getPredictedDepartureTime());
    }

    if (transitLeg.getToStop() != null
        && transitLeg.getToStop().getId() != null) {

      AgencyAndId toStopId = AgencyAndIdLibrary.convertFromString(transitLeg.getToStop().getId());
      StopEntry toStop = _transitGraphDao.getStopEntryForId(toStopId, true);
      int toStopSequence = transitLeg.getToStopSequence();

      ArrivalAndDepartureQuery query = new ArrivalAndDepartureQuery();
      query.setStop(toStop);
      query.setStopSequence(toStopSequence);
      query.setTrip(trip);
      query.setServiceDate(serviceDate);
      query.setVehicleId(vehicleId);
      query.setTime(options.currentTime);

      ArrivalAndDepartureInstance instance = _arrivalAndDepartureService.getArrivalAndDepartureForStop(query);

      b.setToStop(instance);
      b.setBlockTripInstanceTo(instance.getBlockTripInstance());
      b.setScheduledArrivalTime(instance.getScheduledArrivalTime());
      b.setPredictedArrivalTime(instance.getPredictedArrivalTime());
    }

    if (b.getBlockTripInstanceFrom() == null) {

      BlockEntry block = trip.getBlock();

      BlockInstance blockInstance = _blockCalendarService.getBlockInstance(
          block.getId(), serviceDate);
      BlockTripInstance tripInstance = BlockTripInstanceLibrary.getBlockTripInstance(
          blockInstance, trip.getId());
      b.setBlockTripInstanceFrom(tripInstance);
    }

    return createTransitLegFromBuilder(b);
  }
View Full Code Here

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

     * If the sched time is too much, the trips are not continuous
     */
    if (schedTime >= _maxScheduledTimeBetweenConsecutiveTrips)
      return false;

    TripEntry prevTrip = prevBlockTrip.getTrip();
    TripEntry nextTrip = nextBlockTrip.getTrip();

    AgencyAndId lineIdA = prevTrip.getRouteCollection().getId();
    AgencyAndId lineIdB = nextTrip.getRouteCollection().getId();

    String directionA = prevTrip.getDirectionId();
    String directionB = nextTrip.getDirectionId();

    /**
     * If the route has not changed, but the direction has, the trips are not
     * continuous
     */
 
View Full Code Here

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

        if (!_agencyIds.isEmpty())
          agencyId = _agencyIds.get(0);

        String tripId = data.getString(2);

        TripEntry tripEntry = getTripEntryForId(agencyId, tripId);

        if (tripEntry == null) {
          _unmappedTripIdCount++;
          continue;
        }

        BlockEntry block = tripEntry.getBlock();

        TimepointPrediction record = new TimepointPrediction();

        record.setBlockId(block.getId());
        record.setTripId(tripEntry.getId());

        String tripAgencyId = tripEntry.getId().getAgencyId();
        record.setVehicleId(new AgencyAndId(tripAgencyId, data.getString(6)));
        record.setScheduleDeviation(data.getInt(14));
        record.setTimepointId(new AgencyAndId(agencyId, data.getString(3)));
        record.setTimepointScheduledTime(data.getInt(4));
        record.setTimepointPredictedTime(data.getInt(13));
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.