mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
introduce Pickup and Delivery, and adjust tests
This commit is contained in:
parent
462864d53e
commit
1f53c72620
8 changed files with 23 additions and 27 deletions
|
|
@ -14,6 +14,7 @@ public class Delivery extends Service{
|
|||
}
|
||||
|
||||
public Delivery build(){
|
||||
this.setType("delivery");
|
||||
return new Delivery(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public class Pickup extends Service {
|
|||
}
|
||||
|
||||
public Pickup build(){
|
||||
this.setType("pickup");
|
||||
return new Pickup(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class Service implements Job {
|
|||
|
||||
private String id;
|
||||
private String locationId;
|
||||
private String name = "service";
|
||||
private String type = "service";
|
||||
private Coordinate coord;
|
||||
private double serviceTime;
|
||||
private TimeWindow timeWindow = TimeWindow.newInstance(0.0, Double.MAX_VALUE);
|
||||
|
|
@ -46,8 +46,8 @@ public class Service implements Job {
|
|||
this.demand = size;
|
||||
}
|
||||
|
||||
public Builder setName(String name){
|
||||
this.name = name;
|
||||
protected Builder setType(String name){
|
||||
this.type = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ public class Service implements Job {
|
|||
if(coord == null) throw new IllegalStateException("either locationId or a coordinate must be given. But is not.");
|
||||
locationId = coord.toString();
|
||||
}
|
||||
|
||||
this.setType("service");
|
||||
return new Service(this);
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public class Service implements Job {
|
|||
|
||||
private final String locationId;
|
||||
|
||||
private final String name;
|
||||
private final String type;
|
||||
|
||||
private final Coordinate coord;
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ public class Service implements Job {
|
|||
serviceTime = builder.serviceTime;
|
||||
timeWindow = builder.timeWindow;
|
||||
demand = builder.demand;
|
||||
name = builder.name;
|
||||
type = builder.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -137,7 +137,7 @@ public class Service implements Job {
|
|||
* @return the name
|
||||
*/
|
||||
public String getType() {
|
||||
return name;
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ public class VrpXMLReader{
|
|||
int cap = 0;
|
||||
if(capacityDemand != null) cap = Integer.parseInt(capacityDemand);
|
||||
Service.Builder builder = Service.Builder.newInstance(id, cap);
|
||||
builder.setName(name);
|
||||
// builder.setType(name);
|
||||
String serviceLocationId = serviceConfig.getString("locationId");
|
||||
builder.setLocationId(serviceLocationId);
|
||||
Coordinate serviceCoord = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue