All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.kit.ifv.mobitopp.visum.reader.VisumChargingFacilityReader Maven / Gradle / Ivy

Go to download

mobiTopp (http://mobitopp.ifv.kit.edu/) is an agent-based travel demand model developed at the Institute for transport studies at the Karlsruhe Institute of Technology (http://www.ifv.kit.edu/english/index.php). Publications about mobiTopp can be found on the project site (http://mobitopp.ifv.kit.edu/28.php).

The newest version!
package edu.kit.ifv.mobitopp.visum.reader;

import static java.util.stream.Collectors.toMap;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Stream;

import edu.kit.ifv.mobitopp.util.dataimport.Row;
import edu.kit.ifv.mobitopp.visum.NetfileLanguage;
import edu.kit.ifv.mobitopp.visum.StandardAttributes;
import edu.kit.ifv.mobitopp.visum.VisumChargingFacility;

public class VisumChargingFacilityReader extends VisumBaseReader {

  public VisumChargingFacilityReader(NetfileLanguage language) {
    super(language);
  }

  public Map readStations(Stream content) {
    return content.map(this::createChargingFacility).collect(toMap(c -> c.id, Function.identity()));
  }

  private VisumChargingFacility createChargingFacility(Row row) {
    int id = row.valueAsInteger(attribute(StandardAttributes.lsId));
    double latitude = row.valueAsDouble(attribute(StandardAttributes.latitude));
    double longitude = row.valueAsDouble(attribute(StandardAttributes.longitude));
    float coord_x = xCoordOf(row);
    float coord_y = yCoordOf(row);
    String type = row.get(attribute(StandardAttributes.chargingType));
    String vehicleType = row.get(attribute(StandardAttributes.vehicleType));
    String publicType = row.get(attribute(StandardAttributes.publicType));
    String place = row.get(attribute(StandardAttributes.place));
    String postalCode = row.get(attribute(StandardAttributes.plz));
    String street = row.get(attribute(StandardAttributes.street));
    String address = place + ", " + postalCode + ", " + street;
    return new VisumChargingFacility(id, coord_x, coord_y, type, vehicleType, publicType, latitude,
        longitude, address);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy