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

edu.kit.ifv.mobitopp.populationsynthesis.StandardDemandRegionMapping 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 static edu.kit.ifv.mobitopp.util.collections.StreamUtils.warn;

import java.io.File;
import java.util.Collections;
import java.util.Map;
import java.util.SortedMap;
import java.util.stream.Stream;

import edu.kit.ifv.mobitopp.data.local.DemandRegionMapping;
import edu.kit.ifv.mobitopp.util.dataimport.CsvFile;
import edu.kit.ifv.mobitopp.util.dataimport.Row;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@RequiredArgsConstructor
@Slf4j
public class StandardDemandRegionMapping implements DemandRegionMapping {

	private final SortedMap levelMapping;
	private final Map content;

	@Override
	public SortedMap getLowToHigh() {
		return Collections.unmodifiableSortedMap(levelMapping);
	}

	@Override
	public Stream contentFor(RegionalLevel level) {
		if (content.containsKey(level)) {
			return CsvFile.createFrom(content.get(level)).stream();
		}
		throw warn(new IllegalArgumentException("Could not find a file for level: " + level), log);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy