public static class VehicleImpl.Builder extends Object
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.
| Modifier and Type | Method and Description |
|---|---|
VehicleImpl.Builder |
addAllSkills(Collection<String> skills) |
VehicleImpl.Builder |
addSkill(String skill) |
VehicleImpl.Builder |
addSkills(Skills skills) |
VehicleImpl |
build()
Builds and returns the vehicle.
|
static VehicleImpl.Builder |
newInstance(String vehicleId)
Returns new instance of vehicle builder.
|
static VehicleImpl.Builder |
newInstance(Vehicle baseVehicle)
Returns new instance of vehicle builder and initializes every attribute with a attributes of baseVehicle
|
VehicleImpl.Builder |
setBreak(Break aBreak) |
VehicleImpl.Builder |
setEarliestStart(double earliest_startTime)
Sets earliest-start of vehicle which should be the lower bound of the vehicle's departure times.
|
VehicleImpl.Builder |
setEndLocation(Location endLocation) |
VehicleImpl.Builder |
setLatestArrival(double latest_arrTime)
Sets the latest arrival at vehicle's end-location which is the upper bound of the vehicle's arrival times.
|
VehicleImpl.Builder |
setReturnToDepot(boolean returnToDepot)
Sets the flag whether the vehicle must return to depot or not.
|
VehicleImpl.Builder |
setStartLocation(Location startLocation)
Sets start location.
|
VehicleImpl.Builder |
setType(VehicleType type)
Sets the
VehicleType. |
VehicleImpl.Builder |
setUserData(Object userData)
Sets user specific domain data associated with the object.
|
public VehicleImpl.Builder setType(VehicleType type)
VehicleType.type - the type to be setIllegalArgumentException - if type is nullpublic VehicleImpl.Builder setUserData(Object userData)
The user data is a black box for the framework, it only stores it, but never interacts with it in any way.
userData - any object holding the domain specific user data
associated with the object.public VehicleImpl.Builder setReturnToDepot(boolean returnToDepot)
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.
returnToDepot - true if vehicle need to return to depot, otherwise falsepublic VehicleImpl.Builder setStartLocation(Location startLocation)
startLocation - start locationpublic VehicleImpl.Builder setEndLocation(Location endLocation)
public VehicleImpl.Builder setEarliestStart(double earliest_startTime)
earliest_startTime - the earliest start time / departure time of the vehicle at its start locationpublic VehicleImpl.Builder setLatestArrival(double latest_arrTime)
latest_arrTime - the latest arrival time of the vehicle at its end locationpublic VehicleImpl.Builder addAllSkills(Collection<String> skills)
public VehicleImpl.Builder addSkill(String skill)
public VehicleImpl build()
if VehicleType is not set, default vehicle-type is set with id="default" and
capacity=0
if 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.
IllegalArgumentException - if both locationId and locationCoord is not set or (endLocationCoord!=null AND returnToDepot=false)
or (endLocationId!=null AND returnToDepot=false)public static VehicleImpl.Builder newInstance(String vehicleId)
vehicleId - the id of the vehicle which must be a unique identifier among all vehiclespublic static VehicleImpl.Builder newInstance(Vehicle baseVehicle)
baseVehicle - public VehicleImpl.Builder addSkills(Skills skills)
public VehicleImpl.Builder setBreak(Break aBreak)
Copyright © 2013–2019. All rights reserved.