org.opentripplanner.updater.bike_rental.KeolisRennesBikeRentalDataSource Maven / Gradle / Ivy
package org.opentripplanner.updater.bike_rental;
import java.util.Map;
import org.opentripplanner.routing.bike_rental.BikeRentalStation;
import org.opentripplanner.updater.UpdaterDataSourceParameters;
import org.opentripplanner.util.NonLocalizedString;
public class KeolisRennesBikeRentalDataSource extends GenericXmlBikeRentalDataSource {
public KeolisRennesBikeRentalDataSource(UpdaterDataSourceParameters config) {
super(config,"//opendata/answer/data/station");
}
public BikeRentalStation makeStation(Map attributes) {
//FIXME: I have no idea what state actually means
if (!"1".equals(attributes.get("state"))) {
return null;
}
BikeRentalStation brstation = new BikeRentalStation();
brstation.id = attributes.get("number");
brstation.x = Double.parseDouble(attributes.get("longitude"));
brstation.y = Double.parseDouble(attributes.get("latitude"));
brstation.name = new NonLocalizedString(attributes.get("name"));
brstation.bikesAvailable = Integer.parseInt(attributes.get("bikesavailable"));
brstation.spacesAvailable = Integer.parseInt(attributes.get("slotsavailable"));
return brstation;
}
}