Class VehicleRoute
- Author:
- stefan
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder that builds the vehicle route. -
Method Summary
Modifier and TypeMethodDescriptionstatic VehicleRoutecopyOf(VehicleRoute route) Returns a deep copy of this vehicleRoute.static VehicleRouteReturns an empty route.Returns an unmodifiable list of activities on this route (without start/end).doubleReturns the departureTime of this vehicle in this route.Returns the driver operating this route.getEnd()Returns end-activity of this route.intgetIndex()getStart()Returns start-activity of this route.Returns TourActivities.Returns the vehicle operating this route.booleanReturns true if this route has a vehicle assigned.booleanisEmpty()Returns tour if tour-activity-sequence is empty, i.e.voidsetIndex(int index) voidsetVehicleAndDepartureTime(Vehicle vehicle, double vehicleDepTime) Sets the vehicle and its departureTime fromvehicle.getStartLocationId().toString()
-
Method Details
-
copyOf
Returns a deep copy of this vehicleRoute.- Parameters:
route- route to copy- Returns:
- copied route
- Throws:
IllegalArgumentException- if route is null
-
emptyRoute
Returns an empty route.An empty route has an empty list of tour-activities, no driver (DriverImpl.noDriver()) and no vehicle (VehicleImpl.createNoVehicle()).
- Returns:
- empty route
-
getIndex
public int getIndex() -
setIndex
public void setIndex(int index) -
getActivities
Returns an unmodifiable list of activities on this route (without start/end).- Returns:
- list of tourActivities
-
getTourActivities
Returns TourActivities.- Returns:
TourActivities
-
getVehicle
Returns the vehicle operating this route.- Returns:
- Vehicle
-
getDriver
Returns the driver operating this route.- Returns:
- Driver
-
setVehicleAndDepartureTime
Sets the vehicle and its departureTime fromvehicle.getStartLocationId().This implies the following:
if start and end are null, new start and end activities are created.
startActivity is initialized with the start-location of the specified vehicle (
vehicle.getStartLocationId()). the time-window of this activity is initialized such that [startActivity.getTheoreticalEarliestOperationStartTime()=vehicle.getEarliestDeparture()][startActivity.getTheoreticalLatestOperationStartTime()=vehicle.getLatestArrival()]endActivity is initialized with the end-location of the specified vehicle (
vehicle.getEndLocationId()). The time-window of the endActivity is initialized such that [endActivity.getTheoreticalEarliestOperationStartTime()=vehicle.getEarliestDeparture()][endActivity.getTheoreticalLatestOperationStartTime()=vehicle.getLatestArrival()]startActivity.endTime (
startActivity.getEndTime()) is set to max{vehicle.getEarliestDeparture(),vehicleDepTime}. thus,vehicle.getEarliestDeparture()is a physical constraint that has to be met.- Parameters:
vehicle- to be employedvehicleDepTime- of employed vehicle
-
getDepartureTime
public double getDepartureTime()Returns the departureTime of this vehicle in this route.- Returns:
- departureTime
- Throws:
IllegalArgumentException- if start is null
-
isEmpty
public boolean isEmpty()Returns tour if tour-activity-sequence is empty, i.e. to activity on the tour yet.- Returns:
- true if route is empty
-
hasVehicle
public boolean hasVehicle()Returns true if this route has a vehicle assigned. Use this instead ofroute.getVehicle() instanceof VehicleImpl.NoVehiclechecks.- Returns:
- true if a vehicle is assigned, false otherwise
-
getStart
Returns start-activity of this route.- Returns:
- start
-
getEnd
Returns end-activity of this route.- Returns:
- end
-
toString
-