Examples of BlockEntry


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

    @Override
    public List<BlockLocationRecord> getRecordsFromDao(long fromTime,
        long toTime) {
      BlockConfigurationEntry blockConfig = _blockInstance.getBlock();
      BlockEntry block = blockConfig.getBlock();
      return _blockLocationRecordDao.getBlockLocationRecordsForBlockServiceDateAndTimeRange(
          block.getId(), _blockInstance.getServiceDate(), fromTime, toTime);
    }
View Full Code Here

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

    TripEntry trip = _graph.getTripEntryForId(tripId);

    if (trip == null)
      return;

    BlockEntry block = trip.getBlock();

    TripProblemReportRecord record = new TripProblemReportRecord();
    record.setCode(problem.getCode());
    record.setServiceDate(problem.getServiceDate());

    String vehicleId = problem.getVehicleId();
    if (vehicleId != null)
      record.setVehicleId(AgencyAndIdLibrary.convertFromString(vehicleId));

    String stopId = problem.getStopId();
    if (stopId != null)
      record.setStopId(AgencyAndIdLibrary.convertFromString(stopId));

    record.setTime(problem.getTime());
    record.setTripId(tripId);
    record.setBlockId(block.getId());

    record.setUserComment(problem.getUserComment());

    if (problem.getUserLat() != null && !Double.isNaN(problem.getUserLat()))
      record.setUserLat(problem.getUserLat());
    if (problem.getUserLon() != null && !Double.isNaN(problem.getUserLon()))
      record.setUserLon(problem.getUserLon());
    if (problem.getUserLocationAccuracy() != null
        && !Double.isNaN(problem.getUserLocationAccuracy()))
      record.setUserLocationAccuracy(problem.getUserLocationAccuracy());

    record.setUserOnVehicle(problem.isUserOnVehicle());
    record.setUserVehicleNumber(problem.getUserVehicleNumber());

    Map<BlockInstance, List<BlockLocation>> locationsByInstance = _blockStatusService.getBlocks(
        block.getId(), problem.getServiceDate(), record.getVehicleId(),
        problem.getTime());

    BlockInstance blockInstance = getBestBlockInstance(locationsByInstance.keySet());

    if (blockInstance != null) {
View Full Code Here

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

  @Override
  public String toString() {

    BlockSequence first = _sequences.get(0);
    BlockConfigurationEntry blockConfig = first.getBlockConfig();
    BlockEntry block = blockConfig.getBlock();
    List<BlockStopTimeEntry> bsts = first.getStopTimes();
    BlockStopTimeEntry firstBst = bsts.get(0);
    BlockStopTimeEntry lastBst = bsts.get(bsts.size() - 1);
    StopEntry fromStop = firstBst.getStopTime().getStop();
    StopEntry toStop = lastBst.getStopTime().getStop();
    return "BlockSequenceIndex [ex: block=" + block.getId() + " fromStop="
        + fromStop.getId() + " toStop=" + toStop.getId() + " serviceIds="
        + getServiceIds() + "]";
  }
View Full Code Here

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

public class ReferencesLibrary {

  public static BlockConfigurationReference getBlockAsReference(
      BlockConfigurationEntry blockConfig) {
    BlockEntry block = blockConfig.getBlock();
    int configurationIndex = block.getConfigurations().indexOf(blockConfig);
    return new BlockConfigurationReference(block.getId(), configurationIndex);
  }
View Full Code Here

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

  public static BlockConfigurationEntry getReferenceAsBlockConfiguration(
      BlockConfigurationReference reference, TransitGraphDao dao) {
    AgencyAndId blockId = reference.getBlockId();
    int configurationIndex = reference.getConfigurationIndex();
    BlockEntry block = dao.getBlockEntryForId(blockId);
    if (block == null)
      throw new IllegalStateException("block does not exist: " + reference);
    return block.getConfigurations().get(configurationIndex);
  }
View Full Code Here

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

      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.BlockEntry

      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?
    if (blockId != null && record.getServiceDate() != 0)
View Full Code Here

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

        _recordsWithoutServiceDate++;
        return;
      }

      BlockConfigurationEntry blockConfig = blockInstance.getBlock();
      BlockEntry block = blockConfig.getBlock();
      AgencyAndId blockId = block.getId();

      VehicleLocationRecord message = new VehicleLocationRecord();

      message.setBlockId(blockId);
View Full Code Here

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

      VehicleRefStructure vehicleRef = mvj.getVehicleRef();
      if (vehicleRef == null || vehicleRef.getValue() == null)
        continue;

      BlockEntry block = getBlockForMonitoredVehicleJourney(mvj,
          endpointDetails);
      if (block == null) {
        TripEntry trip = getTripForMonitoredVehicleJourney(mvj, endpointDetails);
        if (trip != null)
          block = trip.getBlock();
      }

      if (block == null)
        continue;

      List<BlockInstance> instances = _blockCalendarService.getActiveBlocks(
          block.getId(), timeFrom, timeTo);

      // TODO : We currently assume that a block won't overlap with itself
      if (instances.size() != 1)
        continue;

      BlockInstance instance = instances.get(0);

      VehicleLocationRecord r = new VehicleLocationRecord();
      r.setTimeOfRecord(time.getTime());
      r.setServiceDate(instance.getServiceDate());
      r.setBlockId(block.getId());

      String agencyId = block.getId().getAgencyId();
      r.setVehicleId(new AgencyAndId(agencyId, vehicleRef.getValue()));

      r.setScheduleDeviation(delay.getTimeInMillis(now) / 1000);

      LocationStructure location = mvj.getVehicleLocation();
View Full Code Here

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

      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);
    }
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.