/** * @Improvment This method could be removed, if the logic was not part of the GTFS import, * but rader applyed after the GTFS model is mapped into OTP. */ @SuppressWarnings("deprecation") public static void setForTrip(org.onebusaway.gtfs.model.Trip gtfsTrip, BikeAccess access) { switch (access) { case ALLOWED: gtfsTrip.setBikesAllowed(1); gtfsTrip.setTripBikesAllowed(2); break; case NOT_ALLOWED: gtfsTrip.setBikesAllowed(2); gtfsTrip.setTripBikesAllowed(1); break; case UNKNOWN: gtfsTrip.setBikesAllowed(0); gtfsTrip.setTripBikesAllowed(0); break; } } }
switch (gtfsTrip.getBikesAllowed()) { case 1: return ALLOWED; return NOT_ALLOWED; switch (gtfsTrip.getTripBikesAllowed()) { case 1: return NOT_ALLOWED; return ALLOWED; org.onebusaway.gtfs.model.Route route = gtfsTrip.getRoute(); switch (route.getBikesAllowed()) { case 1: return ALLOWED; return NOT_ALLOWED; switch (route.getRouteBikesAllowed()) { case 1: return NOT_ALLOWED;
/** Map from GTFS to OTP model, {@code null} safe. */ public static FeedScopedId mapAgencyAndId(org.onebusaway.gtfs.model.AgencyAndId id) { return id == null ? null : new FeedScopedId(id.getAgencyId(), id.getId()); } }
private StopTime doMap(org.onebusaway.gtfs.model.StopTime rhs) { StopTime lhs = new StopTime(); lhs.setTrip(tripMapper.map(rhs.getTrip())); lhs.setStop(stopMapper.map(rhs.getStop())); lhs.setArrivalTime(rhs.getArrivalTime()); lhs.setDepartureTime(rhs.getDepartureTime()); lhs.setTimepoint(rhs.getTimepoint()); lhs.setStopSequence(rhs.getStopSequence()); lhs.setStopHeadsign(rhs.getStopHeadsign()); lhs.setRouteShortName(rhs.getRouteShortName()); lhs.setPickupType(rhs.getPickupType()); lhs.setDropOffType(rhs.getDropOffType()); lhs.setShapeDistTraveled(rhs.getShapeDistTraveled()); lhs.setFarePeriodId(rhs.getFarePeriodId()); // Skip mapping of proxy // private transient StopTimeProxy proxy; if (rhs.getProxy() != null) { throw new IllegalStateException("Did not expect proxy to be set!"); } return lhs; }
private Trip doMap(org.onebusaway.gtfs.model.Trip rhs) { Trip lhs = new Trip(); lhs.setId(AgencyAndIdMapper.mapAgencyAndId(rhs.getId())); lhs.setRoute(routeMapper.map(rhs.getRoute())); lhs.setServiceId(AgencyAndIdMapper.mapAgencyAndId(rhs.getServiceId())); lhs.setTripShortName(rhs.getTripShortName()); lhs.setTripHeadsign(rhs.getTripHeadsign()); lhs.setRouteShortName(rhs.getRouteShortName()); lhs.setDirectionId(rhs.getDirectionId()); lhs.setBlockId(rhs.getBlockId()); lhs.setShapeId(AgencyAndIdMapper.mapAgencyAndId(rhs.getShapeId())); lhs.setWheelchairAccessible(rhs.getWheelchairAccessible()); lhs.setTripBikesAllowed(rhs.getTripBikesAllowed()); lhs.setBikesAllowed(rhs.getBikesAllowed()); lhs.setFareId(rhs.getFareId()); return lhs; }
private Stop doMap(org.onebusaway.gtfs.model.Stop rhs) { Stop lhs = new Stop(); lhs.setId(mapAgencyAndId(rhs.getId())); lhs.setName(rhs.getName()); lhs.setLat(rhs.getLat()); lhs.setLon(rhs.getLon()); lhs.setCode(rhs.getCode()); lhs.setDesc(rhs.getDesc()); lhs.setZoneId(rhs.getZoneId()); lhs.setUrl(rhs.getUrl()); lhs.setLocationType(rhs.getLocationType()); lhs.setParentStation(rhs.getParentStation()); lhs.setWheelchairBoarding(rhs.getWheelchairBoarding()); lhs.setDirection(rhs.getDirection()); lhs.setTimezone(rhs.getTimezone()); lhs.setVehicleType(rhs.getVehicleType()); lhs.setPlatformCode(rhs.getPlatformCode()); return lhs; } }
String agencyId = agency.getId(); LOG.info("This Agency has the ID {}", agencyId); agency.setId(generatedAgencyId); agencyId = generatedAgencyId; shapePoint.getShapeId().setAgencyId(reader.getDefaultAgencyId()); route.getId().setAgencyId(reader.getDefaultAgencyId()); generateRouteColor(route); stop.getId().setAgencyId(reader.getDefaultAgencyId()); trip.getId().setAgencyId(reader.getDefaultAgencyId()); serviceCalendar.getServiceId().setAgencyId(reader.getDefaultAgencyId()); serviceCalendarDate.getServiceId().setAgencyId(reader.getDefaultAgencyId()); fareAttribute.getId().setAgencyId(reader.getDefaultAgencyId()); pathway.getId().setAgencyId(reader.getDefaultAgencyId());
private Route doMap(org.onebusaway.gtfs.model.Route rhs) { Route lhs = new Route(); lhs.setId(AgencyAndIdMapper.mapAgencyAndId(rhs.getId())); lhs.setAgency(agencyMapper.map(rhs.getAgency())); lhs.setShortName(rhs.getShortName()); lhs.setLongName(rhs.getLongName()); lhs.setType(rhs.getType()); lhs.setDesc(rhs.getDesc()); lhs.setUrl(rhs.getUrl()); lhs.setColor(rhs.getColor()); lhs.setTextColor(rhs.getTextColor()); lhs.setRouteBikesAllowed(rhs.getRouteBikesAllowed()); lhs.setBikesAllowed(rhs.getBikesAllowed()); lhs.setSortOrder(rhs.getSortOrder()); lhs.setBrandingUrl(rhs.getBrandingUrl()); return lhs; } }
private Agency doMap(org.onebusaway.gtfs.model.Agency rhs) { Agency lhs = new Agency(); lhs.setId(rhs.getId()); lhs.setName(rhs.getName()); lhs.setUrl(rhs.getUrl()); lhs.setTimezone(rhs.getTimezone()); lhs.setLang(rhs.getLang()); lhs.setPhone(rhs.getPhone()); lhs.setFareUrl(rhs.getFareUrl()); lhs.setBrandingUrl(rhs.getBrandingUrl()); return lhs; } }
private Frequency doMap(org.onebusaway.gtfs.model.Frequency rhs) { Frequency lhs = new Frequency(); lhs.setTrip(tripMapper.map(rhs.getTrip())); lhs.setStartTime(rhs.getStartTime()); lhs.setEndTime(rhs.getEndTime()); lhs.setHeadwaySecs(rhs.getHeadwaySecs()); lhs.setExactTimes(rhs.getExactTimes()); lhs.setLabelOnly(rhs.getLabelOnly()); return lhs; } }
private ShapePoint doMap(org.onebusaway.gtfs.model.ShapePoint rhs) { ShapePoint lhs = new ShapePoint(); lhs.setShapeId(AgencyAndIdMapper.mapAgencyAndId(rhs.getShapeId())); lhs.setSequence(rhs.getSequence()); lhs.setLat(rhs.getLat()); lhs.setLon(rhs.getLon()); lhs.setDistTraveled(rhs.getDistTraveled()); // Skip mapping of proxy // private transient StopTimeProxy proxy; if (rhs.getProxy() != null) { throw new IllegalStateException("Did not expect proxy to be set! Data: " + rhs); } return lhs; } }
private ServiceCalendar doMap(org.onebusaway.gtfs.model.ServiceCalendar rhs) { ServiceCalendar lhs = new ServiceCalendar(); lhs.setServiceId(mapAgencyAndId(rhs.getServiceId())); lhs.setMonday(rhs.getMonday()); lhs.setTuesday(rhs.getTuesday()); lhs.setWednesday(rhs.getWednesday()); lhs.setThursday(rhs.getThursday()); lhs.setFriday(rhs.getFriday()); lhs.setSaturday(rhs.getSaturday()); lhs.setSunday(rhs.getSunday()); lhs.setStartDate(ServiceDateMapper.mapServiceDate(rhs.getStartDate())); lhs.setEndDate(ServiceDateMapper.mapServiceDate(rhs.getEndDate())); return lhs; } }
private FareAttribute doMap(org.onebusaway.gtfs.model.FareAttribute rhs) { FareAttribute lhs = new FareAttribute(); lhs.setId(mapAgencyAndId(rhs.getId())); lhs.setPrice(rhs.getPrice()); lhs.setCurrencyType(rhs.getCurrencyType()); lhs.setPaymentMethod(rhs.getPaymentMethod()); lhs.setTransfers(rhs.getTransfers()); lhs.setTransferDuration(rhs.getTransferDuration()); lhs.setYouthPrice(rhs.getYouthPrice()); lhs.setSeniorPrice(rhs.getSeniorPrice()); lhs.setJourneyDuration(rhs.getJourneyDuration()); return lhs; } }
private FareRule doMap(org.onebusaway.gtfs.model.FareRule rhs) { FareRule lhs = new FareRule(); lhs.setFare(fareAttributeMapper.map(rhs.getFare())); lhs.setRoute(routeMapper.map(rhs.getRoute())); lhs.setOriginId(rhs.getOriginId()); lhs.setDestinationId(rhs.getDestinationId()); lhs.setContainsId(rhs.getContainsId()); return lhs; } }
private Transfer doMap(org.onebusaway.gtfs.model.Transfer rhs) { Transfer lhs = new Transfer(); lhs.setFromStop(stopMapper.map(rhs.getFromStop())); lhs.setFromRoute(routeMapper.map(rhs.getFromRoute())); lhs.setFromTrip(tripMapper.map(rhs.getFromTrip())); lhs.setToStop(stopMapper.map(rhs.getToStop())); lhs.setToRoute(routeMapper.map(rhs.getToRoute())); lhs.setToTrip(tripMapper.map(rhs.getToTrip())); lhs.setTransferType(rhs.getTransferType()); lhs.setMinTransferTime(rhs.getMinTransferTime()); return lhs; } }
private Pathway doMap(org.onebusaway.gtfs.model.Pathway rhs) { Pathway lhs = new Pathway(); lhs.setId(AgencyAndIdMapper.mapAgencyAndId(rhs.getId())); lhs.setPathwayType(rhs.getPathwayType()); lhs.setFromStop(stopMapper.map(rhs.getFromStop())); lhs.setToStop(stopMapper.map(rhs.getToStop())); lhs.setTraversalTime(rhs.getTraversalTime()); lhs.setWheelchairTraversalTime(rhs.getWheelchairTraversalTime()); return lhs; } }
String routeColor = route.getColor(); String textColor = route.getTextColor(); textColor = "FFFFFF"; route.setTextColor(textColor);
private ServiceCalendarDate doMap(org.onebusaway.gtfs.model.ServiceCalendarDate rhs) { ServiceCalendarDate lhs = new ServiceCalendarDate(); lhs.setServiceId(AgencyAndIdMapper.mapAgencyAndId(rhs.getServiceId())); lhs.setDate(ServiceDateMapper.mapServiceDate(rhs.getDate())); lhs.setExceptionType(rhs.getExceptionType()); return lhs; }
private FeedInfo doMap(org.onebusaway.gtfs.model.FeedInfo rhs) { FeedInfo lhs = new FeedInfo(); lhs.setId(rhs.getId()); lhs.setPublisherName(rhs.getPublisherName()); lhs.setPublisherUrl(rhs.getPublisherUrl()); lhs.setLang(rhs.getLang()); lhs.setStartDate(mapServiceDate(rhs.getStartDate())); lhs.setEndDate(mapServiceDate(rhs.getEndDate())); lhs.setVersion(rhs.getVersion()); return lhs; } }
Agency a = new Agency("Potters Talent Agency ... EN6 2: UK, " + "Megan Speegle:Daron ... 2598052, All");