1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

modified Pickup and Delivery to deal with multiple cap-dims

This commit is contained in:
oblonski 2014-02-17 22:34:23 +01:00
parent 8946e130c8
commit fe4b4ae4ca
6 changed files with 117 additions and 2 deletions

View file

@ -16,6 +16,8 @@
******************************************************************************/
package jsprit.core.problem.job;
import jsprit.core.problem.job.Pickup.Builder;
/**
* Delivery extends Service and is intended to model a Service where smth is UNLOADED (i.e. delivered) from a transport unit.
*
@ -33,9 +35,24 @@ public class Delivery extends Service{
* @param size
* @return builder
* @throws IllegalArgumentException if size < 0 or id is null
* @deprecated use <code>.newInstance(String id)</code> instead, and add a capacity dimension
* with dimensionIndex='your index' and and dimsionValue=size to the returned builder
*/
@Deprecated
public static Builder newInstance(String id, int size){
return new Builder(id,size);
Builder builder = new Builder(id,size);
builder.addCapacityDimension(0, size);
return builder;
}
/**
* Returns a new instance of builder that builds a delivery.
*
* @param id
* @return the builder
*/
public static Builder newInstance(String id){
return new Builder(id);
}
/**
@ -48,6 +65,11 @@ public class Delivery extends Service{
Builder(String id, int size) {
super(id, size);
}
Builder(String id) {
super(id);
}
/**
* Builds Delivery.
*

View file

@ -16,6 +16,7 @@
******************************************************************************/
package jsprit.core.problem.job;
/**
* Pickup extends Service and is intended to model a Service where smth is LOADED (i.e. picked up) to a transport unit.
*
@ -33,9 +34,24 @@ public class Pickup extends Service {
* @param size
* @return builder
* @throws IllegalArgumentException if size < 0 or id is null
* @deprecated use <code>.newInstance(String id)</code> instead, and add a capacity dimension
* with dimensionIndex='your index' and and dimsionValue=size to the returned builder
*/
@Deprecated
public static Builder newInstance(String id, int size){
return new Builder(id,size);
Builder builder = new Builder(id,size);
builder.addCapacityDimension(0, size);
return builder;
}
/**
* Returns a new instance of builder that builds a pickup.
*
* @param id
* @return the builder
*/
public static Builder newInstance(String id){
return new Builder(id);
}
/**
@ -49,6 +65,10 @@ public class Pickup extends Service {
super(id, size);
}
Builder(String id) {
super(id);
}
/**
* Builds Pickup.
*

View file

@ -60,6 +60,12 @@ public class Service implements Job {
return builder;
}
/**
* Returns a new instance of builder that builds a service.
*
* @param id
* @return the builder
*/
public static Builder newInstance(String id){
return new Builder(id);
}