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

renamed job.getCapacity() in job.getSize()

This commit is contained in:
oblonski 2014-02-20 06:49:27 +01:00
parent 237075c463
commit ed9db39fa0
27 changed files with 115 additions and 117 deletions

View file

@ -331,7 +331,7 @@ public class VrpXMLReader{
for(HierarchicalConfiguration dimension : dimensionConfigs){
Integer index = dimension.getInt("[@index]");
Integer value = dimension.getInt("");
builder.addCapacityDimension(index, value);
builder.addSizeDimension(index, value);
}
}
@ -440,7 +440,7 @@ public class VrpXMLReader{
for(HierarchicalConfiguration dimension : dimensionConfigs){
Integer index = dimension.getInt("[@index]");
Integer value = dimension.getInt("");
builder.addCapacityDimension(index, value);
builder.addSizeDimension(index, value);
}
}
String serviceLocationId = serviceConfig.getString("locationId");

View file

@ -174,9 +174,9 @@ public class VrpXMLWriter {
xmlConfig.setProperty(shipmentPathString + "("+counter+").coord[@x]", service.getCoord().getX());
xmlConfig.setProperty(shipmentPathString + "("+counter+").coord[@y]", service.getCoord().getY());
}
for(int i=0;i<service.getCapacity().getNuOfDimensions();i++){
for(int i=0;i<service.getSize().getNuOfDimensions();i++){
xmlConfig.setProperty(shipmentPathString + "("+counter+").capacity-dimensions.dimension("+i+")[@index]", i);
xmlConfig.setProperty(shipmentPathString + "("+counter+").capacity-dimensions.dimension("+i+")", service.getCapacity().get(i));
xmlConfig.setProperty(shipmentPathString + "("+counter+").capacity-dimensions.dimension("+i+")", service.getSize().get(i));
}
xmlConfig.setProperty(shipmentPathString + "("+counter+").duration", service.getServiceDuration());
xmlConfig.setProperty(shipmentPathString + "("+counter+").timeWindows.timeWindow(0).start", service.getTimeWindow().getStart());
@ -215,9 +215,9 @@ public class VrpXMLWriter {
xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.timeWindows.timeWindow(0).start", shipment.getDeliveryTimeWindow().getStart());
xmlConfig.setProperty(shipmentPathString + "("+counter+").delivery.timeWindows.timeWindow(0).end", shipment.getDeliveryTimeWindow().getEnd());
for(int i=0;i<shipment.getCapacity().getNuOfDimensions();i++){
for(int i=0;i<shipment.getSize().getNuOfDimensions();i++){
xmlConfig.setProperty(shipmentPathString + "("+counter+").capacity-dimensions.dimension("+i+")[@index]", i);
xmlConfig.setProperty(shipmentPathString + "("+counter+").capacity-dimensions.dimension("+i+")", shipment.getCapacity().get(i));
xmlConfig.setProperty(shipmentPathString + "("+counter+").capacity-dimensions.dimension("+i+")", shipment.getSize().get(i));
}
counter++;
}

View file

@ -41,7 +41,7 @@ public class Delivery extends Service{
@Deprecated
public static Builder newInstance(String id, int size){
Builder builder = new Builder(id,size);
builder.addCapacityDimension(0, size);
builder.addSizeDimension(0, size);
return builder;
}

View file

@ -46,10 +46,10 @@ public interface Job {
public int getCapacityDemand();
/**
* Returns capacity of jobs which can consist of an arbitrary number of capacity dimensions.
* Returns size, i.e. capacity-demand, of this job which can consist of an arbitrary number of capacity dimensions.
*
* @return Capacity
*/
public Capacity getCapacity();
public Capacity getSize();
}

View file

@ -40,7 +40,7 @@ public class Pickup extends Service {
@Deprecated
public static Builder newInstance(String id, int size){
Builder builder = new Builder(id,size);
builder.addCapacityDimension(0, size);
builder.addSizeDimension(0, size);
return builder;
}

View file

@ -56,7 +56,7 @@ public class Service implements Job {
@Deprecated
public static Builder newInstance(String id, int size){
Builder builder = new Builder(id,size);
builder.addCapacityDimension(0, size);
builder.addSizeDimension(0, size);
return builder;
}
@ -162,7 +162,7 @@ public class Service implements Job {
* @return the builder
* @throws IllegalArgumentException if dimensionValue < 0
*/
public Builder addCapacityDimension(int dimensionIndex, int dimensionValue){
public Builder addSizeDimension(int dimensionIndex, int dimensionValue){
if(dimensionValue<0) throw new IllegalArgumentException("capacity value cannot be negative");
capacityBuilder.addDimension(dimensionIndex, dimensionValue);
return this;
@ -213,10 +213,8 @@ public class Service implements Job {
private final double serviceTime;
private final TimeWindow timeWindow;
// private final int demand;
private final Capacity capacity;
private final Capacity size;
Service(Builder builder){
id = builder.id;
@ -225,7 +223,7 @@ public class Service implements Job {
serviceTime = builder.serviceTime;
timeWindow = builder.timeWindow;
type = builder.type;
capacity = builder.capacity;
size = builder.capacity;
}
@Override
@ -277,7 +275,7 @@ public class Service implements Job {
@Override
@Deprecated
public int getCapacityDemand() {
return capacity.get(0);
return size.get(0);
}
/**
@ -294,7 +292,7 @@ public class Service implements Job {
*/
@Override
public String toString() {
return "[id=" + id + "][type="+type+"][locationId=" + locationId + "][coord="+coord+"][capacity=" + capacity + "][serviceTime=" + serviceTime + "][timeWindow=" + timeWindow + "]";
return "[id=" + id + "][type="+type+"][locationId=" + locationId + "][coord="+coord+"][capacity=" + size + "][serviceTime=" + serviceTime + "][timeWindow=" + timeWindow + "]";
}
@ -328,8 +326,8 @@ public class Service implements Job {
}
@Override
public Capacity getCapacity() {
return capacity;
public Capacity getSize() {
return size;
}
}

View file

@ -68,7 +68,7 @@ public class Shipment implements Job{
@Deprecated
public static Builder newInstance(String id, int size){
Builder builder = new Builder(id,size);
builder.addCapacityDimension(0, size);
builder.addSizeDimension(0, size);
return builder;
}
@ -210,14 +210,14 @@ public class Shipment implements Job{
/**
* Adds capacity dimension.
*
* @param dimIndex
* @param dimVal
* @param dimensionIndex
* @param dimensionValue
* @return builder
* @throws IllegalArgumentException if dimVal < 0
*/
public Builder addCapacityDimension(int dimIndex, int dimVal) {
if(dimVal<0) throw new IllegalArgumentException("capacity value cannot be negative");
capacityBuilder.addDimension(dimIndex, dimVal);
public Builder addSizeDimension(int dimensionIndex, int dimensionValue) {
if(dimensionValue<0) throw new IllegalArgumentException("capacity value cannot be negative");
capacityBuilder.addDimension(dimensionIndex, dimensionValue);
return this;
}
@ -404,7 +404,7 @@ public class Shipment implements Job{
}
@Override
public Capacity getCapacity() {
public Capacity getSize() {
return capacity;
}

View file

@ -16,7 +16,7 @@ public final class DeliverService implements DeliveryActivity{
public DeliverService(Delivery delivery) {
super();
this.delivery = delivery;
capacity = Capacity.invert(delivery.getCapacity());
capacity = Capacity.invert(delivery.getSize());
}
private DeliverService(DeliverService deliveryActivity){

View file

@ -17,7 +17,7 @@ public final class DeliverShipment implements DeliveryActivity{
public DeliverShipment(Shipment shipment) {
super();
this.shipment = shipment;
this.capacity = Capacity.invert(shipment.getCapacity());
this.capacity = Capacity.invert(shipment.getSize());
}
public DeliverShipment(DeliverShipment deliveryShipmentActivity) {

View file

@ -99,7 +99,7 @@ public final class PickupService implements PickupActivity{
@Override
public Capacity getCapacity() {
return pickup.getCapacity();
return pickup.getSize();
}
}

View file

@ -94,7 +94,7 @@ public final class PickupShipment implements PickupActivity{
@Override
public Capacity getCapacity() {
return shipment.getCapacity();
return shipment.getSize();
}

View file

@ -160,7 +160,7 @@ public class ServiceActivity implements JobActivity{
@Override
public Capacity getCapacity() {
return service.getCapacity();
return service.getSize();
}