Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.AgencyAndId


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

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


        if (arg == null) {
            return null;
        }
        ArrayList<AgencyAndId> result = new ArrayList<AgencyAndId>();
        for (AgencyAndIdType a : arg)
            result.add(new AgencyAndId(a.agency, a.id));
        return result;
    }
View Full Code Here

    @Override
    public AgencyAndId unmarshal(AgencyAndIdType arg) throws Exception {
        if (arg == null) {
            return null;
        }
        return new AgencyAndId(arg.agency, arg.id);
    }
View Full Code Here

    @Override
    public AgencyAndIdType marshal(Stop arg) throws Exception {
        if (arg == null) {
            return null;
        }
        AgencyAndId id = arg.getId();
        return new AgencyAndIdType(id.getAgencyId(), id.getId());
    }
View Full Code Here

        Stop trainStopInterline = new Stop();
        Stop trainStopArrive = new Stop();
        Stop ferryStopDepart = new Stop();
        Stop ferryStopArrive = new Stop();

        trainStopDepart.setId(new AgencyAndId("Train", "Depart"));
        trainStopDepart.setName("Train stop depart");
        trainStopDepart.setLon(1);
        trainStopDepart.setLat(1);
        trainStopDepart.setCode("Train depart code");
        trainStopDepart.setPlatformCode("Train depart platform");
        trainStopDepart.setZoneId("Train depart zone");
        trainStopDwell.setId(new AgencyAndId("Train", "Dwell"));
        trainStopDwell.setName("Train stop dwell");
        trainStopDwell.setLon(45);
        trainStopDwell.setLat(23);
        trainStopDwell.setCode("Train dwell code");
        trainStopDwell.setPlatformCode("Train dwell platform");
        trainStopDwell.setZoneId("Train dwell zone");
        trainStopInterline.setId(new AgencyAndId("Train", "Interline"));
        trainStopInterline.setName("Train stop interline");
        trainStopInterline.setLon(89);
        trainStopInterline.setLat(45);
        trainStopInterline.setCode("Train interline code");
        trainStopInterline.setPlatformCode("Train interline platform");
        trainStopInterline.setZoneId("Train interline zone");
        trainStopArrive.setId(new AgencyAndId("Train", "Arrive"));
        trainStopArrive.setName("Train stop arrive");
        trainStopArrive.setLon(133);
        trainStopArrive.setLat(67);
        trainStopArrive.setCode("Train arrive code");
        trainStopArrive.setPlatformCode("Train arrive platform");
        trainStopArrive.setZoneId("Train arrive zone");
        ferryStopDepart.setId(new AgencyAndId("Ferry", "Depart"));
        ferryStopDepart.setName("Ferry stop depart");
        ferryStopDepart.setLon(135);
        ferryStopDepart.setLat(67);
        ferryStopDepart.setCode("Ferry depart code");
        ferryStopDepart.setPlatformCode("Ferry depart platform");
        ferryStopDepart.setZoneId("Ferry depart zone");
        ferryStopArrive.setId(new AgencyAndId("Ferry", "Arrive"));
        ferryStopArrive.setName("Ferry stop arrive");
        ferryStopArrive.setLon(179);
        ferryStopArrive.setLat(89);
        ferryStopArrive.setCode("Ferry arrive code");
        ferryStopArrive.setPlatformCode("Ferry arrive platform");
        ferryStopArrive.setZoneId("Ferry arrive zone");

        ArrayList<Stop> firstStops = new ArrayList<Stop>();
        ArrayList<Stop> secondStops = new ArrayList<Stop>();
        ArrayList<Stop> thirdStops = new ArrayList<Stop>();

        firstStops.add(trainStopDepart);
        firstStops.add(trainStopDwell);
        firstStops.add(trainStopInterline);
        secondStops.add(trainStopInterline);
        secondStops.add(trainStopArrive);
        thirdStops.add(ferryStopDepart);
        thirdStops.add(ferryStopArrive);

        // Agencies for legs 1, 2 and 4, plus initialization
        Agency trainAgency = new Agency();
        Agency ferryAgency = new Agency();

        trainAgency.setId("Train");
        trainAgency.setName("John Train");
        trainAgency.setUrl("http://www.train.org/");
        ferryAgency.setId("Ferry");
        ferryAgency.setName("Brian Ferry");
        ferryAgency.setUrl("http://www.ferry.org/");

        // Routes for legs 1, 2 and 4, plus initialization
        Route firstRoute = new Route();
        Route secondRoute = new Route();
        Route thirdRoute = new Route();

        firstRoute.setId(new AgencyAndId("Train", "A"));
        firstRoute.setAgency(trainAgency);
        firstRoute.setShortName("A");
        firstRoute.setLongName("'A' Train");
        firstRoute.setType(2);
        firstRoute.setColor("White");
        firstRoute.setTextColor("Black");
        secondRoute.setId(new AgencyAndId("Train", "B"));
        secondRoute.setAgency(trainAgency);
        secondRoute.setShortName("B");
        secondRoute.setLongName("Another Train");
        secondRoute.setType(2);
        secondRoute.setColor("Cyan");
        secondRoute.setTextColor("Yellow");
        thirdRoute.setId(new AgencyAndId("Ferry", "C"));
        thirdRoute.setAgency(ferryAgency);
        thirdRoute.setShortName("C");
        thirdRoute.setLongName("Ferry Cross the Mersey");
        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");
