Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.Trip


    @GET
    @Path("/trips/{tripId}/semanticHash")
    public Response getSemanticHashForTrip (@PathParam("tripId") String tripIdString) {
        AgencyAndId tripId = GtfsLibrary.convertIdFromString(tripIdString);
        Trip trip = index.tripForId.get(tripId);
        if (trip != null) {
            TripPattern pattern = index.patternForTrip.get(trip);
            String hashString = pattern.semanticHashString(trip);
            return Response.status(Status.OK).entity(hashString).build();
        } else {
View Full Code Here


    @GET
   @Path("/trips/{tripId}/stoptimes")
   public Response getStoptimesForTrip (@PathParam("tripId") String tripIdString) {
       AgencyAndId tripId = GtfsLibrary.convertIdFromString(tripIdString);
       Trip trip = index.tripForId.get(tripId);
       if (trip != null) {
           TripPattern pattern = index.patternForTrip.get(trip);
           Timetable table = pattern.scheduledTimetable;
           return Response.status(Status.OK).entity(TripTimeShort.fromTripTimes(table, trip)).build();
       } else {
View Full Code Here

        // Get all trips in order
        List<Trip> trips = new ArrayList<Trip>();
        if (path != null) {
            for (State s : path.states) {
                if (s.getBackMode() != null && s.getBackMode().isTransit()) {
                    Trip trip = s.getBackTrip();
                    if (trip != null && !trips.contains(trip)) {
                        trips.add(trip);
                    }
                }
            }
View Full Code Here

        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
View Full Code Here

     */
    public void testSpecificTransfer() {
        // Setup from trip with route
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("A1", "R1"));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("A1", "T1"));
        fromTrip.setRoute(fromRoute);
       
        // Setup to trip with route
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("A1", "R2"));
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("A1", "T2"));
        toTrip.setRoute(toRoute);
       
        // Create full SpecificTransfer
        SpecificTransfer s1 = new SpecificTransfer(fromRoute.getId(), toRoute.getId(), fromTrip.getId(), toTrip.getId(), 1);
        assertTrue(s1.matches(fromTrip, toTrip));
        assertTrue(s1.getSpecificity() == SpecificTransfer.MAX_SPECIFICITY);
        assertTrue(s1.transferTime == 1);
       
        // Create empty SpecificTransfer
        SpecificTransfer s2 = new SpecificTransfer((AgencyAndId) null, null, null, null, 2);
        assertTrue(s2.matches(fromTrip, toTrip));
        assertTrue(s2.getSpecificity() == SpecificTransfer.MIN_SPECIFICITY);
        assertTrue(s2.transferTime == 2);
       
        // Create SpecificTransfer one trip missing
        SpecificTransfer s3 = new SpecificTransfer(fromRoute.getId(), toRoute.getId(), null, toTrip.getId(), 3);
        assertTrue(s3.matches(fromTrip, toTrip));
        assertTrue(s3.getSpecificity() == 3);
        assertTrue(s3.transferTime == 3);
       
        // Create SpecificTransfer one trip different
        SpecificTransfer s4 = new SpecificTransfer(fromRoute.getId(), toRoute.getId(), new AgencyAndId("A1", "T3"), toTrip.getId(), 4);
        assertFalse(s4.matches(fromTrip, toTrip));
        assertTrue(s4.getSpecificity() == SpecificTransfer.MAX_SPECIFICITY);
        assertTrue(s4.transferTime == 4);
       
        // Create SpecificTransfer one trip and route missing
        SpecificTransfer s5 = new SpecificTransfer(null, toRoute.getId(), null, toTrip.getId(), 5);
        assertTrue(s5.matches(fromTrip, toTrip));
        assertTrue(s5.getSpecificity() == 2);
        assertTrue(s5.transferTime == 5);
       
        // Create SpecificTransfer one trip only
        SpecificTransfer s6 = new SpecificTransfer(null, null, null, toTrip.getId(), 6);
        assertTrue(s6.matches(fromTrip, toTrip));
        assertTrue(s6.getSpecificity() == 2);
        assertTrue(s6.transferTime == 6);
       
        // Create SpecificTransfer one route only
View Full Code Here

        toStop.setParentStation("S3");
       
        // Setup from trip with route
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("A1", "R1"));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("A1", "T1"));
        fromTrip.setRoute(fromRoute);
       
        // Setup to trip with route
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("A1", "R2"));
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("A1", "T2"));
        toTrip.setRoute(toRoute);
       
        // Setup second to trip with route
        Route toRoute2 = new Route();
        toRoute2.setId(new AgencyAndId("A1", "R3"));
        Trip toTrip2 = new Trip();
        toTrip2.setId(new AgencyAndId("A1", "T3"));
        toTrip2.setRoute(toRoute2);
       
        // Create transfer table
        TransferTable table = new TransferTable();
       
        // Check transfer times
