mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add_user_data_to_vehicle_type_id
This commit is contained in:
parent
c75cd5df9e
commit
b0535a51d8
2 changed files with 14 additions and 2 deletions
|
|
@ -364,7 +364,7 @@ public class VehicleImpl extends AbstractVehicle {
|
|||
aBreak = builder.aBreak;
|
||||
prohibitedTasks = builder.prohibitedTasks;
|
||||
// setVehicleIdentifier(new VehicleTypeKey(type.getTypeId(),startLocation.getId(),endLocation.getId(),earliestDeparture,latestArrival,skills));
|
||||
setVehicleIdentifier(new VehicleTypeKey(type.getTypeId(), startLocation.getId(), endLocation.getId(), earliestDeparture, latestArrival, skills, returnToDepot));
|
||||
setVehicleIdentifier(new VehicleTypeKey(type.getTypeId(), startLocation.getId(), endLocation.getId(), earliestDeparture, latestArrival, skills, returnToDepot, getUserData()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ package com.graphhopper.jsprit.core.problem.vehicle;
|
|||
import com.graphhopper.jsprit.core.problem.AbstractVehicle;
|
||||
import com.graphhopper.jsprit.core.problem.Skills;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Key to identify similar vehicles
|
||||
* <p>
|
||||
|
|
@ -36,8 +38,9 @@ public class VehicleTypeKey extends AbstractVehicle.AbstractTypeKey {
|
|||
public final double latestEnd;
|
||||
public final Skills skills;
|
||||
public final boolean returnToDepot;
|
||||
public final Object userData;
|
||||
|
||||
public VehicleTypeKey(String typeId, String startLocationId, String endLocationId, double earliestStart, double latestEnd, Skills skills, boolean returnToDepot) {
|
||||
public VehicleTypeKey(String typeId, String startLocationId, String endLocationId, double earliestStart, double latestEnd, Skills skills, boolean returnToDepot, Object userData) {
|
||||
super();
|
||||
this.type = typeId;
|
||||
this.startLocationId = startLocationId;
|
||||
|
|
@ -46,6 +49,11 @@ public class VehicleTypeKey extends AbstractVehicle.AbstractTypeKey {
|
|||
this.latestEnd = latestEnd;
|
||||
this.skills = skills;
|
||||
this.returnToDepot = returnToDepot;
|
||||
this.userData = userData;
|
||||
}
|
||||
|
||||
public VehicleTypeKey(String typeId, String startLocationId, String endLocationId, double earliestStart, double latestEnd, Skills skills, boolean returnToDepot) {
|
||||
this(typeId, startLocationId, endLocationId, earliestStart, latestEnd, skills, returnToDepot, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -62,6 +70,7 @@ public class VehicleTypeKey extends AbstractVehicle.AbstractTypeKey {
|
|||
if (!skills.equals(that.skills)) return false;
|
||||
if (!startLocationId.equals(that.startLocationId)) return false;
|
||||
if (!type.equals(that.type)) return false;
|
||||
if (!Objects.equals(that.userData, this.userData)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -79,6 +88,9 @@ public class VehicleTypeKey extends AbstractVehicle.AbstractTypeKey {
|
|||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||
result = 31 * result + skills.hashCode();
|
||||
result = 31 * result + (returnToDepot ? 1 : 0);
|
||||
if (userData != null)
|
||||
result = 31 * result + userData.hashCode();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue