Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.Stop


        /* Create arrive/depart vertices and hop/dwell/board/alight edges for each hop in this pattern. */
        PatternArriveVertex pav0, pav1 = null;
        PatternDepartVertex pdv0;
        int nStops = stopPattern.size;
        for (int stop = 0; stop < nStops - 1; stop++) {
            Stop s0 = stopPattern.stops[stop];
            Stop s1 = stopPattern.stops[stop + 1];
            pdv0 = new PatternDepartVertex(graph, this, stop);
            departVertices[stop] = pdv0;
            if (stop > 0) {
                pav0 = pav1;
                dwellEdges[stop] = new PatternDwell(pav0, pdv0, stop, this);
View Full Code Here


        Trip toTrip2 = new Trip();
        toTrip2.setId(new AgencyAndId("agency", "2.2"));
        toTrip2.setRoute(toRoute);
       
        // find stops
        Stop stopK = ((TransitStopArrive)graph.getVertex("agency:K_arrive")).getStop();
        Stop stopN = ((TransitStopDepart)graph.getVertex("agency:N_depart")).getStop();
        Stop stopM = ((TransitStopDepart)graph.getVertex("agency:M_depart")).getStop();
       
        assertTrue(transferTable.hasPreferredTransfers());
        assertEquals(StopTransfer.UNKNOWN_TRANSFER, transferTable.getTransferTime(stopN, stopM, fromTrip, toTrip, true));
        assertEquals(StopTransfer.FORBIDDEN_TRANSFER, transferTable.getTransferTime(stopK, stopM, fromTrip, toTrip, true));
        assertEquals(StopTransfer.PREFERRED_TRANSFER, transferTable.getTransferTime(stopN, stopK, toTrip, toTrip2, true));
View Full Code Here

        StopTime stopTime0 = new StopTime();
        StopTime stopTime1 = new StopTime();
        StopTime stopTime2 = new StopTime();

        Stop stop0 = new Stop();
        Stop stop1 = new Stop();
        Stop stop2 = new Stop();

        stop0.setId(stops[0]);
        stop1.setId(stops[1]);
        stop2.setId(stops[2]);

        stopTime0.setStop(stop0);
        stopTime0.setDepartureTime(0);
        stopTime0.setStopSequence(0);
View Full Code Here

    public TripTimes getNextTrip(State s0, ServiceDay serviceDay, int stopIndex, boolean boarding) {
        /* Search at the state's time, but relative to midnight on the given service day. */
        int time = serviceDay.secondsSinceMidnight(s0.getTimeSeconds());
        // NOTE the time is sometimes negative here. That is fine, we search for the first trip of the day.
        TripTimes bestTrip = null;
        Stop currentStop = pattern.getStop(stopIndex);
        // Linear search through the timetable looking for the best departure.
        // We no longer use a binary search on Timetables because:
        // 1. we allow combining trips from different service IDs on the same tripPattern.
        // 2. We mix frequency-based and one-off TripTimes together on tripPatterns.
        // 3. Stoptimes may change with realtime updates, and we cannot count on them being sorted.
View Full Code Here

  @Test
  public void test() {

    GtfsDao dao = Mockito.mock(GtfsDao.class);

    Stop a = new Stop();
    a.setLat(47.664809318453564);
    a.setLon(-122.3023796081543);

    Stop b = new Stop();
    b.setLat(47.66931784410792);
    b.setLon(-122.38992691040039);

    Mockito.when(dao.getAllStops()).thenReturn(Arrays.asList(a, b));

    GtfsStopRegionsSourceImpl source = new GtfsStopRegionsSourceImpl();
    source.setGtfsDao(dao);
View Full Code Here

    StopEntry stopEntry = stop("stopA", 47.0, -122.0);

    Mockito.when(_transitGraphDao.getAllStops()).thenReturn(
        Arrays.asList(stopEntry));

    Stop stop = new Stop();
    stop.setId(stopEntry.getId());
    stop.setCode("A");
    stop.setDesc("Stop A is the best");
    stop.setLat(stopEntry.getStopLat());
    stop.setLon(stopEntry.getStopLon());
    stop.setName("Stop A");
    stop.setUrl("http://agency.gov/stop-a");

    Mockito.when(_gtfsDao.getAllStops()).thenReturn(Arrays.asList(stop));

    List<BlockStopTimeIndex> indices = Collections.emptyList();
    Mockito.when(_blockIndexService.getStopTimeIndicesForStop(stopEntry)).thenReturn(
        indices);

    _task.generateStopNarratives(_provider);

    StopNarrative narrative = _provider.getNarrativeForStopId(stopEntry.getId());
    assertEquals(stop.getCode(), narrative.getCode());
    assertEquals(stop.getDesc(), narrative.getDescription());
    assertNull(narrative.getDirection());
    assertEquals(stop.getLocationType(), narrative.getLocationType());
    assertEquals(stop.getName(), narrative.getName());
    assertEquals(stop.getUrl(), narrative.getUrl());
  }
View Full Code Here

    StopEntry stopEntry = stop("stopA", 47.0, -122.0);

    Mockito.when(_transitGraphDao.getAllStops()).thenReturn(
        Arrays.asList(stopEntry));

    Stop stop = new Stop();
    stop.setId(stopEntry.getId());
    stop.setDirection("west");
    Mockito.when(_gtfsDao.getAllStops()).thenReturn(Arrays.asList(stop));

    List<BlockStopTimeIndex> indices = Collections.emptyList();
    Mockito.when(_blockIndexService.getStopTimeIndicesForStop(stopEntry)).thenReturn(
        indices);
View Full Code Here

    StopEntryImpl stopEntry = stop("stopA", 47.663146, -122.300928);

    Mockito.when(_transitGraphDao.getAllStops()).thenReturn(
        Arrays.asList((StopEntry) stopEntry));

    Stop stop = new Stop();
    stop.setId(stopEntry.getId());
    Mockito.when(_gtfsDao.getAllStops()).thenReturn(Arrays.asList(stop));

    AgencyAndId shapeId = aid("shapeA");
    ShapePointsFactory factory = new ShapePointsFactory();
    factory.addPoint(47.661225, -122.3009201);
View Full Code Here

public class StopEntriesFactoryTest {

  @Test
  public void test() {

    Stop stopA = new Stop();
    stopA.setId(new AgencyAndId("1", "stopA"));
    stopA.setCode("A");
    stopA.setDesc("Stop A Description");
    stopA.setLat(47.0);
    stopA.setLon(-122.0);
    stopA.setLocationType(0);
    stopA.setName("Stop A");

    Stop stopB = new Stop();
    stopB.setId(new AgencyAndId("1", "stopB"));
    stopB.setCode("B");
    stopB.setDesc("Stop B Description");
    stopB.setLat(47.1);
    stopB.setLon(-122.1);
    stopB.setLocationType(0);
    stopB.setName("Stop B");

    GtfsRelationalDao dao = Mockito.mock(GtfsRelationalDao.class);
    Mockito.when(dao.getAllStops()).thenReturn(Arrays.asList(stopA, stopB));

    StopEntriesFactory factory = new StopEntriesFactory();
    factory.setGtfsDao(dao);

    TransitGraphImpl graph = new TransitGraphImpl();

    AgencyEntryImpl agency = new AgencyEntryImpl();
    agency.setId("1");
    graph.putAgencyEntry(agency);
    graph.refreshAgencyMapping();

    factory.processStops(graph);

    StopEntryImpl stopEntryA = graph.getStopEntryForId(stopA.getId());

    assertEquals(stopA.getId(), stopEntryA.getId());
    assertEquals(stopA.getLat(), stopEntryA.getStopLat(), 0);
    assertEquals(stopA.getLon(), stopEntryA.getStopLon(), 0);

    StopEntryImpl stopEntryB = graph.getStopEntryForId(stopB.getId());

    assertEquals(stopB.getId(), stopEntryB.getId());
    assertEquals(stopB.getLat(), stopEntryB.getStopLat(), 0);
    assertEquals(stopB.getLon(), stopEntryB.getStopLon(), 0);

    List<StopEntry> stops = graph.getAllStops();
    assertEquals(2, stops.size());
    assertTrue(stops.contains(stopEntryA));
    assertTrue(stops.contains(stopEntryB));
View Full Code Here

    StopEntryImpl stopEntry = stop("stopA", 47.663146, -122.300928);

    Mockito.when(_transitGraphDao.getAllStops()).thenReturn(
        Arrays.asList((StopEntry) stopEntry));

    Stop stop = new Stop();
    stop.setId(stopEntry.getId());
    Mockito.when(_gtfsDao.getAllStops()).thenReturn(Arrays.asList(stop));

    /**
     * Two shapes heading in opposite directions
     */
 
View Full Code Here

TOP

Related Classes of org.onebusaway.gtfs.model.Stop

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.