Package org.onebusaway.transit_data_federation.services.transit_graph

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


      if (trip.getServiceId() != null)
        serviceIds.add(trip.getServiceId());
    }
    Builder builder = BlockConfigurationEntryImpl.builder();
    builder.setBlock(block);
    builder.setServiceIds(new ServiceIdActivation(
        new ArrayList<LocalizedServiceId>(serviceIds),
        new ArrayList<LocalizedServiceId>()));
    builder.setTrips(tripEntries);
    builder.setFrequencies(frequencies);
    builder.setTripGapDistances(new double[tripEntries.size()]);
View Full Code Here


      serviceIds.add(lsid(id));
    return serviceIds;
  }

  public static ServiceIdActivation serviceIds(String... ids) {
    return new ServiceIdActivation(lsids(ids), lsids());
  }
View Full Code Here

  }

  public static ServiceIdActivation serviceIds(
      List<LocalizedServiceId> activeServiceIds,
      List<LocalizedServiceId> inactiveServiceIds) {
    return new ServiceIdActivation(activeServiceIds, inactiveServiceIds);
  }
View Full Code Here

    public ServiceIdActivation getServiceIds() {
      if (_serviceIds instanceof ServiceIdActivation) {
        return (ServiceIdActivation) _serviceIds;
      } else if (_serviceIds instanceof LocalizedServiceId) {
        return new ServiceIdActivation((LocalizedServiceId) _serviceIds);
      } else {
        throw new IllegalStateException("unknown service id type: "
            + _serviceIds);
      }
    }
View Full Code Here

    return snapped;
  }

  private void extendIntervalWithIndex(ServiceDate serviceDate, Range interval,
      AbstractBlockStopTimeIndex index) {
    ServiceIdActivation serviceIds = index.getServiceIds();
    Date date = serviceDate.getAsDate(serviceIds.getTimeZone());
    if (_calendarService.areServiceIdsActiveOnServiceDate(serviceIds, date)) {
      ServiceInterval in = index.getServiceInterval();
      long tFrom = date.getTime() + in.getMinDeparture() * 1000;
      long tTo = date.getTime() + in.getMaxDeparture() * 1000;
      interval.addValue(tFrom);
View Full Code Here

    UnitTestingSupport.addDates(_calendarData, "sidA", serviceDateA,
        serviceDateB);
    UnitTestingSupport.addDates(_calendarData, "sidB", serviceDateB,
        serviceDateC);

    ServiceIdActivation ids_A_not_B = serviceIds(lsids("sidA"), lsids("sidB"));
    ServiceIdActivation ids_B_not_A = serviceIds(lsids("sidB"), lsids("sidA"));
    ServiceIdActivation ids_A_and_B = serviceIds(lsids("sidA", "sidB"), lsids());

    StopEntryImpl stopA = stop("stopA", 0.0, 0.0);
    StopEntryImpl stopB = stop("stopB", 0.0, 0.0);

    BlockEntryImpl blockA = block("blockA");
View Full Code Here

    return _sequences.size();
  }

  private static void checkSequencesHaveSameServiceids(
      List<BlockSequence> blocks) {
    ServiceIdActivation expected = blocks.get(0).getBlockConfig().getServiceIds();
    for (int i = 1; i < blocks.size(); i++) {
      ServiceIdActivation actual = blocks.get(i).getBlockConfig().getServiceIds();
      if (!expected.equals(actual))
        throw new IllegalArgumentException("serviceIds mismatch: expected="
            + expected + " actual=" + actual);
    }
  }
View Full Code Here

    Map<AgencyAndId, Set<FrequencyEntry>> frequencyLabelsByRouteCollectionId = new FactoryMap<AgencyAndId, Set<FrequencyEntry>>(
        new HashSet<FrequencyEntry>());

    for (BlockStopTimeIndex index : _blockIndexService.getStopTimeIndicesForStop(stopEntry)) {

      ServiceIdActivation serviceIds = index.getServiceIds();

      Set<ServiceDate> serviceDates = _calendarService.getServiceDatesForServiceIds(serviceIds);
      if (!serviceDates.contains(date))
        continue;

      Date serviceDate = date.getAsDate(serviceIds.getTimeZone());

      for (BlockStopTimeEntry stopTime : index.getStopTimes()) {

        BlockTripEntry blockTrip = stopTime.getTrip();
        TripEntry trip = blockTrip.getTrip();
View Full Code Here

      ServiceDate date,
      Map<AgencyAndId, List<StopTimeInstance>> frequenciesByRouteCollectionId) {

    for (FrequencyBlockStopTimeIndex index : _blockIndexService.getFrequencyStopTimeIndicesForStop(stopEntry)) {

      ServiceIdActivation serviceIds = index.getServiceIds();

      Set<ServiceDate> serviceDates = _calendarService.getServiceDatesForServiceIds(serviceIds);
      if (!serviceDates.contains(date))
        continue;

      Date serviceDate = date.getAsDate(serviceIds.getTimeZone());

      for (FrequencyBlockStopTimeEntry entry : index.getFrequencyStopTimes()) {

        BlockStopTimeEntry stopTime = entry.getStopTime();
View Full Code Here

public class BlockConfigurationEntryImplTest {

  @Test
  public void test() {

    ServiceIdActivation serviceIds = serviceIds(lsids("sA"), lsids("sB"));

    StopEntryImpl stopA = stop("stopA", 47.0, -122.0);
    StopEntryImpl stopB = stop("stopB", 47.1, -122.0);

    BlockEntryImpl block = block("blockA");
View Full Code Here

TOP

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

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.