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

edu.kit.ifv.mobitopp.simulation.publictransport.vehicle.SimulatedVehicle 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.simulation.publictransport.vehicle;

import java.util.Optional;
import java.util.function.Consumer;

import edu.kit.ifv.mobitopp.publictransport.model.ConnectionId;
import edu.kit.ifv.mobitopp.publictransport.model.Stop;
import edu.kit.ifv.mobitopp.simulation.events.EventQueue;
import edu.kit.ifv.mobitopp.simulation.publictransport.PassengerCompartment;
import edu.kit.ifv.mobitopp.simulation.publictransport.model.Passenger;
import edu.kit.ifv.mobitopp.simulation.publictransport.model.Vehicle;
import edu.kit.ifv.mobitopp.time.Time;

public class SimulatedVehicle implements Vehicle {

	private final PassengerCompartment passengers;
	private final VehicleRoute vehicleRoute;

	public SimulatedVehicle(VehicleRoute vehicleRoute, PassengerCompartment passengersPerStop) {
		super();
		passengers = passengersPerStop;
		this.vehicleRoute = vehicleRoute;
	}

	@Override
	public int journeyId() {
		return vehicleRoute.journeyId();
	}

	@Override
	public void board(Passenger person, Stop exitStop) {
		passengers.board(person, exitStop);
	}

	@Override
	public void getOff(Passenger person) {
		passengers.getOff(person, currentStop());
	}

	@Override
	public int passengerCount() {
		return passengers.count();
	}

	@Override
	public boolean hasFreePlace() {
		return passengers.hasFreePlace();
	}

	@Override
	public void moveToNextStop(Time current) {
		vehicleRoute.moveToNextStop(current);
	}

	@Override
	public Stop currentStop() {
		return vehicleRoute.currentStop();
	}

	@Override
	public Optional nextConnection() {
		return vehicleRoute.nextConnection();
	}
	
	@Override
	public Optional




© 2015 - 2024 Weber Informatics LLC | Privacy Policy