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

edu.kit.ifv.mobitopp.populationsynthesis.SerialisingDemandRepository 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.populationsynthesis;

import java.io.IOException;

import edu.kit.ifv.mobitopp.data.DemandZone;
import edu.kit.ifv.mobitopp.populationsynthesis.serialiser.DemandDataSerialiser;

public class SerialisingDemandRepository implements DemandDataRepository {

	private final DemandDataSerialiser serialiser;

	public SerialisingDemandRepository(DemandDataSerialiser serialiser) {
		this.serialiser = serialiser;
	}

	@Override
	public void store(DemandZone demandData) {
		demandData.getPopulation().households().forEach(serialiser::serialise);
		OpportunityLocations locations = new OpportunityLocations();
		demandData.getDemandData().opportunities().forEach(locations::add);
		serialiser.serialise(locations);
	}

	@Override
	public void finishExecution() throws IOException {
		serialiser.close();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy