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

edu.kit.ifv.mobitopp.publictransport.serializer.TimetableDeserializer 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.publictransport.serializer;

import java.util.List;

import edu.kit.ifv.mobitopp.publictransport.model.Connection;
import edu.kit.ifv.mobitopp.publictransport.model.ModifiableJourney;
import edu.kit.ifv.mobitopp.publictransport.model.Station;
import edu.kit.ifv.mobitopp.publictransport.model.Stop;
import edu.kit.ifv.mobitopp.time.Time;

public class TimetableDeserializer implements Deserializer {

	private StopDeserializer stopDeserializer;
	private ConnectionDeserializer connectionDeserializer;
	private JourneyDeserializer journeyDeserializer;
	private StationDeserializer stationDeserializer;

	TimetableDeserializer(
			StopDeserializer stopDeserializer, ConnectionDeserializer connectionDeserializer,
			JourneyDeserializer journeyDeserializer, StationDeserializer stationDeserializer) {
		super();
		this.stopDeserializer = stopDeserializer;
		this.connectionDeserializer = connectionDeserializer;
		this.journeyDeserializer = journeyDeserializer;
		this.stationDeserializer = stationDeserializer;
	}

	public static Deserializer defaultDeserializer(
			TimetableFiles timetableFiles, Time startTime, JourneyFactory factory) {
		DefaultStationDeserializer stationDeserializer = DefaultStationDeserializer.at(timetableFiles);
		DefaultStopDeserializer stopDeserializer = DefaultStopDeserializer.at(timetableFiles);
		JourneyFormat journeyFormat = new CsvJourneyFormat(factory);
		DefaultJourneyDeserializer journeyDeserializer = DefaultJourneyDeserializer.at(timetableFiles,
				journeyFormat);
		DefaultConnectionDeserializer connectionDeserializer = DefaultConnectionDeserializer
				.at(timetableFiles, startTime);
		return new TimetableDeserializer(stopDeserializer, connectionDeserializer, journeyDeserializer,
				stationDeserializer);
	}

	@Override
	public List connections() {
		return connectionDeserializer.connections();
	}

	@Override
	public Connection deserializeConnection(
			String serialized, StopResolver stopPoints, JourneyProvider journeys) {
		return connectionDeserializer.deserializeConnection(serialized, stopPoints, journeys);
	}

	@Override
	public List stations() {
		return stationDeserializer.stations();
	}

	@Override
	public Station deserializeStation(String serializedStation, NodeResolver nodeResolver) {
		return stationDeserializer.deserializeStation(serializedStation, nodeResolver);
	}

	@Override
	public List stops() {
		return stopDeserializer.stops();
	}

	@Override
	public Stop deserializeStop(String serialized, StationResolver stationResolver) {
		return stopDeserializer.deserializeStop(serialized, stationResolver);
	}

	@Override
	public NeighbourhoodCoupler neighbourhoodCoupler(StopResolver stopResolver) {
		return stopDeserializer.neighbourhoodCoupler(stopResolver);
	}

	@Override
	public List journeys() {
		return journeyDeserializer.journeys();
	}

	@Override
	public ModifiableJourney deserializeJourney(String serialized) {
		return journeyDeserializer.deserializeJourney(serialized);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy