Package org.onebusaway.transit_data_federation.services.blocks

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


    fromIndicesBySequence.keySet().retainAll(toIndicesBySequence.keySet());

    List<Pair<FrequencyStopTripIndex>> results = new ArrayList<Pair<FrequencyStopTripIndex>>();

    for (Map.Entry<FrequencyBlockTripIndex, FrequencyStopTripIndex> entry : fromIndicesBySequence.entrySet()) {
      FrequencyBlockTripIndex index = entry.getKey();
      FrequencyStopTripIndex fromStopIndex = entry.getValue();
      FrequencyStopTripIndex toStopIndex = toIndicesBySequence.get(index);

      /**
       * If the stops aren't in the requested order, then we don't include the
View Full Code Here


    List<FrequencyEntry> frequencies = Arrays.asList(frequency);

    BlockConfigurationEntry bcFreq = linkBlockTrips(block("bFreq"),
        frequencies, tripF);

    FrequencyBlockTripIndex freqIndex = _factory.createFrequencyIndexForTrips(
        bcFreq.getTrips(), frequencies);
    FrequencyStopTripIndex freqFromIndex = new FrequencyStopTripIndex(
        freqIndex, 0);
    FrequencyStopTripIndex freqToIndex = new FrequencyStopTripIndex(freqIndex,
        1);
View Full Code Here

    assertEquals(1, allIndices.size());

    List<FrequencyBlockTripIndex> indices = grep(allIndices, aid("a"));
    assertEquals(1, indices.size());

    FrequencyBlockTripIndex index = indices.get(0);

    List<TripEntry> trips = trips(index.getTrips());
    assertEquals(4, trips.size());
    assertEquals(tripA, trips.get(0));
    assertEquals(tripB, trips.get(1));
    assertEquals(tripA, trips.get(2));
    assertEquals(tripB, trips.get(3));

    List<FrequencyEntry> freqs = index.getFrequencies();
    assertEquals(Arrays.asList(freqA1, freqB1, freqA2, freqB2), freqs);

    ServiceIdActivation serviceIds = index.getServiceIds();
    assertEquals(1, serviceIds.getActiveServiceIds().size());
    assertTrue(serviceIds.getActiveServiceIds().contains(lsid("s1")));

    FrequencyServiceIntervalBlock intervalBlock = index.getServiceIntervalBlock();
    assertTrue(Arrays.equals(new int[] {
        time(6, 0), time(9, 0), time(15, 0), time(18, 0)},
        intervalBlock.getStartTimes()));
    assertTrue(Arrays.equals(new int[] {
        time(9, 0), time(15, 0), time(18, 0), time(21, 0)},
View Full Code Here

    assertEquals(2, allIndices.size());

    List<FrequencyBlockTripIndex> indices = grep(allIndices, aid("a"));
    assertEquals(1, indices.size());

    FrequencyBlockTripIndex index = indices.get(0);

    List<TripEntry> trips = trips(index.getTrips());
    assertEquals(2, trips.size());
    assertEquals(tripA, trips.get(0));
    assertEquals(tripA, trips.get(1));

    List<FrequencyEntry> freqs = index.getFrequencies();
    assertEquals(Arrays.asList(freqA1, freqA2), freqs);

    ServiceIdActivation serviceIds = index.getServiceIds();
    assertEquals(1, serviceIds.getActiveServiceIds().size());
    assertTrue(serviceIds.getActiveServiceIds().contains(lsid("s1")));

    FrequencyServiceIntervalBlock intervalBlock = index.getServiceIntervalBlock();
    assertTrue(Arrays.equals(new int[] {time(6, 0), time(15, 0)},
        intervalBlock.getStartTimes()));
    assertTrue(Arrays.equals(new int[] {time(9, 0), time(18, 0)},
        intervalBlock.getEndTimes()));

    /****
     *
     ****/

    indices = grep(allIndices, aid("b"));
    assertEquals(1, indices.size());

    index = indices.get(0);

    trips = trips(index.getTrips());
    assertEquals(2, trips.size());
    assertEquals(tripB, trips.get(0));
    assertEquals(tripB, trips.get(1));

    freqs = index.getFrequencies();
    assertEquals(Arrays.asList(freqB1, freqB2), freqs);

    serviceIds = index.getServiceIds();
    assertEquals(1, serviceIds.getActiveServiceIds().size());
    assertTrue(serviceIds.getActiveServiceIds().contains(lsid("s1")));

    intervalBlock = index.getServiceIntervalBlock();
    assertTrue(Arrays.equals(new int[] {time(8, 0), time(17, 0)},
        intervalBlock.getStartTimes()));
    assertTrue(Arrays.equals(new int[] {time(14, 0), time(20, 0)},
        intervalBlock.getEndTimes()));
  }
View Full Code Here

      List<FrequencyTripGroup> groupedTrips = ensureFrequencyTripGroups(tripsWithSameSequence);

      for (FrequencyTripGroup group : groupedTrips) {
        group.trimToSize();
        FrequencyBlockTripIndex index = createFrequencyIndexForTrips(
            group.getTrips(), group.getFrequencies());
        allIndices.add(index);
      }
    }
View Full Code Here

  public FrequencyBlockTripIndex createFrequencyIndexForTrips(
      List<BlockTripEntry> trips, List<FrequencyEntry> frequencies) {
    FrequencyServiceIntervalBlock serviceIntervalBlock = getBlockTripsAsFrequencyBlockInterval(
        trips, frequencies);
    return new FrequencyBlockTripIndex(trips, frequencies, serviceIntervalBlock);
  }
View Full Code Here

TOP

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

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.