Package org.opentripplanner.routing.edgetype

Examples of org.opentripplanner.routing.edgetype.TimedTransferEdge


        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);

        // Plan journey
        path = planJourney(options);
        trips = extractTrips(path);
        // Check whether the trips are still the same
        assertEquals("8.1", trips.get(0).getId().getId());
        assertEquals("4.2", trips.get(1).getId().getId());

        // Now apply a real-time update: let the to-trip be early by 27600 seconds,
        // resulting in a transfer time of 0 seconds
        Trip trip = graph.index.tripForId.get(new AgencyAndId("agency", "4.2"));
        TripPattern pattern = graph.index.patternForTrip.get(trip);
        applyUpdateToTripPattern(pattern, "4.2", "F", 1, 55200, 55200,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);

        // Plan journey
        path = planJourney(options);
        trips = extractTrips(path);
        // Check whether the trips are still the same
        assertEquals("8.1", trips.get(0).getId().getId());
        assertEquals("4.2", trips.get(1).getId().getId());

        // Now apply a real-time update: let the to-trip be early by 27601 seconds,
        // resulting in a transfer time of -1 seconds
        applyUpdateToTripPattern(pattern, "4.2", "F", 1, 55199, 55199,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);

        // Plan journey
        path = planJourney(options);
        trips = extractTrips(path);
        // Check whether a later second trip was taken
        assertEquals("8.1", trips.get(0).getId().getId());
        assertEquals("4.3", trips.get(1).getId().getId());

        // "Revert" the real-time update
        applyUpdateToTripPattern(pattern, "4.2", "F", 1, 82800, 82800,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);
        // Remove the timed transfer from the graph
        timedTransferEdge.detach(graph);
        // Revert the graph, thus using the original transfer table again
        reset(graph);
    }
View Full Code Here


        addTripToTripTransferTimeToTable(table, "7528", "9756", "75", "12", "750W1300", "120W1320"
                , StopTransfer.TIMED_TRANSFER);
        // Don't forget to also add a TimedTransferEdge
        Vertex fromVertex = graph.getVertex("TriMet:7528_arrive");
        Vertex toVertex = graph.getVertex("TriMet:9756_depart");
        TimedTransferEdge timedTransferEdge = new TimedTransferEdge(fromVertex, toVertex);

        // Do the planning again
        response = planner.getItineraries();
        itinerary = response.getPlan().itinerary.get(0);
        // Check the ids of the first two busses, the timed transfer should be used
        assertEquals("750W1300", itinerary.legs.get(1).tripId);
        assertEquals("120W1320", itinerary.legs.get(3).tripId);

        // Now apply a real-time update: let the to-trip be early by 240 seconds,
        // resulting in a transfer time of 0 seconds
        Trip trip = graph.index.tripForId.get(new AgencyAndId("TriMet", "120W1320"));
        TripPattern pattern = graph.index.patternForTrip.get(trip);
        applyUpdateToTripPattern(pattern, "120W1320", "9756", 22, 41580, 41580,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);

        // Do the planning again
        response = planner.getItineraries();
        itinerary = response.getPlan().itinerary.get(0);
        // Check the ids of the first two busses, the timed transfer should still be used
        assertEquals("750W1300", itinerary.legs.get(1).tripId);
        assertEquals("120W1320", itinerary.legs.get(3).tripId);

        // "Revert" the real-time update
        applyUpdateToTripPattern(pattern, "120W1320", "9756", 22, 41820, 41820,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);
        // Remove the timed transfer from the graph
        timedTransferEdge.detach(graph);
        // Revert the graph, thus using the original transfer table again
        reset(graph);
    }
View Full Code Here

        // Now add a timed transfer between two other busses
        addStopToStopTransferTimeToTable(table, "7528", "9756", StopTransfer.TIMED_TRANSFER);
        // Don't forget to also add a TimedTransferEdge
        Vertex fromVertex = graph.getVertex("TriMet:7528_arrive");
        Vertex toVertex = graph.getVertex("TriMet:9756_depart");
        TimedTransferEdge timedTransferEdge = new TimedTransferEdge(fromVertex, toVertex);

        // Do the planning again
        response = planner.getItineraries();
        itinerary = response.getPlan().itinerary.get(0);
        // Check the ids of the first two busses, the timed transfer should be used
        assertEquals("750W1300", itinerary.legs.get(1).tripId);
        assertEquals("120W1320", itinerary.legs.get(3).tripId);

        // Now apply a real-time update: let the to-trip be early by 240 seconds,
        // resulting in a transfer time of 0 seconds
        Trip trip = graph.index.tripForId.get(new AgencyAndId("TriMet", "120W1320"));
        TripPattern pattern = graph.index.patternForTrip.get(trip);
        applyUpdateToTripPattern(pattern, "120W1320", "9756", 22, 41580, 41580,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);

        // Do the planning again
        response = planner.getItineraries();
        itinerary = response.getPlan().itinerary.get(0);
        // Check the ids of the first two busses, the timed transfer should still be used
        assertEquals("750W1300", itinerary.legs.get(1).tripId);
        assertEquals("120W1320", itinerary.legs.get(3).tripId);

        // Now apply a real-time update: let the to-trip be early by 241 seconds,
        // resulting in a transfer time of -1 seconds
        applyUpdateToTripPattern(pattern, "120W1320", "9756", 22, 41579, 41579,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);

        // Do the planning again
        response = planner.getItineraries();
        itinerary = response.getPlan().itinerary.get(0);
        // The ids of the first two busses should be different
        assertFalse("190W1280".equals(itinerary.legs.get(1).tripId)
                && "751W1330".equals(itinerary.legs.get(3).tripId));

        // "Revert" the real-time update
        applyUpdateToTripPattern(pattern, "120W1320", "9756", 22, 41820, 41820,
                ScheduleRelationship.SCHEDULED, 0, serviceDate);
        // Remove the timed transfer from the graph
        timedTransferEdge.detach(graph);
        // Revert the graph, thus using the original transfer table again
        reset(graph);
    }
View Full Code Here

                            break;
                        }
                    }
                }
                if (!hasTimedTransferEdge) {
                    new TimedTransferEdge(fromVertex, toVertex);
                }
                // add to transfer table to handle specificity
                transferTable.addTransferTime(fromStop, toStop, fromRoute, toRoute, fromTrip, toTrip, StopTransfer.TIMED_TRANSFER);
                break;
            case 2:
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.edgetype.TimedTransferEdge

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.