Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.AgencyAndId


    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML + Q, MediaType.TEXT_XML + Q })
    public AlertPatchResponse getStopPatches(@QueryParam("agency") String agency,
            @QueryParam("id") String id) {

        AlertPatchResponse response = new AlertPatchResponse();
        Collection<AlertPatch> alertPatches = alertPatchService.getStopPatches(new AgencyAndId(agency, id));
        for (AlertPatch alertPatch : alertPatches) {
            response.addAlertPatch(alertPatch);
        }
        return response;
    }
View Full Code Here


    public AlertPatchResponse getRoutePatches(@QueryParam("agency") String agency,
            @QueryParam("id") String id) {

        AlertPatchResponse response = new AlertPatchResponse();
        Collection<AlertPatch> alertPatches =
                alertPatchService.getRoutePatches(new AgencyAndId(agency, id));
        for (AlertPatch alertPatch : alertPatches) {
            response.addAlertPatch(alertPatch);
        }
        return response;
    }
View Full Code Here

            if (alertPatch.getId() == null) {
                response.status = "Every patch must have an id";
                return response;
            }

            final AgencyAndId route = alertPatch.getRoute();
            if (route != null && route.getId().equals("")) {
                response.status = "Every route patch must have a route id";
                return response;
            }
        }
        for (AlertPatch alertPatch : alertPatches.alertPatches) {
View Full Code Here

            // TODO this apparently allows banning stops within a trip with integers. Why?
            String[] parts = tripString.split(":");
            if (parts.length < 2) continue; // throw exception?
            String agencyIdString = parts[0];
            String tripIdString = parts[1];
            AgencyAndId tripId = new AgencyAndId(agencyIdString, tripIdString);
            BannedStopSet bannedStops;
            if (parts.length == 2) {
                bannedStops = BannedStopSet.ALL;
            } else {
                bannedStops = new BannedStopSet();
View Full Code Here

            err ("Unable to parse feed-scoped ID: " + ex.getMessage());
        }       
    }
   
    public AgencyAndId toAgencyAndId () {
        return new AgencyAndId(feedId, entityId);
    }
View Full Code Here

            String routeId = routeSpec.length > 2 ? routeSpec[2] : null;
            if (routeId != null && routeId.length() == 0)
                routeId = null;
            if (agencyId != null && routeId != null && routeName == null) {
                // Case 1: specified agency ID and route ID but no route name
                retval.agencyAndRouteIds.add(new AgencyAndId(agencyId, routeId));
            } else if (agencyId != null && routeName != null && routeId == null) {
                // Case 2: specified agency ID and route name but no route ID
                retval.agencyIdAndRouteNames.add(new T2<String, String>(agencyId, routeName));
            } else if (agencyId == null && routeName != null && routeId == null) {
                // Case 3: specified route name only
View Full Code Here

        DistanceLibrary distanceLibrary = SphericalDistanceLibrary.getInstance();
        RoutingRequest opt = ctx.opt;
        opt.rctx = ctx;

        /* 1. Get the list of PatternHop for the given trip ID. */
        AgencyAndId tripId = opt.startingTransitTripId;
        Trip trip = ctx.graph.index.tripForId.get(tripId);
        TripPattern tripPattern = ctx.graph.index.patternForTrip.get(trip);
        if (tripPattern == null) {
            // TODO Shouldn't we bailout on a normal trip plan here, returning null ?
            throw new IllegalArgumentException("Unknown/invalid trip ID: " + tripId);
View Full Code Here

        TripPattern newPattern;
        TripTimes newTripTimes;
        TripTimes oldTripTimes = state0.getTripTimes();
        int arrivalTime;
        int departureTime;
        AgencyAndId tripId = state0.getTripId();

        if (options.arriveBy) {
            // traversing backward
            newPattern = ((OnboardVertex) fromv).getTripPattern();
            newTripTimes = newPattern.getResolvedTripTimes(newTrip, state0);
View Full Code Here

        int transferTime = getTransferTime(fromStop.getId(), toStop.getId(), fromTrip, toTrip);
       
        // Check parents of stops if no transfer was found
        if (transferTime == StopTransfer.UNKNOWN_TRANSFER) {
            // Find parent ids
            AgencyAndId fromStopParentId = null;
            AgencyAndId toStopParentId = null;
            if (fromStop.getParentStation() != null
                    && !fromStop.getParentStation().isEmpty()) {
                // From stop has a parent
                fromStopParentId = new AgencyAndId(fromStop.getId().getAgencyId(), fromStop.getParentStation());
            }
            if (toStop.getParentStation() != null
                    && !toStop.getParentStation().isEmpty()) {
                // To stop has a parent
                toStopParentId = new AgencyAndId(toStop.getId().getAgencyId(), toStop.getParentStation());
            }
           
            // Check parent of from stop if no transfer was found
            if (fromStopParentId != null) {
                transferTime = getTransferTime(fromStopParentId, toStop.getId(), fromTrip, toTrip);
View Full Code Here

  
   /** Return specific transit stop in the graph, by ID. */
   @GET
   @Path("/stops/{stopId}")
   public Response getStop (@PathParam("stopId") String stopIdString) {
       AgencyAndId stopId = GtfsLibrary.convertIdFromString(stopIdString);
       Stop stop = index.stopForId.get(stopId);
       if (stop != null) {
           return Response.status(Status.OK).entity(stop).build();
       } else {
           return Response.status(Status.NOT_FOUND).entity(MSG_404).build();
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.