Package org.onebusaway.transit_data_federation.services.transit_graph

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


    long serviceDate = System.currentTimeMillis();

    BlockEntryImpl block = block("blockA");
    TripEntryImpl trip = trip("tripA", "serviceId");
    stopTime(0, null, trip, time(9, 00), 0);
    BlockConfigurationEntry blockConfig = linkBlockTrips(block, trip);
    BlockInstance blockInstance = new BlockInstance(blockConfig, serviceDate);

    BlockLocationRecordCacheImpl cache = new BlockLocationRecordCacheImpl();
    cache.setBlockLocationRecordCacheWindowSize(20);
View Full Code Here


    long serviceDate = System.currentTimeMillis();

    BlockEntryImpl blockA = block("blockA");
    TripEntryImpl tripA = trip("tripA", "serviceId");
    stopTime(0, null, tripA, time(9, 00), 0);
    BlockConfigurationEntry blockConfigA = linkBlockTrips(blockA, tripA);
    BlockInstance instanceA = new BlockInstance(blockConfigA, serviceDate);

    BlockEntryImpl blockB = block("blockB");
    TripEntryImpl tripB = trip("tripB", "serviceId");
    stopTime(0, null, tripB, time(9, 00), 0);
    BlockConfigurationEntry blockConfigB = linkBlockTrips(blockB, tripB);
    BlockInstance instanceB = new BlockInstance(blockConfigB, serviceDate);

    BlockLocationRecordCacheImpl cache = new BlockLocationRecordCacheImpl();
    cache.setBlockLocationRecordCacheWindowSize(20);
View Full Code Here

    for (int i = 0; i < 20; i++) {

      BlockEntryImpl block = block(Integer.toString(i));
      TripEntryImpl trip = trip(Integer.toString(i), "serviceId");
      stopTime(0, null, trip, time(9, 00), 0);
      BlockConfigurationEntry blockConfig = linkBlockTrips(block, trip);
      BlockInstance blockInstance = new BlockInstance(blockConfig, serviceDate);

      for (int j = 0; j < 5; j++) {

        AgencyAndId vehicleId = new AgencyAndId("1", Integer.toString(vid++));
View Full Code Here

      List<TimepointPredictionRecord> timepointPredictions = record.getTimepointPredictions();
      if (timepointPredictions != null && !timepointPredictions.isEmpty()) {

        SortedMap<Integer, Double> scheduleDeviations = new TreeMap<Integer, Double>();

        BlockConfigurationEntry blockConfig = blockInstance.getBlock();

        for (TimepointPredictionRecord tpr : timepointPredictions) {
          AgencyAndId stopId = tpr.getTimepointId();
          long predictedTime = tpr.getTimepointPredictedTime();
          if (stopId == null || predictedTime == 0)
            continue;

          for (BlockStopTimeEntry blockStopTime : blockConfig.getStopTimes()) {
            StopTimeEntry stopTime = blockStopTime.getStopTime();
            StopEntry stop = stopTime.getStop();
            if (stopId.equals(stop.getId())) {
              int arrivalTime = stopTime.getArrivalTime();
              int deviation = (int) ((tpr.getTimepointPredictedTime() - blockInstance.getServiceDate()) / 1000 - arrivalTime);
View Full Code Here

   ****/

  private ScheduledBlockLocation getScheduledBlockLocationForVehicleLocationRecord(
      VehicleLocationRecord record, BlockInstance blockInstance) {

    BlockConfigurationEntry blockConfig = blockInstance.getBlock();
    long serviceDate = blockInstance.getServiceDate();

    long targetTime = record.getTimeOfRecord();

    int scheduledTime = (int) ((targetTime - serviceDate) / 1000);
View Full Code Here

  }

  private ScheduledBlockLocation getScheduledBlockLocationForBlockInstance(
      BlockInstance blockInstance, long targetTime) {

    BlockConfigurationEntry blockConfig = blockInstance.getBlock();
    long serviceDate = blockInstance.getServiceDate();

    int scheduledTime = (int) ((targetTime - serviceDate) / 1000);

    return _scheduledBlockLocationService.getScheduledBlockLocationFromScheduledTime(
View Full Code Here

      long targetTime) {

    VehicleLocationRecord record = cacheElement.getRecord();
    ScheduledBlockLocation scheduledBlockLocation = cacheElement.getScheduledBlockLocation();

    BlockConfigurationEntry blockConfig = blockInstance.getBlock();
    long serviceDate = blockInstance.getServiceDate();

    int scheduledTime = (int) ((targetTime - serviceDate) / 1000);

    /**
 
View Full Code Here

    if (record.isDistanceAlongBlockSet()) {
      double distanceAlongBlock = record.getDistanceAlongBlock();
      builder.setDistanceAlongBlock(distanceAlongBlock);
      AgencyAndId tripId = record.getTripId();
      if (tripId != null) {
        BlockConfigurationEntry block = blockInstance.getBlock();
        for (BlockTripEntry blockTrip : block.getTrips()) {
          TripEntry trip = blockTrip.getTrip();
          if (trip.getId().equals(tripId)) {
            double distanceAlongTrip = distanceAlongBlock
                - blockTrip.getDistanceAlongBlock();
            builder.setDistanceAlongTrip(distanceAlongTrip);
View Full Code Here

public class BlockInstanceComparator implements Comparator<BlockInstance> {

  @Override
  public int compare(BlockInstance o1, BlockInstance o2) {

    BlockConfigurationEntry bc1 = o1.getBlock();
    BlockConfigurationEntry bc2 = o2.getBlock();
    BlockEntry b1 = bc1.getBlock();
    BlockEntry b2 = bc2.getBlock();

    AgencyAndId bId1 = b1.getId();
    AgencyAndId bId2 = b2.getId();

    int rc = bId1.compareTo(bId2);

    if (rc != 0)
      return rc;

    rc = bc1.getServiceIds().compareTo(bc2.getServiceIds());

    if (rc != 0)
      return rc;

    return Double.compare(o1.getServiceDate(), o2.getServiceDate());
View Full Code Here

  public ArrivalAndDepartureInstance getPreviousStopArrivalAndDeparture(
      ArrivalAndDepartureInstance instance) {

    BlockStopTimeEntry stopTime = instance.getBlockStopTime();
    BlockTripEntry trip = stopTime.getTrip();
    BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();
    List<BlockStopTimeEntry> stopTimes = blockConfig.getStopTimes();

    int index = stopTime.getBlockSequence() - 1;
    if (index < 0)
      return null;
View Full Code Here

TOP

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

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.