Examples of TripEntryImpl


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

  @Test
  public void test01() {

    BlockEntryImpl block = block("blockA");
    TripEntryImpl trip = trip("tripA", "serviceId");
    stopTime(0, null, trip, time(9, 00), 0);
    BlockConfigurationEntry blockConfig = linkBlockTrips(block, trip);
    BlockInstance blockInstance = new BlockInstance(blockConfig,
        System.currentTimeMillis());
View Full Code Here

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

    StopEntryImpl stopB = stop("b", 47.6, -122.4);
    StopEntryImpl stopC = stop("c", 47.5, -122.3);

    BlockEntryImpl block = block("block");

    TripEntryImpl tripA = trip("tripA", "serviceId");
    TripEntryImpl tripB = trip("tripB", "serviceId");

    stopTime(0, stopA, tripA, 30, 90, 0);
    stopTime(1, stopB, tripA, 120, 120, 100);
    stopTime(2, stopC, tripA, 180, 210, 200);
View Full Code Here

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

  public void test04() {

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

    TripEntryImpl trip1A = trip("1A", "sA");
    TripEntryImpl trip1B = trip("1B", "sA");
    TripEntryImpl trip1C = trip("1C", "sA");
    TripEntryImpl trip1D = trip("1D", "sA");

    stopTime(0, fromStop, trip1A, time(10, 00), time(10, 05), 0.0);
    stopTime(1, fromStop, trip1B, time(10, 10), time(10, 15), 0.0);
    stopTime(2, fromStop, trip1C, time(10, 20), time(10, 25), 0.0);
    stopTime(3, fromStop, trip1D, time(10, 30), time(10, 35), 0.0);

    stopTime(4, toStop, trip1A, time(10, 10), time(10, 15), 0.0);
    stopTime(5, toStop, trip1B, time(10, 20), time(10, 25), 0.0);
    stopTime(6, toStop, trip1C, time(10, 30), time(10, 35), 0.0);
    stopTime(7, toStop, trip1D, time(10, 40), time(10, 45), 0.0);

    BlockConfigurationEntry b1A = linkBlockTrips("b1A", trip1A);
    BlockConfigurationEntry b1B = linkBlockTrips("b1B", trip1B);
    BlockConfigurationEntry b1C = linkBlockTrips("b1C", trip1C);
    BlockConfigurationEntry b1D = linkBlockTrips("b1D", trip1D);

    BlockSequenceIndex index1 = createBlockSequenceIndex(b1A, b1B, b1C, b1D);
    BlockStopSequenceIndex fromIndex1 = new BlockStopSequenceIndex(index1, 0);
    BlockStopSequenceIndex toIndex1 = new BlockStopSequenceIndex(index1, 1);

    Pair<BlockStopSequenceIndex> indexPair1 = Tuples.pair(fromIndex1, toIndex1);

    TripEntryImpl trip2A = trip("2A", "sA");
    TripEntryImpl trip2B = trip("2B", "sA");
    TripEntryImpl trip2C = trip("2C", "sA");
    TripEntryImpl trip2D = trip("2D", "sA");

    stopTime(0, fromStop, trip2A, time(10, 07), time(10, 07), 0.0);
    stopTime(1, fromStop, trip2B, time(10, 17), time(10, 17), 0.0);
    stopTime(2, fromStop, trip2C, time(10, 27), time(10, 27), 0.0);
    stopTime(3, fromStop, trip2D, time(10, 37), time(10, 37), 0.0);

    stopTime(4, toStop, trip2A, time(10, 17), time(10, 17), 0.0);
    stopTime(5, toStop, trip2B, time(10, 27), time(10, 27), 0.0);
    stopTime(6, toStop, trip2C, time(10, 37), time(10, 37), 0.0);
    stopTime(7, toStop, trip2D, time(10, 47), time(10, 47), 0.0);

    BlockConfigurationEntry b2A = linkBlockTrips("bA", trip2A);
    BlockConfigurationEntry b2B = linkBlockTrips("bB", trip2B);
    BlockConfigurationEntry b2C = linkBlockTrips("bC", trip2C);
    BlockConfigurationEntry b2D = linkBlockTrips("bD", trip2D);

    BlockSequenceIndex index2 = createBlockSequenceIndex(b2A, b2B, b2C, b2D);
    BlockStopSequenceIndex fromIndex2 = new BlockStopSequenceIndex(index2, 0);
    BlockStopSequenceIndex toIndex2 = new BlockStopSequenceIndex(index2, 1);

    Pair<BlockStopSequenceIndex> indexPair2 = Tuples.pair(fromIndex2, toIndex2);

    List<Pair<BlockStopSequenceIndex>> indices = new ArrayList<Pair<BlockStopSequenceIndex>>();
    indices.add(indexPair1);
    indices.add(indexPair2);

    Mockito.when(
        _blockIndexService.getBlockSequenceIndicesBetweenStops(fromStop, toStop)).thenReturn(
        indices);

    TripEntryImpl tripF = trip("freq", "sA");

    stopTime(0, fromStop, tripF, time(10, 00), time(10, 00), 0.0);
    stopTime(4, toStop, tripF, time(10, 05), time(10, 05), 0.0);

    FrequencyEntry frequency = new FrequencyEntryImpl(time(10, 30),
View Full Code Here

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

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

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

    stopTime(0, stopA, tripA, time(9, 00), time(9, 00), 0);
    stopTime(1, stopB, tripA, time(9, 30), time(9, 30), 100);
    stopTime(2, stopB, tripB, time(10, 00), time(10, 00), 200);
    stopTime(3, stopA, tripB, time(10, 30), time(10, 30), 300);

    linkBlockTrips(ids_A_not_B, blockA, tripA);
    linkBlockTrips(ids_A_and_B, blockA, tripA, tripB);
    linkBlockTrips(ids_B_not_A, blockA, tripB);

    BlockConfigurationEntry bcA_A_B = findBlockConfig(blockA, ids_A_not_B);
    BlockConfigurationEntry bcA_B_A = findBlockConfig(blockA, ids_B_not_A);
    BlockConfigurationEntry bcA_AB = findBlockConfig(blockA, ids_A_and_B);

    BlockEntryImpl blockB = block("blockB");
    TripEntryImpl tripC = trip("tripC", "sidA");
    TripEntryImpl tripD = trip("tripD", "sidB");
    TripEntryImpl tripE = trip("tripE", "sidA");

    stopTime(4, stopA, tripC, time(10, 00), time(10, 00), 0);
    stopTime(5, stopB, tripC, time(10, 30), time(10, 30), 0);
    stopTime(6, stopB, tripD, time(11, 00), time(11, 00), 0);
    stopTime(7, stopA, tripD, time(11, 30), time(11, 30), 0);
View Full Code Here

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

  public void before() {
    _service = new ScheduledBlockLocationServiceImpl();
    _shapePointService = Mockito.mock(ShapePointService.class);
    _service.setShapePointService(_shapePointService);

    TripEntryImpl tripA = trip("A", "serviceId", 1000.0);
    TripEntryImpl tripB = trip("B", "serviceId", 1000.0);

    tripA.setShapeId(aid("shapeA"));
    tripB.setShapeId(aid("shapeB"));

    ShapePointsFactory m = new ShapePointsFactory();
    m.setShapeId(aid("shapeA"));
    m.addPoint(47.670170374084805, -122.3875880241394);
    m.addPoint(47.66871094987642, -122.38756656646729);
View Full Code Here

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

    factory.setStopTimeEntriesFactory(stopTimeEntriesFactory);

    factory.processTrips(graph);

    TripEntryImpl entry = graph.getTripEntryForId(trip.getId());
    assertEquals(trip.getId(), entry.getId());
    assertEquals(route.getId(), entry.getRoute().getId());
    assertEquals(lsid("serviceId"), entry.getServiceId());
    assertEquals(trip.getShapeId(), entry.getShapeId());
    assertEquals(2177.1, entry.getTotalTripDistance(), 0.1);

    List<StopTimeEntry> stopTimes = entry.getStopTimes();
    assertEquals(2, stopTimes.size());

    for (StopTimeEntry stopTime : stopTimes) {
      assertSame(entry, stopTime.getTrip());
    }
View Full Code Here

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

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

    BlockEntryImpl block = block("blockA");

    TripEntryImpl tripA = trip("tripA", 1000);
    TripEntryImpl tripB = trip("tripB", 2000);
    TripEntryImpl tripC = trip("tripB", 1500);

    List<TripEntry> trips = Arrays.asList((TripEntry) tripA, tripB, tripC);

    StopTimeEntryImpl st1 = stopTime(1, stopA, tripA, time(6, 30), time(6, 35),
        200);
View Full Code Here

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

  @Test
  public void testSingleTripWithFrequencies() {

    BlockEntryImpl block = block("block");
    TripEntryImpl tripEntryA = trip("trip").setRoute(_routeEntry).setServiceId(
        _lsid).setBlock(block).setDirectionId("0");
    _graph.putTripEntry(tripEntryA);
    addStopTime(tripEntryA, stopTime().setStop(_stopA).setTime(time(7, 00)));

    BlockConfigurationEntry blockConfig = blockConfiguration(block,
        serviceIds("serviceId"), tripEntryA);

    Trip trip = new Trip();
    trip.setId(tripEntryA.getId());

    Frequency freqA = new Frequency();
    freqA.setTrip(trip);
    freqA.setStartTime(time(8, 00));
    freqA.setEndTime(time(10, 00));
View Full Code Here

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

  private List<BlockStopTimeEntry> _stopTimes;

  @Before
  public void before() {

    TripEntryImpl tripA = trip("A", "sid", 1000.0);
    TripEntryImpl tripB = trip("B", "sid", 1000.0);

    StopEntryImpl stopA = stop("stopA", 47.0, -122.0);
    StopEntryImpl stopB = stop("stopB", 47.0, -122.1);
    StopEntryImpl stopC = stop("stopC", 47.0, -122.2);
View Full Code Here

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

    Trip tripA = new Trip();
    tripA.setId(aid("tripA"));
    tripA.setRoute(_route);
    tripA.setBlockId("blockA");
    TripEntryImpl tripEntryA = trip("tripA").setRoute(_routeEntry).setServiceId(
        lsid);
    _graph.putTripEntry(tripEntryA);
    addStopTime(tripEntryA, stopTime().setStop(stop));

    Trip tripB = new Trip();
    tripB.setId(aid("tripB"));
    tripB.setRoute(_route);
    tripB.setBlockId("blockA");
    TripEntryImpl tripEntryB = trip("tripB").setRoute(_routeEntry).setServiceId(
        lsid);
    _graph.putTripEntry(tripEntryB);
    addStopTime(tripEntryB, stopTime().setStop(stop));

    Trip tripC = new Trip();
    tripC.setId(aid("tripC"));
    tripC.setRoute(_route);
    tripC.setBlockId("blockB");
    TripEntryImpl tripEntryC = trip("tripC").setRoute(_routeEntry).setServiceId(
        lsid);
    _graph.putTripEntry(tripEntryC);
    addStopTime(tripEntryC, stopTime().setStop(stop));

    Mockito.when(_dao.getTripsForRoute(_route)).thenReturn(
        Arrays.asList(tripA, tripB, tripC));

    _graph.initialize();

    _factory.processBlocks(_graph);

    List<BlockEntryImpl> blocks = _graph.getBlocks();
    assertEquals(2, blocks.size());

    BlockEntryImpl block = blocks.get(0);
    assertEquals(aid("blockB"), block.getId());
    assertSame(block, tripEntryC.getBlock());
    Mockito.verify(_blockConfigFactory).processBlockConfigurations(block,
        Arrays.asList(tripEntryC));

    block = blocks.get(1);
    assertEquals(aid("blockA"), block.getId());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.