Package org.onebusaway.transit_data_federation.services.transit_graph

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


          blockConfig, adjustedScheduleTime);

      if (location != null) {
        message.setDistanceAlongBlock(location.getDistanceAlongBlock());

        BlockTripEntry activeTrip = location.getActiveTrip();
        if (activeTrip != null) {
          message.setTripId(activeTrip.getTrip().getId());
          _currentResult.addMatchedTripId(activeTrip.getTrip().getId().toString());
        } else {
          _log.error("invalid trip for location=" + location);
          _currentResult.addUnmatchedTripId(blockId.toString()); // this isn't exactly right
        }
        // Are we at the start of the block?
View Full Code Here


  public BlockTripIndex createIndex(TransitGraphDao dao) {

    List<BlockTripEntry> trips = new ArrayList<BlockTripEntry>();

    for (BlockTripReference blockTripReference : _blockTripReferences) {
      BlockTripEntry trip = ReferencesLibrary.getReferenceAsTrip(
          blockTripReference, dao);
      trips.add(trip);
    }

    return new BlockTripIndex(trips, _serviceIntervalBlock);
View Full Code Here

    return instance.getBlockStopTime().getBlockSequence() > 0;
  }

  public static boolean hasNextStopTime(ArrivalAndDepartureInstance instance) {
    BlockStopTimeEntry stopTime = instance.getBlockStopTime();
    BlockTripEntry trip = stopTime.getTrip();
    BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();
    List<BlockStopTimeEntry> stopTimes = blockConfig.getStopTimes();
    return stopTime.getBlockSequence() + 1 < stopTimes.size();
  }
View Full Code Here

    return stopTime.getBlockSequence() + 1 < stopTimes.size();
  }
 
  public static boolean hasNextStopTime(StopTimeInstance instance) {
    BlockStopTimeEntry stopTime = instance.getStopTime();
    BlockTripEntry trip = stopTime.getTrip();
    BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();
    List<BlockStopTimeEntry> stopTimes = blockConfig.getStopTimes();
    return stopTime.getBlockSequence() + 1 < stopTimes.size();
  }
View Full Code Here

  @Override
  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();
View Full Code Here

  @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>();
View Full Code Here

  private TransitLegBuilder extendTransitLegWithDepartureAndArrival(
      List<LegBean> legs, TransitLegBuilder builder,
      ArrivalAndDepartureInstance from, ArrivalAndDepartureInstance to) {

    BlockTripEntry tripFrom = from.getBlockTrip();
    BlockTripEntry tripTo = to.getBlockTrip();

    if (builder.getBlockTripInstanceFrom() == null) {
      builder.setScheduledDepartureTime(from.getScheduledDepartureTime());
      builder.setPredictedDepartureTime(from.getPredictedDepartureTime());
      builder.setBlockTripInstanceFrom(from.getBlockTripInstance());
View Full Code Here

  }

  private double getTransitLegBuilderAsDistance(TransitLegBuilder builder) {

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

    BlockStopTimeEntry fromStop = null;
    BlockStopTimeEntry toStop = null;

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

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

    if (fromStop == null && toStop == null)
      return trip.getTrip().getTotalTripDistance();

    if (fromStop == null && toStop != null)
      return toStop.getDistanceAlongBlock() - trip.getDistanceAlongBlock();

    if (fromStop != null && toStop == null)
      return trip.getDistanceAlongBlock()
          + trip.getTrip().getTotalTripDistance()
          - fromStop.getDistanceAlongBlock();

    return toStop.getDistanceAlongBlock() - fromStop.getDistanceAlongBlock();
  }
View Full Code Here

  }

  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

  @Override
  public double getDistanceAlongBlockForIndex(int index) {

    int tripIndex = tripIndices[index];

    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

TOP

Related Classes of org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry

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.