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;
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
|
|
|||
|
|
@ -91,9 +91,11 @@ public final class DeliverShipment implements DeliveryActivity{
|
|||
return new DeliverShipment(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
|
|
|||
|
|
@ -113,15 +113,8 @@ public final class End implements TourActivity {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||
+ "][twStart=" + round(theoretical_earliestOperationStartTime)
|
||||
+ "][twEnd=" + round(theoretical_latestOperationStartTime) + "]";
|
||||
}
|
||||
|
||||
private String round(double time) {
|
||||
if (time == Double.MAX_VALUE) {
|
||||
return "oo";
|
||||
}
|
||||
return "" + Math.round(time);
|
||||
+ "][twStart=" + Activities.round(theoretical_earliestOperationStartTime)
|
||||
+ "][twEnd=" + Activities.round(theoretical_latestOperationStartTime) + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -92,9 +92,11 @@ public final class PickupService implements PickupActivity{
|
|||
return pickup.getCapacityDemand();
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
|
|
|||
|
|
@ -87,9 +87,11 @@ public final class PickupShipment implements PickupActivity{
|
|||
return new PickupShipment(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
|
|
|||
|
|
@ -144,8 +144,13 @@ public class ServiceActivity implements JobActivity{
|
|||
return service;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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
|
||||
|
|
|
|||
|
|
@ -107,18 +107,10 @@ public final class Start implements TourActivity {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[type="+getName()+"][locationId=" + getLocationId()
|
||||
+ "][twStart=" + round(theoretical_earliestOperationStartTime)
|
||||
+ "][twEnd=" + round(theoretical_latestOperationStartTime) + "]";
|
||||
+ "][twStart=" + Activities.round(theoretical_earliestOperationStartTime)
|
||||
+ "][twEnd=" + Activities.round(theoretical_latestOperationStartTime) + "]";
|
||||
}
|
||||
|
||||
private String round(double time) {
|
||||
if (time == Double.MAX_VALUE) {
|
||||
return "oo";
|
||||
}
|
||||
return "" + Math.round(time);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "start";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue