Class VehicleImpl.Builder
- Enclosing class:
VehicleImpl
By default, earliestDepartureTime is 0.0, latestDepartureTime is Double.MAX_VALUE,
it returns to the depot and its VehicleType is the DefaultType with typeId equal to 'default'
and a capacity of 0.
- Author:
- stefan
-
Method Summary
Modifier and TypeMethodDescriptionaddAllSkills(Collection<String> skills) build()Builds and returns the vehicle.static VehicleImpl.BuildernewInstance(Vehicle baseVehicle) Returns new instance of vehicle builder and initializes every attribute with a attributes of baseVehiclestatic VehicleImpl.BuildernewInstance(String vehicleId) Returns new instance of vehicle builder.setEarliestStart(double earliest_startTime) Sets earliest-start of vehicle which should be the lower bound of the vehicle's departure times.setEndLocation(Location endLocation) setLatestArrival(double latest_arrTime) Sets the latest arrival at vehicle's end-location which is the upper bound of the vehicle's arrival times.setReturnToDepot(boolean returnToDepot) Sets the flag whether the vehicle must return to depot or not.setStartLocation(Location startLocation) Sets start location.setType(VehicleType type) Sets theVehicleType.setUserData(Object userData) Sets user specific domain data associated with the object.
-
Method Details
-
setType
Sets theVehicleType.- Parameters:
type- the type to be set- Returns:
- this builder
- Throws:
IllegalArgumentException- if type is null
-
setUserData
Sets user specific domain data associated with the object.The user data is a black box for the framework, it only stores it, but never interacts with it in any way.
- Parameters:
userData- any object holding the domain specific user data associated with the object.- Returns:
- builder
-
setReturnToDepot
Sets the flag whether the vehicle must return to depot or not.If returnToDepot is true, the vehicle must return to specified end-location. If you omit specifying the end-location, vehicle returns to start-location (that must to be set). If you specify it, it returns to specified end-location.
If returnToDepot is false, the end-location of the vehicle is endogenous.
- Parameters:
returnToDepot- true if vehicle need to return to depot, otherwise false- Returns:
- this builder
-
setStartLocation
Sets start location.- Parameters:
startLocation- start location- Returns:
- start location
-
setEndLocation
-
setEarliestStart
Sets earliest-start of vehicle which should be the lower bound of the vehicle's departure times.- Parameters:
earliest_startTime- the earliest start time / departure time of the vehicle at its start location- Returns:
- this builder
-
setLatestArrival
Sets the latest arrival at vehicle's end-location which is the upper bound of the vehicle's arrival times.- Parameters:
latest_arrTime- the latest arrival time of the vehicle at its end location- Returns:
- this builder
-
addAllSkills
-
addSkill
-
build
Builds and returns the vehicle.if
VehicleTypeis not set, default vehicle-type is set with id="default" and capacity=0if startLocationId || locationId is null (=> startLocationCoordinate || locationCoordinate must be set) then startLocationId=startLocationCoordinate.toString() and locationId=locationCoordinate.toString() [coord.toString() --> [x=x_val][y=y_val])
if endLocationId is null and endLocationCoordinate is set then endLocationId=endLocationCoordinate.toString()
if endLocationId==null AND endLocationCoordinate==null then endLocationId=startLocationId AND endLocationCoord=startLocationCoord Thus endLocationId can never be null even returnToDepot is false.
- Returns:
- vehicle
- Throws:
IllegalArgumentException- if both locationId and locationCoord is not set or (endLocationCoord!=null AND returnToDepot=false) or (endLocationId!=null AND returnToDepot=false)
-
newInstance
Returns new instance of vehicle builder.- Parameters:
vehicleId- the id of the vehicle which must be a unique identifier among all vehicles- Returns:
- vehicle builder
-
newInstance
Returns new instance of vehicle builder and initializes every attribute with a attributes of baseVehicle- Parameters:
baseVehicle- base vehicle that is used to initialize the vehicle builder- Returns:
- this builder
-
addSkills
-
setBreak
-