Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.Stop


   }

   @GET
   @Path("/stops/{stopId}/routes")
   public Response getRoutesForStop (@PathParam("stopId") String stopId) {
       Stop stop = index.stopForId.get(GtfsLibrary.convertIdFromString(stopId));
       if (stop == null) return Response.status(Status.NOT_FOUND).entity(MSG_404).build();
       Set<Route> routes = Sets.newHashSet();
       for (TripPattern pattern : index.patternsForStop.get(stop)) {
           routes.add(pattern.route);
       }
View Full Code Here


   @GET
   @Path("/stops/{stopId}/patterns")
   public Response getPatternsForStop (@PathParam("stopId") String stopIdString) {
       AgencyAndId id = GtfsLibrary.convertIdFromString(stopIdString);
       Stop stop = index.stopForId.get(id);
       if (stop == null) return Response.status(Status.NOT_FOUND).entity(MSG_404).build();
       Collection<TripPattern> patterns = index.patternsForStop.get(stop);
       return Response.status(Status.OK).entity(PatternShort.list(patterns)).build();
   }
View Full Code Here

    /** Return upcoming vehicle arrival/departure times at the given stop. */
    @GET
    @Path("/stops/{stopId}/stoptimes")
    public Response getStoptimesForStop (@PathParam("stopId") String stopIdString) {
        Stop stop = index.stopForId.get(GtfsLibrary.convertIdFromString(stopIdString));
        if (stop == null) return Response.status(Status.NOT_FOUND).entity(MSG_404).build();
        return Response.status(Status.OK).entity(index.stopTimesForStop(stop)).build();
    }
View Full Code Here

       // Filter routes to include only those that pass through all given stops
       if (stopIds != null) {
           // Protective copy, we are going to calculate the intersection destructively
           routes = Lists.newArrayList(routes);
           for (String stopId : stopIds) {
               Stop stop = index.stopForId.get(GtfsLibrary.convertIdFromString(stopId));
               if (stop == null) return Response.status(Status.NOT_FOUND).entity(MSG_404).build();
               Set<Route> routesHere = Sets.newHashSet();
               for (TripPattern pattern : index.patternsForStop.get(stop)) {
                   routesHere.add(pattern.route);
               }
View Full Code Here

     * feed publisher cannot ensure stable trip IDs. Therefore we define some additional hash functions.
     */
    public HashCode semanticHash(HashFunction hashFunction) {
        Hasher hasher = hashFunction.newHasher();
        for (int s = 0; s < size; s++) {
            Stop stop = stops[s];
            // Truncate the lat and lon to 6 decimal places in case they move slightly between feed versions
            hasher.putLong((long) (stop.getLat() * 1000000));
            hasher.putLong((long) (stop.getLon() * 1000000));
        }
        // Use hops rather than stops because drop-off at stop 0 and pick-up at last stop are not important
        // and have changed between OTP versions.
        for (int hop = 0; hop < size - 1; hop++) {
            hasher.putInt(pickups[hop]);
View Full Code Here

        // Validate result
        assertEquals("15.1", trips.get(0).getId().getId());
        assertEquals("5.1", trips.get(1).getId().getId());

        // Add forbidden transfer to table
        Stop stopV = new Stop();
        stopV.setId(new AgencyAndId("agency", "V"));
        Stop stopI = new Stop();
        stopI.setId(new AgencyAndId("agency", "I"));
        table.addTransferTime(stopV, stopI, null, null, null, null,
                StopTransfer.FORBIDDEN_TRANSFER);

        // Plan journey
        path = planJourney(options);
View Full Code Here

        // Validate result
        assertEquals("8.1", trips.get(0).getId().getId());
        assertEquals("4.2", trips.get(1).getId().getId());

        // Add timed transfer to table
        Stop stopK = new Stop();
        stopK.setId(new AgencyAndId("agency", "K"));
        Stop stopF = new Stop();
        stopF.setId(new AgencyAndId("agency", "F"));
        table.addTransferTime(stopK, stopF, null, null, null, null, StopTransfer.TIMED_TRANSFER);
        // Don't forget to also add a TimedTransferEdge
        Vertex fromVertex = graph.getVertex("agency:K_arrive");
        Vertex toVertex = graph.getVertex("agency:F_depart");
        TimedTransferEdge timedTransferEdge = new TimedTransferEdge(fromVertex, toVertex);
View Full Code Here

        assertFalse(options.ignoreRealtimeUpdates);
       
        // Create (very simple) new graph
        Graph graph = new Graph();
       
        Stop stop1 = new Stop();
        stop1.setId(new AgencyAndId("agency", "stop1"));
        Stop stop2 = new Stop();
        stop2.setId(new AgencyAndId("agency", "stop2"));
       
        Vertex from = new TransitStop(graph, stop1);
        Vertex to = new TransitStop(graph, stop2);
       
        // Create dummy TimetableResolver
View Full Code Here

    /**
     * Test different stop matchers
     */
    public void testStopMatcher() {
        Stop s1 = new Stop();
        s1.setId(new AgencyAndId("A1", "42"));
        Stop s2 = new Stop();
        s2.setId(new AgencyAndId("A1", "43"));

        StopMatcher emptyMatcher = StopMatcher.emptyMatcher();
        assertFalse(emptyMatcher.matches(s1));
        assertFalse(emptyMatcher.matches(s2));

View Full Code Here

    /**
     * Test different stop matchers including stops with parents
     */
    public void testStopMatcherParents() {
        Stop parent = new Stop();
        parent.setId(new AgencyAndId("A1", "10"));
        Stop s1 = new Stop();
        s1.setId(new AgencyAndId("A1", "42"));
        s1.setParentStation("10");
        Stop s2 = new Stop();
        s2.setId(new AgencyAndId("A1", "43"));
        s2.setParentStation("10");
       
        StopMatcher matcherParent = StopMatcher.parse("A1:10");
        assertTrue(matcherParent.matches(parent));
        assertTrue(matcherParent.matches(s1));
        assertTrue(matcherParent.matches(s2));
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.