View Full Code Here

     */
    public void testStopTransfer() {
        // Setup from trip with route
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("A1", "R1"));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("A1", "T1"));
        fromTrip.setRoute(fromRoute);
       
        // Setup to trip with route
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("A1", "R2"));
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("A1", "T2"));
        toTrip.setRoute(toRoute);
       
        // Setup second to trip with route
        Route toRoute2 = new Route();
        toRoute2.setId(new AgencyAndId("A1", "R3"));
        Trip toTrip2 = new Trip();
        toTrip2.setId(new AgencyAndId("A1", "T3"));
        toTrip2.setRoute(toRoute2);
       
        // Create StopTransfer
        StopTransfer transfer = new StopTransfer();
        assertEquals(StopTransfer.UNKNOWN_TRANSFER, transfer.getTransferTime(fromTrip, toTrip));
        assertEquals(StopTransfer.UNKNOWN_TRANSFER, transfer.getTransferTime(fromTrip, toTrip2));
       
        // Add empty SpecificTransfer, specificity 0
        transfer.addSpecificTransfer(new SpecificTransfer((AgencyAndId) null, null, null, null, StopTransfer.FORBIDDEN_TRANSFER));
        assertEquals(StopTransfer.FORBIDDEN_TRANSFER, transfer.getTransferTime(fromTrip, toTrip));
        assertEquals(StopTransfer.FORBIDDEN_TRANSFER, transfer.getTransferTime(fromTrip, toTrip2));
       
        // Add SpecificTransfer one route, specificity 1
        transfer.addSpecificTransfer(new SpecificTransfer(null, toRoute2.getId(), null, null, StopTransfer.PREFERRED_TRANSFER));
        assertEquals(StopTransfer.FORBIDDEN_TRANSFER, transfer.getTransferTime(fromTrip, toTrip));
        assertEquals(StopTransfer.PREFERRED_TRANSFER, transfer.getTransferTime(fromTrip, toTrip2));
       
        // Add SpecificTransfer one trip (and one ignored route), specificity 2
        transfer.addSpecificTransfer(new SpecificTransfer(null, toRoute2.getId(), null, toTrip2.getId(), StopTransfer.TIMED_TRANSFER));
        assertEquals(StopTransfer.FORBIDDEN_TRANSFER, transfer.getTransferTime(fromTrip, toTrip));
        assertEquals(StopTransfer.TIMED_TRANSFER, transfer.getTransferTime(fromTrip, toTrip2));
       
        // Add SpecificTransfer one trip and one route, specificity 3
        transfer.addSpecificTransfer(new SpecificTransfer(fromRoute.getId(), toRoute2.getId(), fromTrip.getId(), null, StopTransfer.UNKNOWN_TRANSFER));
View Full Code Here

    @Test
    public void testPreferencesPenaltyForRoute() {
        AgencyAndId agencyAndId = new AgencyAndId();
        Route route = new Route();
        Trip trip = new Trip();
        RoutingRequest routingRequest = new RoutingRequest();

        trip.setRoute(route);
        route.setId(agencyAndId);
        assertEquals(0, routingRequest.preferencesPenaltyForRoute(trip.getRoute()));
    }
