mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
standardized toString() method
This commit is contained in:
parent
5a02919367
commit
7620988273
8 changed files with 41 additions and 31 deletions
|
|
@ -0,0 +1,12 @@
|
||||||
|
package jsprit.core.problem.solution.route.activity;
|
||||||
|
|
||||||
|
class Activities {
|
||||||
|
|
||||||
|
public static String round(double time) {
|
||||||
|
if (time == Double.MAX_VALUE) {
|
||||||
|
return "oo";
|
||||||
|
}
|
||||||
|
return "" + Math.round(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -90,9 +90,11 @@ public final class DeliverService implements DeliveryActivity{
|
||||||
return delivery;
|
return delivery;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[act="+getName()+"][capDemand="+getCapacityDemand()+"][loc="+getLocationId()+"]";
|
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||||
|
+ "][size=" + getSize().toString()
|
||||||
|
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||||
|
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,12 @@ public final class DeliverShipment implements DeliveryActivity{
|
||||||
public TourActivity duplicate() {
|
public TourActivity duplicate() {
|
||||||
return new DeliverShipment(this);
|
return new DeliverShipment(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[act="+getName()+"][loc="+getLocationId()+"]";
|
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||||
|
+ "][size=" + getSize().toString()
|
||||||
|
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||||
|
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -113,17 +113,10 @@ public final class End implements TourActivity {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[type="+getName()+"][locationId=" + getLocationId()
|
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||||
+ "][twStart=" + round(theoretical_earliestOperationStartTime)
|
+ "][twStart=" + Activities.round(theoretical_earliestOperationStartTime)
|
||||||
+ "][twEnd=" + round(theoretical_latestOperationStartTime) + "]";
|
+ "][twEnd=" + Activities.round(theoretical_latestOperationStartTime) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String round(double time) {
|
|
||||||
if (time == Double.MAX_VALUE) {
|
|
||||||
return "oo";
|
|
||||||
}
|
|
||||||
return "" + Math.round(time);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "end";
|
return "end";
|
||||||
|
|
|
||||||
|
|
@ -91,10 +91,12 @@ public final class PickupService implements PickupActivity{
|
||||||
public int getCapacityDemand() {
|
public int getCapacityDemand() {
|
||||||
return pickup.getCapacityDemand();
|
return pickup.getCapacityDemand();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[act="+getName()+"][capDemand="+getCapacityDemand()+"][loc="+getLocationId()+"]";
|
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||||
|
+ "][size=" + getSize().toString()
|
||||||
|
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||||
|
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,11 @@ public final class PickupShipment implements PickupActivity{
|
||||||
return new PickupShipment(this);
|
return new PickupShipment(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[act="+getName()+"][loc="+getLocationId()+"]";
|
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||||
|
+ "][size=" + getSize().toString()
|
||||||
|
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||||
|
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -144,10 +144,15 @@ public class ServiceActivity implements JobActivity{
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[type="+getName()+"][service="+this.service+"]";
|
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||||
|
+ "][size=" + getSize().toString()
|
||||||
|
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||||
|
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return service.getType();
|
return service.getType();
|
||||||
|
|
|
||||||
|
|
@ -107,18 +107,10 @@ public final class Start implements TourActivity {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[type="+getName()+"][locationId=" + getLocationId()
|
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||||
+ "][twStart=" + round(theoretical_earliestOperationStartTime)
|
+ "][twStart=" + Activities.round(theoretical_earliestOperationStartTime)
|
||||||
+ "][twEnd=" + round(theoretical_latestOperationStartTime) + "]";
|
+ "][twEnd=" + Activities.round(theoretical_latestOperationStartTime) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String round(double time) {
|
|
||||||
if (time == Double.MAX_VALUE) {
|
|
||||||
return "oo";
|
|
||||||
}
|
|
||||||
return "" + Math.round(time);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "start";
|
return "start";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue