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

added multiple cap-dims to activity and corresponding tests

This commit is contained in:
oblonski 2014-02-19 17:18:46 +01:00
parent 21e4bb09f5
commit 237075c463
18 changed files with 512 additions and 45 deletions

View file

@ -7,6 +7,8 @@ public final class DeliverService implements DeliveryActivity{
private Delivery delivery;
private Capacity capacity;
private double arrTime;
private double endTime;
@ -14,14 +16,20 @@ public final class DeliverService implements DeliveryActivity{
public DeliverService(Delivery delivery) {
super();
this.delivery = delivery;
capacity = Capacity.invert(delivery.getCapacity());
}
private DeliverService(DeliverService deliveryActivity){
this.delivery=deliveryActivity.getJob();
this.arrTime=deliveryActivity.getArrTime();
this.endTime=deliveryActivity.getEndTime();
capacity = deliveryActivity.getCapacity();
}
/**
* @deprecated use <code>getCapacity()</code> instead
*/
@Deprecated
@Override
public int getCapacityDemand() {
return delivery.getCapacityDemand()*-1;
@ -89,6 +97,6 @@ public final class DeliverService implements DeliveryActivity{
@Override
public Capacity getCapacity() {
return null;
return capacity;
}
}

View file

@ -7,18 +7,24 @@ import jsprit.core.problem.job.Shipment;
public final class DeliverShipment implements DeliveryActivity{
private Shipment shipment;
private double endTime;
private double arrTime;
private Capacity capacity;
public DeliverShipment(Shipment shipment) {
super();
this.shipment = shipment;
this.capacity = Capacity.invert(shipment.getCapacity());
}
public DeliverShipment(DeliverShipment deliveryShipmentActivity) {
this.shipment = (Shipment) deliveryShipmentActivity.getJob();
this.arrTime = deliveryShipmentActivity.getArrTime();
this.endTime = deliveryShipmentActivity.getEndTime();
this.capacity = deliveryShipmentActivity.getCapacity();
}
@Override
@ -26,6 +32,10 @@ public final class DeliverShipment implements DeliveryActivity{
return shipment;
}
/**
* @deprecated use <code>getCapacity()</code> instead
*/
@Deprecated
@Override
public int getCapacityDemand() {
return shipment.getCapacityDemand()*-1;
@ -88,6 +98,6 @@ public final class DeliverShipment implements DeliveryActivity{
@Override
public Capacity getCapacity() {
return null;
return capacity;
}
}

View file

@ -82,7 +82,12 @@ public final class PickupService implements PickupActivity{
return pickup;
}
/**
* @deprecated use <code>getCapacity()</code> instead
*
*/
@Override
@Deprecated
public int getCapacityDemand() {
return pickup.getCapacityDemand();
}
@ -94,8 +99,7 @@ public final class PickupService implements PickupActivity{
@Override
public Capacity getCapacity() {
// TODO Auto-generated method stub
return null;
return pickup.getCapacity();
}
}

View file

@ -28,6 +28,10 @@ public final class PickupShipment implements PickupActivity{
return shipment;
}
/**
* @deprecated use <code>getCapacity()</code> instead
*/
@Deprecated
@Override
public int getCapacityDemand() {
return shipment.getCapacityDemand();

View file

@ -28,8 +28,6 @@ public class ServiceActivity implements JobActivity{
public double endTime;
public int capacityDemand;
/**
* @return the arrTime
*/
@ -65,24 +63,13 @@ public class ServiceActivity implements JobActivity{
public static ServiceActivity newInstance(Service service){
return new ServiceActivity(service);
}
/**
* creates a new instance of {@link ServiceActivity} with a flag that indicates whether smthing is unloaded or loaded.
*
* @param service
* @param capacityDemand
* @return
*/
// public static ServiceActivity newInstance(Service service, boolean isPickup){
// return new ServiceActivity(service, capacityDemand);
// }
private final Service service;
protected ServiceActivity(Service service) {
counter++;
this.service = service;
this.capacityDemand = service.getCapacityDemand();
}
protected ServiceActivity(ServiceActivity serviceActivity) {
@ -90,7 +77,6 @@ public class ServiceActivity implements JobActivity{
this.service = serviceActivity.getJob();
this.arrTime = serviceActivity.getArrTime();
this.endTime = serviceActivity.getEndTime();
this.capacityDemand = serviceActivity.getCapacityDemand();
}
@ -133,9 +119,13 @@ public class ServiceActivity implements JobActivity{
return service.getTimeWindow().getEnd();
}
/**
* @deprecated use <code>getCapacity()</code> instead
*/
@Override
@Deprecated
public int getCapacityDemand() {
return this.capacityDemand;
return service.getCapacityDemand();
}
@Override
@ -170,8 +160,7 @@ public class ServiceActivity implements JobActivity{
@Override
public Capacity getCapacity() {
// TODO Auto-generated method stub
return null;
return service.getCapacity();
}