Package org.onebusaway.transit_data_federation.impl.transit_graph

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl


    /****
     * Block A
     ****/

    BlockEntryImpl blockA = block("a");

    TripEntryImpl tripA = trip("a", "s1");

    stopTime(0, stopA, tripA, 0, 10, 0);
    stopTime(0, stopB, tripA, 20, 20, 0);

    FrequencyEntry freqA1 = frequency(time(6, 00), time(9, 00), 10);
    FrequencyEntry freqA2 = frequency(time(15, 00), time(18, 00), 10);
    List<FrequencyEntry> freqsA = Arrays.asList(freqA1, freqA2);

    linkBlockTrips(blockA, freqsA, tripA);

    /****
     * Block B
     ****/

    BlockEntryImpl blockB = block("b");

    TripEntryImpl tripB = trip("b", "s1");

    stopTime(0, stopA, tripB, 20, 30, 0);
    stopTime(0, stopB, tripB, 50, 50, 0);
View Full Code Here


    /****
     * Block A
     ****/

    BlockEntryImpl blockA = block("a");

    TripEntryImpl tripA = trip("a", "s1");

    stopTime(0, stopA, tripA, 0, 10, 0);
    stopTime(0, stopB, tripA, 20, 20, 0);

    FrequencyEntry freqA1 = frequency(time(6, 00), time(9, 00), 10);
    FrequencyEntry freqA2 = frequency(time(15, 00), time(18, 00), 10);
    List<FrequencyEntry> freqsA = Arrays.asList(freqA1, freqA2);

    linkBlockTrips(blockA, freqsA, tripA);

    /****
     * Block B
     ****/

    BlockEntryImpl blockB = block("b");

    TripEntryImpl tripB = trip("b", "s1");

    stopTime(0, stopA, tripB, 20, 30, 0);
    stopTime(0, stopB, tripB, 50, 50, 0);
View Full Code Here

    StopEntryImpl stop = stop("10020", 47.0, -122.0);
    TripEntryImpl trip = trip("TripA");
    trip.setRoute(route);
    trip.setDirectionId("1");
    stopTime(0, stop, trip, time(8, 53), 0);
    BlockEntryImpl block = block("block");
    BlockConfigurationEntry blockConfig = blockConfiguration(block,
        serviceIds(lsids("a"), lsids()), trip);

    BlockInstance blockInstance = new BlockInstance(blockConfig,
        System.currentTimeMillis());
View Full Code Here

    StopEntryImpl stop = stop("10020", 47.0, -122.0);
    TripEntryImpl trip = trip("TripA");
    trip.setRoute(route);
    trip.setDirectionId("1");
    stopTime(0, stop, trip, time(8, 53), 0);
    BlockEntryImpl block = block("block");
    BlockConfigurationEntry blockConfig = blockConfiguration(block,
        serviceIds(lsids("a"), lsids()), trip);

    BlockTripInstance blockTripInstance = new BlockTripInstance(
        blockConfig.getTrips().get(0), new InstanceState(
View Full Code Here

    Mockito.when(_entitySource.getTrip("tripA")).thenReturn(tripA);
    Mockito.when(_entitySource.getTrip("tripB")).thenReturn(tripB);
    Mockito.when(_entitySource.getTrip("tripC")).thenReturn(tripC);
    Mockito.when(_entitySource.getTrip("tripD")).thenReturn(tripD);

    BlockEntryImpl blockA = block("blockA");
    BlockEntryImpl blockB = block("blockB");

    BlockConfigurationEntry blockConfigA = blockConfiguration(blockA,
        serviceIds("s1"), tripA, tripB);
    BlockConfigurationEntry blockConfigB = blockConfiguration(blockB,
        serviceIds("s1"), tripC, tripD);

    BlockInstance blockInstanceA = new BlockInstance(blockConfigA, 0L);
    BlockInstance blockInstanceB = new BlockInstance(blockConfigB, 0L);

    Mockito.when(
        _blockCalendarService.getActiveBlocks(Mockito.eq(blockA.getId()),
            Mockito.anyLong(), Mockito.anyLong())).thenReturn(
        Arrays.asList(blockInstanceA));
    Mockito.when(
        _blockCalendarService.getActiveBlocks(Mockito.eq(blockB.getId()),
            Mockito.anyLong(), Mockito.anyLong())).thenReturn(
        Arrays.asList(blockInstanceB));

    FeedMessage.Builder vehiclePositions = createFeed();
    // FeedEntity.Builder vehiclePositionEntity = FeedEntity.newBuilder();
    // vehiclePositions.addEntity(vehiclePositionEntity);

    List<CombinedTripUpdatesAndVehiclePosition> groups = _library.groupTripUpdatesAndVehiclePositions(
        tripUpdates.build(), vehiclePositions.build());

    assertEquals(2, groups.size());

    Collections.sort(groups);

    CombinedTripUpdatesAndVehiclePosition group = groups.get(0);
    assertSame(blockA, group.block.getBlockEntry());
    assertEquals(2, group.tripUpdates.size());
    TripUpdate tripUpdate = group.tripUpdates.get(0);
    assertEquals("tripA", tripUpdate.getTrip().getTripId());
    tripUpdate = group.tripUpdates.get(1);
    assertEquals("tripB", tripUpdate.getTrip().getTripId());

    group = groups.get(1);
    assertSame(blockB, group.block.getBlockEntry());
    assertEquals(2, group.tripUpdates.size());
    tripUpdate = group.tripUpdates.get(0);
    assertEquals("tripC", tripUpdate.getTrip().getTripId());
    tripUpdate = group.tripUpdates.get(1);
    assertEquals("tripD", tripUpdate.getTrip().getTripId());

    VehicleLocationRecord record = _library.createVehicleLocationRecordForUpdate(groups.get(0));
    assertEquals(blockA.getId(), record.getBlockId());
    assertEquals(120, record.getScheduleDeviation(), 0.0);
    assertEquals(0L, record.getServiceDate());
    assertEquals(blockA.getId(), record.getVehicleId());

    record = _library.createVehicleLocationRecordForUpdate(groups.get(1));
    assertEquals(blockB.getId(), record.getBlockId());
    assertEquals(30, record.getScheduleDeviation(), 0.0);
    assertEquals(0L, record.getServiceDate());
    assertEquals(blockB.getId(), record.getVehicleId());
  }
View Full Code Here

    /****
     * Block A
     ****/

    BlockEntryImpl blockA = block("blockA");
    TripEntryImpl tripA = trip("tripA", "sA", 3000);

    stopTime(0, stopA, tripA, time(16, 30), time(16, 35), 1000);
    StopTimeEntryImpl stopTimeAB = stopTime(1, stopB, tripA, time(16, 40),
        time(16, 45), 2000);

    BlockConfigurationEntry blockConfigA = blockConfiguration(blockA,
        serviceIds(lsids("sA"), lsids()), tripA);
    BlockStopTimeEntry bstAA = blockConfigA.getStopTimes().get(0);
    BlockStopTimeEntry bstAB = blockConfigA.getStopTimes().get(1);

    /****
     * Block B
     ****/

    BlockEntryImpl blockB = block("blockB");
    TripEntryImpl tripB = trip("tripB", "sA", 3000);

    stopTime(2, stopA, tripB, time(16, 40), time(16, 45), 1000);
    StopTimeEntryImpl stopTimeBB = stopTime(3, stopB, tripB, time(16, 50),
        time(16, 55), 2000);
View Full Code Here

    /****
     * Block A
     ****/

    BlockEntryImpl blockA = block("a");

    TripEntryImpl tripA1 = trip("a1", "s1"); // 1
    TripEntryImpl tripA2 = trip("a2", "s1");
    TripEntryImpl tripA3 = trip("a3", "s1");

    stopTime(0, stopA, tripA1, 0, 10, 0);
    stopTime(0, stopB, tripA1, 20, 20, 0);
    stopTime(0, stopC, tripA2, 30, 30, 0);
    stopTime(0, stopA, tripA2, 40, 40, 0);
    stopTime(0, stopA, tripA3, 50, 50, 0);
    stopTime(0, stopB, tripA3, 60, 70, 0);

    BlockConfigurationEntry bcA = linkBlockTrips(blockA, tripA1, tripA2, tripA3);

    /****
     * Block B - Same trip/stop sequence as A
     ****/

    BlockEntryImpl blockB = block("b");

    TripEntryImpl tripB1 = trip("b1", "s1");
    TripEntryImpl tripB2 = trip("b2", "s1");
    TripEntryImpl tripB3 = trip("b3", "s1");

    stopTime(0, stopA, tripB1, 20, 30, 0);
    stopTime(0, stopB, tripB1, 50, 50, 0);
    stopTime(0, stopC, tripB2, 60, 60, 0);
    stopTime(0, stopA, tripB2, 70, 70, 0);
    stopTime(0, stopA, tripB3, 80, 80, 0);
    stopTime(0, stopB, tripB3, 90, 100, 0);

    BlockConfigurationEntry bcB = linkBlockTrips(blockB, tripB1, tripB2, tripB3);

    /****
     * Block C - Same stop sequence, but runs a little bit faster
     ****/

    BlockEntryImpl blockC = block("c");

    TripEntryImpl tripC1 = trip("c1", "s1");
    TripEntryImpl tripC2 = trip("c2", "s1");
    TripEntryImpl tripC3 = trip("c3", "s1");

    stopTime(0, stopA, tripC1, 40, 50, 0);
    stopTime(0, stopB, tripC1, 60, 60, 0);
    stopTime(0, stopC, tripC2, 70, 70, 0);
    stopTime(0, stopA, tripC2, 80, 80, 0);
    stopTime(0, stopA, tripC3, 85, 85, 0);
    stopTime(0, stopB, tripC3, 90, 95, 0);

    BlockConfigurationEntry bcC = linkBlockTrips(blockC, tripC1, tripC2, tripC3);

    /****
     * Block D - Same stop sequence, but with different service id
     ****/

    BlockEntryImpl blockD = block("d");

    TripEntryImpl tripD1 = trip("d1", "s1");
    TripEntryImpl tripD2 = trip("d2", "s1");
    TripEntryImpl tripD3 = trip("d3", "s2");

    stopTime(0, stopA, tripD1, 40, 50, 0);
    stopTime(0, stopB, tripD1, 70, 70, 0);
    stopTime(0, stopC, tripD2, 80, 80, 0);
    stopTime(0, stopA, tripD2, 90, 90, 0);
    stopTime(0, stopA, tripD3, 100, 100, 0);
    stopTime(0, stopB, tripD3, 110, 120, 0);

    BlockConfigurationEntry bcD = linkBlockTrips(blockD, tripD1, tripD2, tripD3);

    /****
     * Block E - One less stop
     ****/

    BlockEntryImpl blockE = block("e");

    TripEntryImpl tripE1 = trip("e1", "s1");
    TripEntryImpl tripE2 = trip("e2", "s1");
    TripEntryImpl tripE3 = trip("e3", "s1");

    stopTime(0, stopA, tripE1, 50, 60, 0);
    stopTime(0, stopB, tripE1, 80, 80, 0);
    stopTime(0, stopC, tripE2, 90, 90, 0);
    stopTime(0, stopA, tripE2, 100, 100, 0);
    stopTime(0, stopA, tripE3, 110, 110, 0);

    BlockConfigurationEntry bcE = linkBlockTrips(blockE, tripE1, tripE2, tripE3);

    /****
     * Block F - Another to group with E, but earlier
     ****/

    BlockEntryImpl blockF = block("f");

    TripEntryImpl tripF1 = trip("f1", "s1");
    TripEntryImpl tripF2 = trip("f2", "s1");
    TripEntryImpl tripF3 = trip("f3", "s1");

View Full Code Here

    /****
     * Block A
     ****/

    BlockEntryImpl blockA = block("a");

    TripEntryImpl tripA = trip("a", "s1");

    stopTime(0, stopA, tripA, 0, 10, 0);
    stopTime(0, stopB, tripA, 20, 20, 0);

    FrequencyEntry freqA1 = frequency(time(6, 00), time(9, 00), 10);
    FrequencyEntry freqA2 = frequency(time(15, 00), time(18, 00), 10);
    List<FrequencyEntry> freqsA = Arrays.asList(freqA1, freqA2);

    BlockConfigurationEntry bcA = linkBlockTrips(blockA, freqsA, tripA);

    /****
     * Block B
     ****/

    BlockEntryImpl blockB = block("b");

    TripEntryImpl tripB = trip("b", "s1");

    stopTime(0, stopA, tripB, 20, 30, 0);
    stopTime(0, stopB, tripB, 50, 50, 0);
View Full Code Here

    StopEntryImpl stopA = stop("stopA", 47.0, -122.0);
    StopEntryImpl stopB = stop("stopB", 47.1, -122.1);
    StopEntryImpl stopC = stop("stopC", 47.2, -122.2);

    BlockEntryImpl blockA = block("blockA");
    TripEntryImpl tripA = trip("tripA", "sidA");
    TripEntryImpl tripB = trip("tripB", "sidA");

    tripA.setRoute(route);
    tripA.setDirectionId("0");
View Full Code Here

    builder.setServiceIds(serviceIds);
    builder.setTrips(Arrays.asList(trips));
    builder.setTripGapDistances(new double[trips.length]);
    BlockConfigurationEntry blockConfig = builder.create();

    BlockEntryImpl blockImpl = (BlockEntryImpl) block;
    List<BlockConfigurationEntry> configs = block.getConfigurations();
    if (configs == null) {
      configs = new ArrayList<BlockConfigurationEntry>();
      blockImpl.setConfigurations(configs);
    }
    configs.add(blockConfig);

    for (TripEntry trip : trips) {
      if (trip.getBlock() == null)
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl

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.