View Full Code Here

    @Test
    public void testResolve() {
        ServiceDate today = new ServiceDate();
        ServiceDate yesterday = today.previous();
        ServiceDate tomorrow = today.next();
        TripPattern pattern = patternIndex.get(new AgencyAndId("agency", "1.1"));
        TimetableResolver resolver = new TimetableResolver();

        Timetable scheduled = resolver.resolve(pattern, today);
        assertEquals(scheduled, resolver.resolve(pattern, null));
View Full Code Here

    @Test(expected=ConcurrentModificationException.class)
    public void testUpdate() {
        ServiceDate today = new ServiceDate();
        ServiceDate yesterday = today.previous();
        TripPattern pattern = patternIndex.get(new AgencyAndId("agency", "1.1"));

        TimetableResolver resolver = new TimetableResolver();
        Timetable origNow = resolver.resolve(pattern, today);

        TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder();
View Full Code Here

    @Test(expected=ConcurrentModificationException.class)
    public void testCommit() {
        ServiceDate today = new ServiceDate();
        ServiceDate yesterday = today.previous();
        TripPattern pattern = patternIndex.get(new AgencyAndId("agency", "1.1"));

        TimetableResolver resolver = new TimetableResolver();

        // only return a new snapshot if there are changes
        TimetableResolver snapshot = resolver.commit();
View Full Code Here

    @Test
    public void testPurge() {
        ServiceDate today = new ServiceDate();
        ServiceDate yesterday = today.previous();
        TripPattern pattern = patternIndex.get(new AgencyAndId("agency", "1.1"));

        TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder();

        tripDescriptorBuilder.setTripId("1.1");
        tripDescriptorBuilder.setScheduleRelationship(ScheduleRelationship.CANCELED);
View Full Code Here

        Stop stopB = new Stop();
        Stop stopC = new Stop();
        Stop stopD = new Stop();
        Stop stopE = new Stop();

        stopA.setId(new AgencyAndId("Stop", "A"));
        stopA.setLon(0);
        stopA.setLat(0);
        stopB.setId(new AgencyAndId("Stop", "B"));
        stopB.setLon(0);
        stopB.setLat(3);
        stopC.setId(new AgencyAndId("Stop", "C"));
        stopC.setLon(3);
        stopC.setLat(3);
        stopD.setId(new AgencyAndId("Stop", "D"));
        stopD.setLon(3);
        stopD.setLat(0);
        stopE.setId(new AgencyAndId("Stop", "E"));
        stopE.setLon(2);
        stopE.setLat(2);

        TransitStop transitStopA = new TransitStop(graph, stopA);
        TransitStop transitStopB = new TransitStop(graph, stopB);
View Full Code Here

TOP

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

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.