Examples of TripEntry


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

     * We don't iterate over block stop times directly because there is
     * performance penalty with instantiating each. Also note that this will
     * currently miss the case where a stop is visited twice in the same trip.
     */
    BlockTripEntry blockTrip = blockTripInstance.getBlockTrip();
    TripEntry trip = blockTrip.getTrip();
    List<StopTimeEntry> stopTimes = trip.getStopTimes();

    if (stopSequence > -1) {

      /**
       * If a stop sequence has been specified, we start our search at the
View Full Code Here

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

    AgencyAndId tripId = AgencyAndIdLibrary.convertFromString(query.getTripId());
    long serviceDate = query.getServiceDate();
    AgencyAndId vehicleId = AgencyAndIdLibrary.convertFromString(query.getVehicleId());
    long time = query.getTime();

    TripEntry tripEntry = _transitGraphDao.getTripEntryForId(tripId);
    if (tripEntry == null)
      return new ListBean<TripDetailsBean>();

    Map<BlockInstance, List<BlockLocation>> locationsByInstance = _blockStatusService.getBlocks(
        tripEntry.getBlock().getId(), serviceDate, vehicleId, time);

    List<TripDetailsBean> tripDetails = new ArrayList<TripDetailsBean>();

    for (Map.Entry<BlockInstance, List<BlockLocation>> entry : locationsByInstance.entrySet()) {
View Full Code Here

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

      BlockTripEntry activeBlockTrip = activeTripInstance.getBlockTrip();
      bean.setScheduledDistanceAlongTrip(blockLocation.getScheduledDistanceAlongBlock()
          - activeBlockTrip.getDistanceAlongBlock());
      bean.setDistanceAlongTrip(blockLocation.getDistanceAlongBlock()
          - activeBlockTrip.getDistanceAlongBlock());
      TripEntry activeTrip = activeBlockTrip.getTrip();
      bean.setTotalDistanceAlongTrip(activeTrip.getTotalTripDistance());

      TripBean activeTripBean = _tripBeanService.getTripForId(activeTrip.getId());
      bean.setActiveTrip(activeTripBean);
      bean.setBlockTripSequence(activeBlockTrip.getSequence());

      if (blockLocation.isLastKnownDistanceAlongBlockSet()) {
        bean.setLastKnownDistanceAlongTrip(blockLocation.getLastKnownDistanceAlongBlock()
View Full Code Here

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

      frequency = FrequencyBeanLibrary.getBeanForFrequency(serviceDate,
          frequencyLabel);
    }

    BlockTripEntry blockTrip = blockTripInstance.getBlockTrip();
    TripEntry tripEntry = blockTrip.getTrip();

    if (inclusion.isIncludeTripBean()) {
      trip = _tripBeanService.getTripForId(tripEntry.getId());
      if (trip == null)
        missing = true;
    }

    if (inclusion.isIncludeTripSchedule()) {

      stopTimes = _tripStopTimesBeanService.getStopTimesForBlockTrip(blockTripInstance);

      if (stopTimes == null)
        missing = true;
    }

    if (inclusion.isIncludeTripStatus() && blockLocation != null) {
      status = getBlockLocationAsStatusBean(blockLocation, time);
      if (status == null)
        missing = true;
      else
        vehicleId = AgencyAndIdLibrary.convertFromString(status.getVehicleId());
    }

    List<ServiceAlertBean> situations = _serviceAlertBeanService.getServiceAlertsForVehicleJourney(
        time, blockTripInstance, vehicleId);

    if (missing)
      return null;

    String tripId = AgencyAndIdLibrary.convertToString(tripEntry.getId());

    TripDetailsBean bean = new TripDetailsBean();
    bean.setTripId(tripId);
    bean.setServiceDate(serviceDate);
    bean.setFrequency(frequency);
View Full Code Here

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

    TripEntryImpl trip = new TripEntryImpl();
    trip.setId(new AgencyAndId("2", "T10"));
    Mockito.when(_dao.getTripEntryForId(trip.getId())).thenReturn(trip);

    TripEntry trip2 = _source.getTrip("T10");
    assertSame(trip, trip2);

    trip2 = _source.getTrip("T11");
    assertNull(trip2);
  }
View Full Code Here

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

  }

  @Cacheable
  public TripBean getTripForId(AgencyAndId tripId) {

    TripEntry tripEntry = _graph.getTripEntryForId(tripId);

    if (tripEntry == null)
      return null;

    AgencyAndId routeId = tripEntry.getRouteCollection().getId();
    RouteBean routeBean = _routeBeanService.getRouteForId(routeId);

    TripNarrative tripNarrative = _narrativeService.getTripForId(tripId);

    TripBean tripBean = new TripBean();

    tripBean.setId(ApplicationBeanLibrary.getId(tripId));

    tripBean.setTripShortName(tripNarrative.getTripShortName());
    tripBean.setTripHeadsign(tripNarrative.getTripHeadsign());
    tripBean.setRoute(routeBean);
    tripBean.setRouteShortName(tripNarrative.getRouteShortName());
    tripBean.setServiceId(ApplicationBeanLibrary.getId(tripEntry.getServiceId().getId()));

    AgencyAndId shapeId = tripEntry.getShapeId();
    if (shapeId != null && shapeId.hasValues())
      tripBean.setShapeId(ApplicationBeanLibrary.getId(shapeId));

    tripBean.setDirectionId(tripEntry.getDirectionId());
    tripBean.setTotalTripDistance(tripEntry.getTotalTripDistance());
   
    BlockEntry block = tripEntry.getBlock();
    tripBean.setBlockId(ApplicationBeanLibrary.getId(block.getId()));
   
    return tripBean;
  }
View Full Code Here

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

    RouteEntryImpl r1 = route("routeA1");
    RouteEntryImpl r2 = route("routeA2");
    RouteCollectionEntryImpl rc = routeCollection("routeA", r1, r2);

    TripEntry t1 = trip("t1");
    TripEntry t2 = trip("t2");
    TripEntry t3 = trip("t3");

    // r2's values should win out over r1's because it has more trips
    r1.setTrips(Arrays.asList(t1));
    r2.setTrips(Arrays.asList(t2, t3));
View Full Code Here

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

    List<BlockStopTimeIndex> indices = _blockIndexService.getStopTimeIndicesForStop(stopEntry);

    for (BlockStopTimeIndex blockStopTimeIndex : indices) {
      for (BlockTripEntry blockTrip : blockStopTimeIndex.getTrips()) {
        TripEntry trip = blockTrip.getTrip();
        routeCollectionIds.add(trip.getRouteCollection().getId());
      }
    }

    List<FrequencyBlockStopTimeIndex> frequencyIndices = _blockIndexService.getFrequencyStopTimeIndicesForStop(stopEntry);

    for (FrequencyBlockStopTimeIndex blockStopTimeIndex : frequencyIndices) {
      for (BlockTripEntry blockTrip : blockStopTimeIndex.getTrips()) {
        TripEntry trip = blockTrip.getTrip();
        routeCollectionIds.add(trip.getRouteCollection().getId());
      }
    }

    return routeCollectionIds;
  }
View Full Code Here

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

    AgencyAndId blockId = record.getBlockId();

    if (blockId == null) {
      AgencyAndId tripId = record.getTripId();
      if (tripId != null) {
        TripEntry tripEntry = _transitGraphDao.getTripEntryForId(tripId);
        if (tripEntry == null)
          throw new IllegalArgumentException("trip not found with id=" + tripId);
        BlockEntry block = tripEntry.getBlock();
        blockId = block.getId();
      }
    }

    // TODO : Maybe not require service date?
View Full Code Here

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

  private <T extends AbstractBlockTripIndex> void getBlockTripsForIndicesMatchingRouteCollection(
      List<T> blockIndices, AgencyAndId routeCollectionId,
      List<BlockTripEntry> resultingTrips) {
    for (AbstractBlockTripIndex blockIndex : blockIndices) {
      for (BlockTripEntry blockTrip : blockIndex.getTrips()) {
        TripEntry trip = blockTrip.getTrip();
        AgencyAndId rcId = trip.getRouteCollection().getId();
        if (!rcId.equals(routeCollectionId))
          continue;
        resultingTrips.add(blockTrip);
      }
    }
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.