View Full Code Here

     *
     * @param leg The leg to add the trip-related fields to
     * @param states The states that go with the leg
     */
    private void addTripFields(Leg leg, State[] states) {
        Trip trip = states[states.length - 1].getBackTrip();

        if (trip != null) {
            Route route = trip.getRoute();
            Agency agency = route.getAgency();
            ServiceDay serviceDay = states[states.length - 1].getServiceDay();

            leg.agencyId = agency.getId();
            leg.agencyName = agency.getName();
            leg.agencyUrl = agency.getUrl();
            leg.headsign = states[states.length - 1].getBackDirection();
            leg.route = states[states.length - 1].getBackEdge().getName();
            leg.routeColor = route.getColor();
            leg.routeId = route.getId().getId();
            leg.routeLongName = route.getLongName();
            leg.routeShortName = route.getShortName();
            leg.routeTextColor = route.getTextColor();
            leg.routeType = route.getType();
            leg.tripId = trip.getId().getId();
            leg.tripShortName = trip.getTripShortName();
            leg.tripBlockId = trip.getBlockId();

            if (serviceDay != null) {
                leg.serviceDate = serviceDay.getServiceDate().getAsString();
            }

            if (leg.headsign == null) {
                leg.headsign = trip.getTripHeadsign();
            }
        }
    }
