Package org.onebusaway.transit_data_federation.services.transit_graph

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


   
    InstanceState state = new InstanceState(serviceDate.getTime());

    for (int in = indexFrom; in < indexTo; in++) {
      BlockTripEntry trip = trips.get(in);
      BlockConfigurationEntry block = trip.getBlockConfiguration();
      BlockInstance instance = new BlockInstance(block, state);
      instances.add(instance);
    }
  }
View Full Code Here


    int indexTo = index(Arrays.binarySearch(
        serviceIntervalIndex.getStartTimes(), scheduledTimeTo));

    for (int in = indexFrom; in < indexTo; in++) {
      BlockTripEntry trip = trips.get(in);
      BlockConfigurationEntry block = trip.getBlockConfiguration();
      FrequencyEntry frequency = frequencies.get(in);
      InstanceState state = new InstanceState(serviceDate.getTime(), frequency);
      BlockInstance instance = new BlockInstance(block, state);
      instances.add(instance);
    }
View Full Code Here

   *
   ****/

  private long getTimeToBlockInstance(BlockInstance instance, long time) {
    long serviceDate = instance.getServiceDate();
    BlockConfigurationEntry blockConfig = instance.getBlock();
    int n = blockConfig.getStopTimes().size();
    long from = serviceDate + blockConfig.getArrivalTimeForIndex(0) * 1000;
    long to = serviceDate + blockConfig.getDepartureTimeForIndex(n - 1) * 1000;
    return Math.abs((from + to) / 2 - time);
  }
View Full Code Here

    // 25 minutes of slack time - 10 minutes of travel time in bewteen
    stopTime(3, stopC, tripB, time(11, 00), time(11, 05), 200);
    stopTime(4, stopB, tripB, time(11, 10), time(11, 15), 500);
    stopTime(5, stopA, tripB, time(11, 25), time(11, 25), 800);

    BlockConfigurationEntry blockConfig = linkBlockTrips("block", tripA, tripB);
    _stopTimes = blockConfig.getStopTimes();
  }
View Full Code Here

    if (serviceDate != 0) {
      BlockInstance blockInstance = _blockCalendarService.getBlockInstance(
          blockId, serviceDate);
      if (blockInstance == null)
        return Collections.emptyList();
      BlockConfigurationEntry blockConfig = blockInstance.getBlock();
      if (blockConfig.getFrequencies() == null)
        return Arrays.asList(blockInstance);

      List<BlockInstance> instances = new ArrayList<BlockInstance>();
      for (FrequencyEntry frequency : blockConfig.getFrequencies())
        instances.add(new BlockInstance(blockConfig,
            blockInstance.getServiceDate(), frequency));
      return instances;
    } else {
View Full Code Here

    TripEntryImpl tripA = UnitTestingSupport.trip("tripA");
    TripEntryImpl tripB = UnitTestingSupport.trip("tripB");
    UnitTestingSupport.stopTime(0, null, tripA, 0, 0);
    UnitTestingSupport.stopTime(0, null, tripB, 0, 0);
    ServiceIdActivation serviceIds = UnitTestingSupport.serviceIds("sid");
    BlockConfigurationEntry blockConfig = UnitTestingSupport.blockConfiguration(
        block, serviceIds, tripA, tripB);

    BlockInstance blockInstanceA = new BlockInstance(blockConfig, 123L);
    BlockTripInstance blockTripInstance = BlockTripInstanceLibrary.getBlockTripInstance(
        blockInstanceA, UnitTestingSupport.aid("tripA"));
View Full Code Here

    if (previousLocation.getDistanceAlongBlock() > distanceAlongBlock)
      throw new IllegalStateException(
          "previousLocation's distanceAlongBlock must be before the requested distanceAlongBlock");

    BlockTripEntry trip = previousLocation.getActiveTrip();
    BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();

    List<BlockStopTimeEntry> stopTimes = blockConfig.getStopTimes();

    int indexFrom = previousLocation.getStopTimeIndex();
    int indexTo = indexFrom + 1;

    while (indexTo < stopTimes.size()) {
      double d = blockConfig.getDistanceAlongBlockForIndex(indexTo);
      if (distanceAlongBlock <= d)
        break;
      indexTo++;
    }
View Full Code Here

    if (previousLocation.getScheduledTime() > scheduleTime)
      throw new IllegalStateException(
          "previousLocation's scheduledTime must be before the requested scheduleTime");

    BlockTripEntry trip = previousLocation.getActiveTrip();
    BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();

    List<BlockStopTimeEntry> stopTimes = blockConfig.getStopTimes();

    int index = previousLocation.getStopTimeIndex();

    while (index < stopTimes.size()) {
      int t = blockConfig.getDepartureTimeForIndex(index);
      if (scheduleTime <= t)
        break;
      index++;
    }
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.