Package org.onebusaway.transit_data_federation.services.blocks

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance


  }

  private void applySituationsToBean(long time,
      ArrivalAndDepartureInstance instance, ArrivalAndDepartureBean bean) {

    BlockInstance blockInstance = instance.getBlockInstance();

    AgencyAndId vehicleId = null;
    BlockLocation blockLocation = instance.getBlockLocation();
    if (blockLocation != null)
      vehicleId = blockLocation.getVehicleId();
View Full Code Here


     * See the specific contract for {@link BlockEntry#getConfigurations()}
     * about the sort order of configurations
     */
    for (BlockConfigurationEntry configuration : configurations) {
      if (allServiceIdsAreActiveForServiceDate(configuration, date)) {
        return new BlockInstance(configuration, state);
      }

      index++;
    }

View Full Code Here

      List<Date> serviceDates = _calendarService.getDatesForServiceIdsAsOrderedList(blockConfig.getServiceIds());

      int index = index(Collections.binarySearch(serviceDates, timeAsDate));

      if (index > 0) {
        BlockInstance instance = new BlockInstance(blockConfig,
            serviceDates.get(index - 1).getTime());
        long delta = getTimeToBlockInstance(instance, time);
        m.add(delta, instance);
      }

      if (index < serviceDates.size()) {
        BlockInstance instance = new BlockInstance(blockConfig,
            serviceDates.get(index).getTime());
        long delta = getTimeToBlockInstance(instance, time);
        m.add(delta, instance);
      }
    }
View Full Code Here

    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

    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

    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 List<BlockInstance> getBlockInstances(AgencyAndId blockId,
      long serviceDate, long time) {

    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 {

      List<BlockInstance> instances = _blockCalendarService.getActiveBlocks(
          blockId, time, time);
View Full Code Here

      for (int i = indexFrom; i < indexTo; i++) {

        BlockSequence sequence = sequences.get(i);
        BlockConfigurationEntry blockConfig = sequence.getBlockConfig();
        BlockInstance instance = new BlockInstance(blockConfig, state);
        instances.add(instance);
      }
    }
    return instances;
  }
View Full Code Here

      @RequestParam(defaultValue = "0") int scheduleDeviation,
      @RequestParam(defaultValue = "0.0") double noise) {

    AgencyAndId bid = AgencyAndIdLibrary.convertFromString(blockId);

    BlockInstance blockInstance = _blockCalendarService.getBlockInstance(bid,
        serviceDate);

    CurrentVehicleEstimateQueryBean bean = new CurrentVehicleEstimateQueryBean();

    long time = System.currentTimeMillis();

    List<Record> records = new ArrayList<Record>();

    for (int i = 0; i < 5 * 60; i += 30) {

      int scheduleTime = (int) ((time - blockInstance.getServiceDate()) / 1000
          - scheduleDeviation - i);

      ScheduledBlockLocation location = _scheduledBlockLocationService.getScheduledBlockLocationFromScheduledTime(
          blockInstance.getBlock(), scheduleTime);

      if (location != null) {

        CoordinatePoint p = applyNoiseToLocation(location.getLocation(), noise);

View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

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.