}
private Stop getAtcoStop(LocationElement location) {
String locationId = location.getLocationId();
AgencyAndId id = id(locationId);
Stop stop = _dao.getStopForId(id);
if (stop == null) {
LocationProvider locationSource = _additionalLocationById.get(locationId);
if (locationSource == null) {
throw new AtcoCifException("found location with id=" + locationId
+ " but no additional location information found");
}
LocationProvider nxLocationSource = _nxLocationGeoDetailById.get(locationId);
if (nxLocationSource != null) {
locationSource = nxLocationSource;
}
if (locationSource.getLat() == 0.0 || locationSource.getLon() == 0.0) {
if (_stopsWithNoLocationInfo.add(locationId)) {
_log.info("stop with no location: " + locationId);
_prunedStopsWithNoLocationInfoCount++;
}
if (!_keepStopsWithNoLocationInfo) {
return null;
}
}
String name = location.getName();
NationalExpressLocationNameElement nxNameElement = _nxLocationNamesById.get(locationId);
if (nxNameElement != null && !nxNameElement.getShortName().isEmpty()) {
name = nxNameElement.getShortName();
}
stop = new Stop();
stop.setId(id(locationId));
stop.setName(name);
stop.setLat(locationSource.getLat());
stop.setLon(locationSource.getLon());
String clusterId = _clusterIdByLocationId.get(locationId);
if (clusterId != null) {
AgencyAndId stationId = id(clusterId + "-station");
stop.setParentStation(stationId.getId());
List<Stop> stops = _stopsByClusterId.get(clusterId);
if (stops == null) {
stops = new ArrayList<Stop>();
_stopsByClusterId.put(clusterId, stops);
}