public Map<RouteDirectionStopKey, String> getStopMatches( Map<NBRoute, Route> routeMatches, Map<NBStop, List<Stop>> potentialStopMatches, GtfsRelationalDao dao) { Map<RouteDirectionStopKey, String> stopIdMappings = new HashMap<RouteDirectionStopKey, String>(); for (Map.Entry<NBRoute, Route> entry : routeMatches.entrySet()) { NBRoute nbRoute = entry.getKey(); Route gtfsRoute = entry.getValue(); Set<List<Stop>> stopSequences = getStopSequencesForRoute(dao, gtfsRoute); List<Map<Stop, Integer>> stopSequenceIndices = new ArrayList<Map<Stop, Integer>>(); for (List<Stop> stopSequence : stopSequences) { Map<Stop, Integer> index = new HashMap<Stop, Integer>(); for (int i = 0; i < stopSequence.size(); ++i) { index.put(stopSequence.get(i), i); } stopSequenceIndices.add(index); } for (NBDirection direction : nbRoute.getDirections()) { List<Match> matches = new ArrayList<Match>(); for (NBStop fromStop : direction.getStops()) { List<Stop> toStops = potentialStopMatches.get(fromStop); if (toStops.isEmpty()) { continue; } Match m = new Match(fromStop, toStops); matches.add(m); } Min<Assignment> m = new Min<Assignment>(); Assignment assignment = new Assignment(direction.getStops(), stopSequenceIndices); matches = applyDirectMatchesToAssignment(matches, assignment); recursivelyBuildAndScoreAssignment(matches, 0, assignment, m); Assignment bestAssignment = m.getMinElement(); if (bestAssignment == null) { throw new IllegalStateException(); } for (NBStop stop : direction.getStops()) { Stop gtfsStop = bestAssignment.getGtfsStopForNBStop(stop); if (gtfsStop == null) { continue; } String stopId = gtfsStop.getId().getId(); RouteDirectionStopKey key = new RouteDirectionStopKey(nbRoute.getTag(), direction.getTag(), stop.getTag()); stopIdMappings.put(key, stopId); } } } return stopIdMappings; }
public GraphIndex(Graph graph) { LOG.info("Indexing graph..."); for (String feedId : graph.getFeedIds()) { for (Agency agency : graph.getAgencies(feedId)) { Map<String, Agency> agencyForId = agenciesForFeedId.getOrDefault(feedId, new HashMap<>()); agencyForId.put(agency.getId(), agency); this.agenciesForFeedId.put(feedId, agencyForId); } } Collection<Edge> edges = graph.getEdges(); /* We will keep a separate set of all vertices in case some have the same label. * Maybe we should just guarantee unique labels. */ Set<Vertex> vertices = Sets.newHashSet(); for (Edge edge : edges) { vertices.add(edge.getFromVertex()); vertices.add(edge.getToVertex()); if (edge instanceof TablePatternEdge) { TablePatternEdge patternEdge = (TablePatternEdge) edge; TripPattern pattern = patternEdge.getPattern(); patternForId.put(pattern.code, pattern); } } for (Vertex vertex : vertices) { vertexForId.put(vertex.getLabel(), vertex); if (vertex instanceof TransitStop) { TransitStop transitStop = (TransitStop) vertex; Stop stop = transitStop.getStop(); stopForId.put(stop.getId(), stop); stopVertexForStop.put(stop, transitStop); stopsForParentStation.put(stop.getParentStation(), stop); } } for (TransitStop stopVertex : stopVertexForStop.values()) { Envelope envelope = new Envelope(stopVertex.getCoordinate()); stopSpatialIndex.insert(envelope, stopVertex); } for (TripPattern pattern : patternForId.values()) { patternsForFeedId.put(pattern.getFeedId(), pattern); patternsForRoute.put(pattern.route, pattern); for (Trip trip : pattern.getTrips()) { patternForTrip.put(trip, pattern); tripForId.put(trip.getId(), trip); } for (Stop stop : pattern.getStops()) { patternsForStop.put(stop, pattern); } } for (Route route : patternsForRoute.asMap().keySet()) { routeForId.put(route.getId(), route); } // Copy these two service indexes from the graph until we have better ones. calendarService = graph.getCalendarService(); serviceCodes = graph.serviceCodes; this.graph = graph; LOG.info("Done indexing graph."); }
public Geometry getGeometry() { if (geometry == null) { Coordinate c1 = new Coordinate(start.getLon(), start.getLat()); Coordinate c2 = new Coordinate(end.getLon(), end.getLat()); geometry = GeometryUtils.getGeometryFactory().createLineString(new Coordinate[] {c1, c2}); } return geometry; }
@SuppressWarnings("unchecked") public Map<NBStop, List<Stop>> getPotentialStopMatches( List<NBRoute> nbRoutes, Collection<Stop> gtfsStops) { Map<String, NBStop> nbStopsByTag = getStopsByTag(nbRoutes); STRtree tree = new STRtree(gtfsStops.size()); for (Stop stop : gtfsStops) { tree.insert(new Envelope(new Coordinate(stop.getLon(), stop.getLat())), stop); } tree.build(); Map<NBStop, List<Stop>> potentialMatches = new HashMap<NBStop, List<Stop>>(); int stopsWithNoMatches = 0; for (NBStop nbStop : nbStopsByTag.values()) { CoordinateBounds b = SphericalGeometryLibrary.bounds( nbStop.getLat(), nbStop.getLon(), _stopMatchingDistanceThreshold); Envelope env = new Envelope(b.getMinLon(), b.getMaxLon(), b.getMinLat(), b.getMaxLat()); List<Stop> stopsInEnvelope = tree.query(env); if (stopsInEnvelope.isEmpty()) { _log.warn( "stop with no match: tag=" + nbStop.getTag() + " lat=" + nbStop.getLat() + " lon=" + nbStop.getLon()); stopsWithNoMatches++; } potentialMatches.put(nbStop, stopsInEnvelope); } if (stopsWithNoMatches > 0) { _log.warn("stops without matches: " + stopsWithNoMatches + "/" + nbStopsByTag.size()); } return potentialMatches; }
/** * FIXME OBA parentStation field is a string, not an AgencyAndId, so it has no agency/feed scope * But the DC regional graph has no parent stations pre-defined, so no use dealing with them for * now. However Trimet stops have "landmark" or Transit Center parent stations, so we don't use * the parent stop field. * * <p>Ideally in the future stop clusters will replicate and/or share implementation with GTFS * parent stations. * * <p>We can't use a similarity comparison, we need exact matches. This is because many street * names differ by only one letter or number, e.g. 34th and 35th or Avenue A and Avenue B. * Therefore normalizing the names before the comparison is essential. The agency must provide * either parent station information or a well thought out stop naming scheme to cluster stops -- * no guessing is reasonable without that information. */ public void clusterStops() { int psIdx = 0; // unique index for next parent stop LOG.info("Clustering stops by geographic proximity and name..."); // Each stop without a cluster will greedily claim other stops without clusters. for (Stop s0 : stopForId.values()) { if (stopClusterForStop.containsKey(s0)) continue; // skip stops that have already been claimed by a cluster String s0normalizedName = StopNameNormalizer.normalize(s0.getName()); StopCluster cluster = new StopCluster(String.format("C%03d", psIdx++), s0normalizedName); // LOG.info("stop {}", s0normalizedName); // No need to explicitly add s0 to the cluster. It will be found in the spatial index query // below. Envelope env = new Envelope(new Coordinate(s0.getLon(), s0.getLat())); env.expandBy( SphericalDistanceLibrary.metersToLonDegrees(CLUSTER_RADIUS, s0.getLat()), SphericalDistanceLibrary.metersToDegrees(CLUSTER_RADIUS)); for (TransitStop ts1 : stopSpatialIndex.query(env)) { Stop s1 = ts1.getStop(); double geoDistance = SphericalDistanceLibrary.fastDistance( s0.getLat(), s0.getLon(), s1.getLat(), s1.getLon()); if (geoDistance < CLUSTER_RADIUS) { String s1normalizedName = StopNameNormalizer.normalize(s1.getName()); // LOG.info(" --> {}", s1normalizedName); // LOG.info(" geodist {} stringdist {}", geoDistance, stringDistance); if (s1normalizedName.equals(s0normalizedName)) { // Create a bidirectional relationship between the stop and its cluster cluster.children.add(s1); stopClusterForStop.put(s1, cluster); } } } cluster.computeCenter(); stopClusterForId.put(cluster.id, cluster); } // LOG.info("Done clustering stops."); // for (StopCluster cluster : stopClusterForId.values()) { // LOG.info("{} at {} {}", cluster.name, cluster.lat, cluster.lon); // for (Stop stop : cluster.children) { // LOG.info(" {}", stop.getName()); // } // } }
@Test public final void testOnBoardDepartureTime() { Coordinate[] coordinates = new Coordinate[5]; coordinates[0] = new Coordinate(0.0, 0.0); coordinates[1] = new Coordinate(0.0, 1.0); coordinates[2] = new Coordinate(2.0, 1.0); coordinates[3] = new Coordinate(5.0, 1.0); coordinates[4] = new Coordinate(5.0, 5.0); PatternDepartVertex depart = mock(PatternDepartVertex.class); PatternArriveVertex dwell = mock(PatternArriveVertex.class); PatternArriveVertex arrive = mock(PatternArriveVertex.class); Graph graph = mock(Graph.class); RoutingRequest routingRequest = mock(RoutingRequest.class); ServiceDay serviceDay = mock(ServiceDay.class); when(graph.getTimeZone()).thenReturn(TimeZone.getTimeZone("GMT")); GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); CoordinateSequenceFactory coordinateSequenceFactory = geometryFactory.getCoordinateSequenceFactory(); CoordinateSequence coordinateSequence = coordinateSequenceFactory.create(coordinates); LineString geometry = new LineString(coordinateSequence, geometryFactory); ArrayList<Edge> hops = new ArrayList<Edge>(2); RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive); AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID"); Route route = new Route(); ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(3); StopTime stopDepartTime = new StopTime(); StopTime stopDwellTime = new StopTime(); StopTime stopArriveTime = new StopTime(); Stop stopDepart = new Stop(); Stop stopDwell = new Stop(); Stop stopArrive = new Stop(); Trip trip = new Trip(); routingContext.serviceDays = new ArrayList<ServiceDay>(Collections.singletonList(serviceDay)); route.setId(agencyAndId); stopDepart.setId(agencyAndId); stopDwell.setId(agencyAndId); stopArrive.setId(agencyAndId); stopDepartTime.setStop(stopDepart); stopDepartTime.setDepartureTime(0); stopDwellTime.setArrivalTime(20); stopDwellTime.setStop(stopDwell); stopDwellTime.setDepartureTime(40); stopArriveTime.setArrivalTime(60); stopArriveTime.setStop(stopArrive); stopTimes.add(stopDepartTime); stopTimes.add(stopDwellTime); stopTimes.add(stopArriveTime); trip.setId(agencyAndId); trip.setTripHeadsign("The right"); TripTimes tripTimes = new TripTimes(trip, stopTimes, new Deduplicator()); StopPattern stopPattern = new StopPattern(stopTimes); TripPattern tripPattern = new TripPattern(route, stopPattern); when(depart.getTripPattern()).thenReturn(tripPattern); when(dwell.getTripPattern()).thenReturn(tripPattern); PatternHop patternHop0 = new PatternHop(depart, dwell, stopDepart, stopDwell, 0); PatternHop patternHop1 = new PatternHop(dwell, arrive, stopDwell, stopArrive, 1); hops.add(patternHop0); hops.add(patternHop1); when(graph.getEdges()).thenReturn(hops); when(depart.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(dwell.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(arrive.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(routingRequest.getFrom()).thenReturn(new GenericLocation()); when(routingRequest.getStartingTransitTripId()).thenReturn(agencyAndId); when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(9); patternHop0.setGeometry(geometry); tripPattern.add(tripTimes); graph.index = new GraphIndex(graph); coordinates = new Coordinate[3]; coordinates[0] = new Coordinate(3.5, 1.0); coordinates[1] = new Coordinate(5.0, 1.0); coordinates[2] = new Coordinate(5.0, 5.0); coordinateSequence = coordinateSequenceFactory.create(coordinates); geometry = new LineString(coordinateSequence, geometryFactory); Vertex vertex = onBoardDepartServiceImpl.setupDepartOnBoard(routingContext); Edge edge = vertex.getOutgoing().toArray(new Edge[1])[0]; assertEquals(vertex, edge.getFromVertex()); assertEquals(dwell, edge.getToVertex()); assertEquals("The right", edge.getDirection()); assertEquals(geometry, edge.getGeometry()); assertEquals(coordinates[0].x, vertex.getX(), 0.0); assertEquals(coordinates[0].y, vertex.getY(), 0.0); }
@Test public final void testOnBoardAtStation() { TransitStop station0 = mock(TransitStop.class); TransitStop station1 = mock(TransitStop.class); TransitStop station2 = mock(TransitStop.class); PatternDepartVertex depart = mock(PatternDepartVertex.class); PatternArriveVertex dwell = mock(PatternArriveVertex.class); PatternArriveVertex arrive = mock(PatternArriveVertex.class); Graph graph = mock(Graph.class); RoutingRequest routingRequest = mock(RoutingRequest.class); ServiceDay serviceDay = mock(ServiceDay.class); when(graph.getTimeZone()).thenReturn(TimeZone.getTimeZone("GMT")); ArrayList<Edge> hops = new ArrayList<Edge>(2); RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive); AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID"); Route route = new Route(); ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(2); StopTime stopDepartTime = new StopTime(); StopTime stopDwellTime = new StopTime(); StopTime stopArriveTime = new StopTime(); Stop stopDepart = new Stop(); Stop stopDwell = new Stop(); Stop stopArrive = new Stop(); Trip trip = new Trip(); routingContext.serviceDays = new ArrayList<ServiceDay>(Collections.singletonList(serviceDay)); route.setId(agencyAndId); stopDepart.setId(new AgencyAndId("Station", "0")); stopDwell.setId(new AgencyAndId("Station", "1")); stopArrive.setId(new AgencyAndId("Station", "2")); stopDepartTime.setStop(stopDepart); stopDepartTime.setDepartureTime(0); stopDwellTime.setArrivalTime(20); stopDwellTime.setStop(stopDwell); stopDwellTime.setDepartureTime(40); stopArriveTime.setArrivalTime(60); stopArriveTime.setStop(stopArrive); stopTimes.add(stopDepartTime); stopTimes.add(stopDwellTime); stopTimes.add(stopArriveTime); trip.setId(agencyAndId); TripTimes tripTimes = new TripTimes(trip, stopTimes, new Deduplicator()); StopPattern stopPattern = new StopPattern(stopTimes); TripPattern tripPattern = new TripPattern(route, stopPattern); when(depart.getTripPattern()).thenReturn(tripPattern); when(dwell.getTripPattern()).thenReturn(tripPattern); PatternHop patternHop0 = new PatternHop(depart, dwell, stopDepart, stopDwell, 0); PatternHop patternHop1 = new PatternHop(dwell, arrive, stopDwell, stopArrive, 1); hops.add(patternHop0); hops.add(patternHop1); when(graph.getEdges()).thenReturn(hops); when(depart.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(dwell.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(arrive.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(routingRequest.getFrom()).thenReturn(new GenericLocation()); when(routingRequest.getStartingTransitTripId()).thenReturn(agencyAndId); when(graph.getVertex("Station_0")).thenReturn(station0); when(graph.getVertex("Station_1")).thenReturn(station1); when(graph.getVertex("Station_2")).thenReturn(station2); tripPattern.add(tripTimes); graph.index = new GraphIndex(graph); when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(0); assertEquals(station0, onBoardDepartServiceImpl.setupDepartOnBoard(routingContext)); when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(20); assertEquals(station1, onBoardDepartServiceImpl.setupDepartOnBoard(routingContext)); when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(30); assertEquals(station1, onBoardDepartServiceImpl.setupDepartOnBoard(routingContext)); when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(40); assertEquals(station1, onBoardDepartServiceImpl.setupDepartOnBoard(routingContext)); when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(60); assertEquals(station2, onBoardDepartServiceImpl.setupDepartOnBoard(routingContext)); }
@Test public final void testOnBoardDepartureAtArrivalTime() { Coordinate[] coordinates = new Coordinate[2]; coordinates[0] = new Coordinate(0.0, 0.0); coordinates[1] = new Coordinate(0.0, 1.0); TransitStop station0 = mock(TransitStop.class); TransitStop station1 = mock(TransitStop.class); PatternDepartVertex depart = mock(PatternDepartVertex.class); PatternArriveVertex arrive = mock(PatternArriveVertex.class); Graph graph = mock(Graph.class); RoutingRequest routingRequest = mock(RoutingRequest.class); ServiceDay serviceDay = mock(ServiceDay.class); when(graph.getTimeZone()).thenReturn(TimeZone.getTimeZone("GMT")); when(station0.getX()).thenReturn(coordinates[0].x); when(station0.getY()).thenReturn(coordinates[0].y); when(station1.getX()).thenReturn(coordinates[1].x); when(station1.getY()).thenReturn(coordinates[1].y); RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive); AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID"); Route route = new Route(); ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(2); StopTime stopDepartTime = new StopTime(); StopTime stopArriveTime = new StopTime(); Stop stopDepart = new Stop(); Stop stopArrive = new Stop(); Trip trip = new Trip(); routingContext.serviceDays = new ArrayList<ServiceDay>(Collections.singletonList(serviceDay)); route.setId(agencyAndId); stopDepart.setId(new AgencyAndId("Station", "0")); stopArrive.setId(new AgencyAndId("Station", "1")); stopDepartTime.setStop(stopDepart); stopDepartTime.setDepartureTime(0); stopArriveTime.setArrivalTime(10); stopArriveTime.setStop(stopArrive); stopTimes.add(stopDepartTime); stopTimes.add(stopArriveTime); trip.setId(agencyAndId); TripTimes tripTimes = new TripTimes(trip, stopTimes, new Deduplicator()); StopPattern stopPattern = new StopPattern(stopTimes); TripPattern tripPattern = new TripPattern(route, stopPattern); when(depart.getTripPattern()).thenReturn(tripPattern); PatternHop patternHop = new PatternHop(depart, arrive, stopDepart, stopArrive, 0); when(graph.getEdges()).thenReturn(Collections.<Edge>singletonList(patternHop)); when(depart.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(arrive.getCoordinate()).thenReturn(new Coordinate(0, 0)); when(routingRequest.getFrom()).thenReturn(new GenericLocation()); when(routingRequest.getStartingTransitTripId()).thenReturn(agencyAndId); when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(10); when(graph.getVertex("Station_0")).thenReturn(station0); when(graph.getVertex("Station_1")).thenReturn(station1); tripPattern.add(tripTimes); graph.index = new GraphIndex(graph); Vertex vertex = onBoardDepartServiceImpl.setupDepartOnBoard(routingContext); assertEquals(coordinates[1].x, vertex.getX(), 0.0); assertEquals(coordinates[1].y, vertex.getY(), 0.0); }
private State getStateArriveBy(RaptorData data, ArrayList<RaptorState> states) { RoutingRequest options = states.get(0).getRequest(); State state = new State(options.rctx.origin, options); for (int i = states.size() - 1; i >= 0; --i) { RaptorState cur = states.get(i); if (cur.walkPath != null) { GraphPath path = new GraphPath(cur.walkPath, false); for (ListIterator<Edge> it = path.edges.listIterator(path.edges.size()); it.hasPrevious(); ) { Edge e = it.previous(); State oldState = state; state = e.traverse(state); if (state == null) { e.traverse(oldState); } } } else { // so, cur is at this point at a transit stop; we have a route to alight from if (cur.getParent() == null || !cur.getParent().interlining) { for (Edge e : state.getVertex().getIncoming()) { if (e instanceof PreAlightEdge) { state = e.traverse(state); } } TransitBoardAlight alight = cur.getRoute().alights[cur.boardStopSequence - 1][cur.patternIndex]; State oldState = state; state = alight.traverse(state); if (state == null) { state = alight.traverse(oldState); } } // now traverse the hops and dwells until we find the board we're looking for HOP: while (true) { for (Edge e : state.getVertex().getIncoming()) { if (e instanceof PatternDwell) { state = e.traverse(state); } else if (e instanceof PatternHop) { state = e.traverse(state); if (cur.interlining) { for (Edge e2 : state.getVertex().getIncoming()) { RaptorState next = states.get(i - 1); if (e2 instanceof PatternInterlineDwell) { Stop fromStop = ((TransitVertex) e2.getFromVertex()).getStop(); Stop expectedStop = next.boardStop.stopVertex.getStop(); if (fromStop.equals(expectedStop)) { State newState = e2.traverse(state); if (newState == null) continue; if (newState.getTripId() != next.tripId) continue; state = newState; break HOP; } } } } else { for (Edge e2 : state.getVertex().getIncoming()) { if (e2 instanceof TransitBoardAlight) { for (Edge e3 : e2.getFromVertex().getIncoming()) { if (e3 instanceof PreBoardEdge) { if (data.raptorStopsForStopId.get( ((TransitStop) e3.getFromVertex()).getStopId()) == cur.stop) { state = e2.traverse(state); state = e3.traverse(state); break HOP; } } } } } } } } } } } return state; }
private State getStateDepartAt(RaptorData data, ArrayList<RaptorState> states) { State state = new State(states.get(0).getRequest()); for (int i = states.size() - 1; i >= 0; --i) { RaptorState cur = states.get(i); if (cur.walkPath != null) { // a walking step GraphPath path = new GraphPath(cur.walkPath, false); for (Edge e : path.edges) { State oldState = state; state = e.traverse(state); if (state == null) { e.traverse(oldState); } } } else { // so, cur is at this point at a transit stop; we have a route to board if (cur.getParent() == null || !cur.getParent().interlining) { for (Edge e : state.getVertex().getOutgoing()) { if (e instanceof PreBoardEdge) { state = e.traverse(state); break; } } TransitBoardAlight board = cur.getRoute().boards[cur.boardStopSequence][cur.patternIndex]; state = board.traverse(state); } // now traverse the hops and dwells until we find the alight we're looking for HOP: while (true) { for (Edge e : state.getVertex().getOutgoing()) { if (e instanceof PatternDwell) { state = e.traverse(state); } else if (e instanceof PatternHop) { state = e.traverse(state); if (cur.interlining) { for (Edge e2 : state.getVertex().getOutgoing()) { RaptorState next = states.get(i - 1); if (e2 instanceof PatternInterlineDwell) { Stop toStop = ((TransitVertex) e2.getToVertex()).getStop(); Stop expectedStop = next.boardStop.stopVertex.getStop(); if (toStop.equals(expectedStop)) { State newState = e2.traverse(state); if (newState == null) continue; if (newState.getTripId() != next.tripId) continue; state = newState; break HOP; } } } } else { for (Edge e2 : state.getVertex().getOutgoing()) { if (e2 instanceof TransitBoardAlight) { for (Edge e3 : e2.getToVertex().getOutgoing()) { if (e3 instanceof PreAlightEdge) { if (data.raptorStopsForStopId.get( ((TransitStop) e3.getToVertex()).getStopId()) == cur.stop) { state = e2.traverse(state); state = e3.traverse(state); break HOP; } } } } } } } } } } } return state; }
public double getDistance() { return SphericalDistanceLibrary.getInstance() .distance(start.getLat(), start.getLon(), end.getLat(), end.getLon()); }
@Override public Stop unmarshal(StopType arg) throws Exception { if (arg == null) { return null; } Stop a = new Stop(); a.setId(arg.id); a.setName(arg.stopName); a.setCode(arg.stopCode); a.setDesc(arg.stopDesc); a.setLat(arg.stopLat); a.setLon(arg.stopLon); a.setZoneId(arg.zoneId); a.setUrl(arg.stopUrl); a.setLocationType(arg.locationType); a.setParentStation(arg.parentStation); a.setWheelchairBoarding(arg.wheelchairBoarding); a.setDirection(arg.direction); return new Stop(a); }