View Full Code Here

        thirdRoute.setType(4);
        thirdRoute.setColor("Black");
        thirdRoute.setTextColor("White");

        // Trips for legs 1, 2 and 4, plus initialization
        Trip firstTrip = new Trip();
        Trip secondTrip = new Trip();
        Trip thirdTrip = new Trip();

        firstTrip.setId(new AgencyAndId("Train", "A"));
        firstTrip.setTripShortName("A");
        firstTrip.setBlockId("Alock");
        firstTrip.setRoute(firstRoute);
        BikeAccess.setForTrip(firstTrip, BikeAccess.ALLOWED);
        firstTrip.setTripHeadsign("Street Fighting Man");
        secondTrip.setId(new AgencyAndId("Train", "B"));
        secondTrip.setTripShortName("B");
        secondTrip.setBlockId("Block");
        secondTrip.setRoute(secondRoute);
        BikeAccess.setForTrip(secondTrip, BikeAccess.ALLOWED);
        secondTrip.setTripHeadsign("No Expectations");
        thirdTrip.setId(new AgencyAndId("Ferry", "C"));
        thirdTrip.setTripShortName("C");
        thirdTrip.setBlockId("Clock");
        thirdTrip.setRoute(thirdRoute);
        BikeAccess.setForTrip(thirdTrip, BikeAccess.ALLOWED);
        thirdTrip.setTripHeadsign("Handsome Molly");

        // Scheduled stop times for legs 1, 2 and 4, plus initialization and storage in a list
        StopTime trainStopDepartTime = new StopTime();
        StopTime trainStopDwellTime = new StopTime();
        StopTime trainStopInterlineFirstTime = new StopTime();
        StopTime trainStopInterlineSecondTime = new StopTime();
        StopTime trainStopArriveTime = new StopTime();
        StopTime ferryStopDepartTime = new StopTime();
        StopTime ferryStopArriveTime = new StopTime();

        trainStopDepartTime.setTrip(firstTrip);
        trainStopDepartTime.setStop(trainStopDepart);
        trainStopDepartTime.setStopSequence(Integer.MIN_VALUE);
        trainStopDepartTime.setDepartureTime(4);
        trainStopDepartTime.setPickupType(3);
        trainStopDwellTime.setTrip(firstTrip);
        trainStopDwellTime.setStop(trainStopDwell);
        trainStopDwellTime.setStopSequence(0);
        trainStopDwellTime.setArrivalTime(8);
        trainStopDwellTime.setDepartureTime(12);
        trainStopInterlineFirstTime.setTrip(firstTrip);
        trainStopInterlineFirstTime.setStop(trainStopInterline);
        trainStopInterlineFirstTime.setStopSequence(Integer.MAX_VALUE);
        trainStopInterlineFirstTime.setArrivalTime(16);
        trainStopInterlineSecondTime.setTrip(secondTrip);
        trainStopInterlineSecondTime.setStop(trainStopInterline);
        trainStopInterlineSecondTime.setStopSequence(0);
        trainStopInterlineSecondTime.setDepartureTime(20);
        trainStopArriveTime.setTrip(secondTrip);
        trainStopArriveTime.setStop(trainStopArrive);
        trainStopArriveTime.setStopSequence(1);
        trainStopArriveTime.setArrivalTime(24);
        trainStopArriveTime.setDropOffType(2);
        ferryStopDepartTime.setTrip(thirdTrip);
        ferryStopDepartTime.setStop(ferryStopDepart);
        ferryStopDepartTime.setStopSequence(-1);
        ferryStopDepartTime.setDepartureTime(32);
        ferryStopDepartTime.setPickupType(2);
        ferryStopArriveTime.setTrip(thirdTrip);
        ferryStopArriveTime.setStop(ferryStopArrive);
        ferryStopArriveTime.setStopSequence(0);
        ferryStopArriveTime.setArrivalTime(36);
        ferryStopArriveTime.setDropOffType(3);

        ArrayList<StopTime> firstStopTimes = new ArrayList<StopTime>();
        ArrayList<StopTime> secondStopTimes = new ArrayList<StopTime>();
        ArrayList<StopTime> thirdStopTimes = new ArrayList<StopTime>();

        firstStopTimes.add(trainStopDepartTime);
        firstStopTimes.add(trainStopDwellTime);
        firstStopTimes.add(trainStopInterlineFirstTime);
        secondStopTimes.add(trainStopInterlineSecondTime);
        secondStopTimes.add(trainStopArriveTime);
        thirdStopTimes.add(ferryStopDepartTime);
        thirdStopTimes.add(ferryStopArriveTime);

        // Various patterns that are required to construct a full graph path, plus initialization
        StopPattern firstStopPattern  = new StopPattern(firstStopTimes);
        StopPattern secondStopPattern = new StopPattern(secondStopTimes);
        StopPattern thirdStopPattern  = new StopPattern(thirdStopTimes);

        TripPattern firstTripPattern  = new TripPattern(firstRoute, firstStopPattern);
        TripPattern secondTripPattern = new TripPattern(secondRoute, secondStopPattern);
        TripPattern thirdTripPattern  = new TripPattern(thirdRoute, thirdStopPattern);

        TripTimes firstTripTimes  = new TripTimes(firstTrip, firstStopTimes, new Deduplicator());
        TripTimes secondTripTimes = new TripTimes(secondTrip, secondStopTimes, new Deduplicator());
        TripTimes thirdTripTimes  = new TripTimes(thirdTrip, thirdStopTimes, new Deduplicator());

        firstTripPattern.add(firstTripTimes);
        secondTripPattern.add(secondTripTimes);
        thirdTripPattern.add(thirdTripTimes);

        // Vertices for legs 1, 2 and 3
        TransitStop v6 = new TransitStop(graph, trainStopDepart);
        TransitStopDepart v8 = new TransitStopDepart(graph, trainStopDepart, v6);
        // To understand the stop indexes in the vertex constructors, look at firstStopTimes.add() etc. above
        PatternDepartVertex v10 = new PatternDepartVertex(graph, firstTripPattern, 0);
        PatternArriveVertex v12 = new PatternArriveVertex(graph, firstTripPattern, 1);
        PatternDepartVertex v14 = new PatternDepartVertex(graph, firstTripPattern, 1);
        PatternArriveVertex v16 = new PatternArriveVertex(graph, firstTripPattern, 2);
        PatternDepartVertex v18 = new PatternDepartVertex(graph, secondTripPattern, 0);
        PatternArriveVertex v20 = new PatternArriveVertex(graph, secondTripPattern, 1);
        TransitStop v24 = new TransitStop(graph, trainStopArrive);
        TransitStopArrive v22 = new TransitStopArrive(graph, trainStopArrive, v24);

        // Vertices for legs 3 and 4
        TransitStop v26 = new TransitStop(graph, ferryStopDepart);
        TransitStopDepart v28 = new TransitStopDepart(graph, ferryStopDepart, v26);
        PatternDepartVertex v30 = new PatternDepartVertex(graph, thirdTripPattern, 0);
        PatternArriveVertex v32 = new PatternArriveVertex(graph, thirdTripPattern, 1);
        TransitStop v36 = new TransitStop(graph, ferryStopArrive);
        TransitStopArrive v34 = new TransitStopArrive(graph, ferryStopArrive, v36);

        // Vertices for leg 5
        IntersectionVertex v38 = new IntersectionVertex(graph, "Vertex 38", 179, 89);
        IntersectionVertex v40 = new IntersectionVertex(graph, "Vertex 40", 180, 89);
        IntersectionVertex v42 = new IntersectionVertex(graph, "Vertex 42", 180, 90);

        // Bike rental stations for legs 5, 6 and 7, plus initialization
        BikeRentalStation enterPickupStation = new BikeRentalStation();
        BikeRentalStation exitPickupStation = new BikeRentalStation();
        BikeRentalStation enterDropoffStation = new BikeRentalStation();
        BikeRentalStation exitDropoffStation = new BikeRentalStation();

        enterPickupStation.id = "Enter pickup";
        enterPickupStation.name = "Enter pickup station";
        enterPickupStation.x = 180;
        enterPickupStation.y = 90;
        exitPickupStation.id = "Exit pickup";
        exitPickupStation.name = "Exit pickup station";
        exitPickupStation.x = 180;
        exitPickupStation.y = 90;
        enterDropoffStation.id = "Enter dropoff";
        enterDropoffStation.name = "Enter dropoff station";
        enterDropoffStation.x = 0;
        enterDropoffStation.y = 90;
        exitDropoffStation.id = "Exit dropoff";
        exitDropoffStation.name = "Exit dropoff station";
        exitDropoffStation.x = 0;
        exitDropoffStation.y = 90;

        // Vertices for legs 5 and 6
        BikeRentalStationVertex v44 = new BikeRentalStationVertex(
                graph, enterPickupStation);
        BikeRentalStationVertex v46 = new BikeRentalStationVertex(
                graph, exitPickupStation);
        IntersectionVertex v48 = new IntersectionVertex(
                graph, "Vertex 48", 180, 90);
        IntersectionVertex v50 = new IntersectionVertex(
                graph, "Vertex 50", 90, 90);

        // Vertices for leg 7
        IntersectionVertex v52 = new IntersectionVertex(
                graph, "Vertex 52", 90, 90);
        IntersectionVertex v54 = new IntersectionVertex(
                graph, "Vertex 54", 0, 90);

        // Vertices for legs 7 and 8
        BikeRentalStationVertex v56 = new BikeRentalStationVertex(
                graph, enterDropoffStation);
        BikeRentalStationVertex v58 = new BikeRentalStationVertex(
                graph, exitDropoffStation);
        StreetLocation v60 = new StreetLocation(
                graph, "Vertex 60", new Coordinate(0, 90), "Vertex 60");

        // Vertex initialization that can't be done using the constructor
        v0.setExitName("Ausfahrt");
        v2.freeFlowing = (true);
        v4.freeFlowing = (true);
        v38.freeFlowing = (true);
        v40.freeFlowing = (true);
        v42.freeFlowing = (true);
        v48.freeFlowing = (true);
        v50.freeFlowing = (true);
        v52.freeFlowing = (true);
        v54.freeFlowing = (true);

        // Elevation profiles for the street edges that will be created later
        PackedCoordinateSequence elevation3 = new PackedCoordinateSequence.Double(
                new double[]{0.0, 0.0, 3.0, 9.9}, 2);
        PackedCoordinateSequence elevation39 = new PackedCoordinateSequence.Double(
                new double[]{0.0, 9.9, 2.1, 0.1}, 2);
        PackedCoordinateSequence elevation41 = new PackedCoordinateSequence.Double(
                new double[]{0.0, 0.1, 1.9, 2.8}, 2);
        PackedCoordinateSequence elevation49 = new PackedCoordinateSequence.Double(
                new double[]{0.0, 2.8, 2.0, 2.6}, 2);
        PackedCoordinateSequence elevation53 = new PackedCoordinateSequence.Double(
                new double[]{0.0, 2.6, 1.0, 6.0}, 2);

        // Coordinate sequences and line strings for those same edges
        PackedCoordinateSequence coordinates3 = new PackedCoordinateSequence.Double(
                new double[]{0, 0, 1, 1}, 2);
        PackedCoordinateSequence coordinates25 = new PackedCoordinateSequence.Double(
                new double[]{133, 67, 135, 67}, 2);
        PackedCoordinateSequence coordinates39 = new PackedCoordinateSequence.Double(
                new double[]{179, 89, 180, 89}, 2);
        PackedCoordinateSequence coordinates41 = new PackedCoordinateSequence.Double(
                new double[]{180, 89, 180, 90}, 2);
        PackedCoordinateSequence coordinates49 = new PackedCoordinateSequence.Double(
                new double[]{180, 90, 90, 90}, 2);
        PackedCoordinateSequence coordinates53 = new PackedCoordinateSequence.Double(
                new double[]{90, 90, 0, 90}, 2);

        GeometryFactory geometryFactory = new GeometryFactory();

        LineString l3 = new LineString(coordinates3, geometryFactory);
        LineString l25 = new LineString(coordinates25, geometryFactory);
        LineString l39 = new LineString(coordinates39, geometryFactory);
        LineString l41 = new LineString(coordinates41, geometryFactory);
        LineString l49 = new LineString(coordinates49, geometryFactory);
        LineString l53 = new LineString(coordinates53, geometryFactory);

        // Edges for leg 0
        FreeEdge e1 = new FreeEdge(
                v0, v2);
        StreetWithElevationEdge e3 = new StreetWithElevationEdge(
                v2, v4, l3, "Edge 3", 3.0, StreetTraversalPermission.ALL, false);

        // Edges for legs 1 and 2
        StreetTransitLink e5 = new StreetTransitLink(
                v4, v6, false);
        PreBoardEdge e7 = new PreBoardEdge(
                v6, v8);
        TransitBoardAlight e9 = new TransitBoardAlight(
                v8, v10, 0, TraverseMode.RAIL);
        PatternHop e11 = new PatternHop(
                v10, v12, trainStopDepart, trainStopDwell, 0);
        PatternDwell e13 = new PatternDwell(
                v12, v14, 1, firstTripPattern);
        PatternHop e15 = new PatternHop(
                v14, v16, trainStopDwell, trainStopInterline, 1);
        PatternInterlineDwell e17 = new PatternInterlineDwell(
                v16, v18);
        PatternHop e19 = new PatternHop(
                v18, v20, trainStopInterline, trainStopArrive, 0);
        TransitBoardAlight e21 = new TransitBoardAlight(
                v20, v22, 1, TraverseMode.RAIL);
        PreAlightEdge e23 = new PreAlightEdge(
                v22, v24);

        // Edges for legs 3 and 4
        SimpleTransfer e25 = new SimpleTransfer(
                v24, v26, 7, l25);
        PreBoardEdge e27 = new PreBoardEdge(
                v26, v28);
        TransitBoardAlight e29 = new TransitBoardAlight(
                v28, v30, 0, TraverseMode.FERRY);
        PatternHop e31 = new PatternHop(
                v30, v32, ferryStopDepart, ferryStopArrive, 0);
        TransitBoardAlight e33 = new TransitBoardAlight(
                v32, v34, 1, TraverseMode.FERRY);
        PreAlightEdge e35 = new PreAlightEdge(
                v34, v36);
        StreetTransitLink e37 = new StreetTransitLink(
                v36, v38, true);

        // Edges for legs 5 and 6, where edges 39 and 41 have the same name to trigger stayOn = true
        AreaEdge e39 = new AreaEdge(
                v38, v40, l39, "Edge 39 / 41", 2.1, StreetTraversalPermission.ALL, false,
                new AreaEdgeList());
        StreetWithElevationEdge e41 = new StreetWithElevationEdge(
                v40, v42, l41, "Edge 39 / 41", 1.9, StreetTraversalPermission.ALL, false);
        StreetBikeRentalLink e43 = new StreetBikeRentalLink(
                v42, v44);
        RentABikeOnEdge e45 = new RentABikeOnEdge(
                v44, v46, Collections.singleton(""));
        StreetBikeRentalLink e47 = new StreetBikeRentalLink(
                v46, v48);
        StreetWithElevationEdge e49 = new StreetWithElevationEdge(
                v48, v50, l49, "Edge 49", 2.0, StreetTraversalPermission.ALL, false);

        // Edges for legs 6, 7 and 8
        LegSwitchingEdge e51 = new LegSwitchingEdge(
                v50, v52);
        StreetEdge e53p = new StreetEdge(v52, v54, l53, "Edge 53", 1.0,
                StreetTraversalPermission.ALL, false);
        PartialStreetEdge e53 = new PartialStreetEdge(e53p, v52, v54, l53, "Edge 53",
                1.0, StreetTraversalPermission.ALL, false);
        StreetBikeRentalLink e55 = new StreetBikeRentalLink(
                v54, v56);
        RentABikeOffEdge e57 = new RentABikeOffEdge(
                v56, v58, Collections.singleton(""));
        StreetBikeRentalLink e59 = new StreetBikeRentalLink(
                v58, v60);

        // Alert for testing GTFS-RT
        AlertPatch alertPatch = new AlertPatch();

        alertPatch.setTimePeriods(Collections.singletonList(new TimePeriod(0, Long.MAX_VALUE)));
        alertPatch.setAlert(Alert.createSimpleAlerts(alertsExample));

        // Edge initialization that can't be done using the constructor
        e3.setElevationProfile(elevation3, false);
        e17.add(firstTrip, secondTrip);
        e39.setElevationProfile(elevation39, false);
        e41.setElevationProfile(elevation41, false);
        e41.setHasBogusName(true);
        e49.setElevationProfile(elevation49, false);
        e53.setElevationProfile(elevation53, false);
        graph.streetNotesService.addStaticNote(e53p, Alert.createSimpleAlerts(alertsExample),
                StreetNotesService.ALWAYS_MATCHER);

        // Add an extra edge to the graph in order to generate stayOn = true for one walk step.
        new StreetEdge(v40,
                new IntersectionVertex(graph, "Extra vertex", 180, 88),
                new LineString(new PackedCoordinateSequence.Double(
                        new double[]{180, 89, 180, 88}, 2), geometryFactory),
                "Extra edge", 1.9, StreetTraversalPermission.NONE, true);

        // Various bookkeeping operations
        graph.serviceCodes.put(firstTrip.getId(), 0);
        graph.serviceCodes.put(secondTrip.getId(), 1);
        graph.serviceCodes.put(thirdTrip.getId(), 2);

        firstTripTimes.serviceCode = graph.serviceCodes.get(firstTrip.getId());
        secondTripTimes.serviceCode = graph.serviceCodes.get(secondTrip.getId());
        thirdTripTimes.serviceCode = graph.serviceCodes.get(thirdTrip.getId());

        CalendarServiceData calendarServiceData = new CalendarServiceDataStub(graph.serviceCodes.keySet());
        CalendarServiceImpl calendarServiceImpl = new CalendarServiceImpl(calendarServiceData);

        calendarServiceData.putTimeZoneForAgencyId("Train", timeZone);
View Full Code Here

TOP

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

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.