mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
Merge pull request #383 from michalmac/master
Shipment.toString() added
This commit is contained in:
commit
0aa61bd8aa
3 changed files with 35 additions and 17 deletions
|
|
@ -93,7 +93,9 @@ public class Service extends AbstractJob {
|
|||
private int priority = 2;
|
||||
protected Object userData;
|
||||
|
||||
protected double maxTimeInVehicle = Double.MAX_VALUE;Builder(String id){
|
||||
protected double maxTimeInVehicle = Double.MAX_VALUE;
|
||||
|
||||
Builder(String id){
|
||||
this.id = id;
|
||||
timeWindows = new TimeWindowsImpl();
|
||||
timeWindows.add(timeWindow);
|
||||
|
|
@ -266,8 +268,6 @@ public class Service extends AbstractJob {
|
|||
|
||||
private final double serviceTime;
|
||||
|
||||
private final TimeWindow timeWindow;
|
||||
|
||||
private final Capacity size;
|
||||
|
||||
private final Skills skills;
|
||||
|
|
@ -276,7 +276,7 @@ public class Service extends AbstractJob {
|
|||
|
||||
private final Location location;
|
||||
|
||||
private final TimeWindows timeWindowManager;
|
||||
private final TimeWindows timeWindows;
|
||||
|
||||
private final int priority;
|
||||
|
||||
|
|
@ -286,18 +286,18 @@ public class Service extends AbstractJob {
|
|||
setUserData(builder.userData);
|
||||
id = builder.id;
|
||||
serviceTime = builder.serviceTime;
|
||||
timeWindow = builder.timeWindow;
|
||||
type = builder.type;
|
||||
size = builder.capacity;
|
||||
skills = builder.skills;
|
||||
name = builder.name;
|
||||
location = builder.location;
|
||||
timeWindowManager = builder.timeWindows;
|
||||
timeWindows = builder.timeWindows;
|
||||
priority = builder.priority;
|
||||
maxTimeInVehicle = builder.maxTimeInVehicle;}
|
||||
maxTimeInVehicle = builder.maxTimeInVehicle;
|
||||
}
|
||||
|
||||
public Collection<TimeWindow> getTimeWindows(){
|
||||
return timeWindowManager.getTimeWindows();
|
||||
return timeWindows.getTimeWindows();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -332,7 +332,7 @@ public class Service extends AbstractJob {
|
|||
*
|
||||
*/
|
||||
public TimeWindow getTimeWindow() {
|
||||
return timeWindowManager.getTimeWindows().iterator().next();
|
||||
return timeWindows.getTimeWindows().iterator().next();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -349,10 +349,11 @@ public class Service extends AbstractJob {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + "][name=" + name + "][type=" + type + "][location=" + location + "][capacity=" + size + "][serviceTime=" + serviceTime + "][timeWindow=" + timeWindow + "]";
|
||||
return "[id=" + id + "][name=" + name + "][type=" + type + "][location=" + location
|
||||
+ "][capacity=" + size + "][serviceTime=" + serviceTime + "][timeWindows="
|
||||
+ timeWindows + "]";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
|
|
|||
|
|
@ -349,10 +349,6 @@ public class Shipment extends AbstractJob {
|
|||
|
||||
private final double deliveryServiceTime;
|
||||
|
||||
private final TimeWindow deliveryTimeWindow;
|
||||
|
||||
private final TimeWindow pickupTimeWindow;
|
||||
|
||||
private final Capacity capacity;
|
||||
|
||||
private final Skills skills;
|
||||
|
|
@ -375,9 +371,7 @@ public class Shipment extends AbstractJob {
|
|||
setUserData(builder.userData);
|
||||
this.id = builder.id;
|
||||
this.pickupServiceTime = builder.pickupServiceTime;
|
||||
this.pickupTimeWindow = builder.pickupTimeWindow;
|
||||
this.deliveryServiceTime = builder.deliveryServiceTime;
|
||||
this.deliveryTimeWindow = builder.deliveryTimeWindow;
|
||||
this.capacity = builder.capacity;
|
||||
this.skills = builder.skills;
|
||||
this.name = builder.name;
|
||||
|
|
@ -448,6 +442,21 @@ public class Shipment extends AbstractJob {
|
|||
return pickupTimeWindows.getTimeWindows();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a string with the shipment's attributes.
|
||||
* <p>
|
||||
* <p>String is built as follows: [attr1=val1][attr2=val2]...
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + "][name=" + name + "][pickupLocation=" + pickupLocation_
|
||||
+ "][deliveryLocation=" + deliveryLocation_ + "][capacity=" + capacity
|
||||
+ "][pickupServiceTime=" + pickupServiceTime + "][deliveryServiceTime="
|
||||
+ deliveryServiceTime + "][pickupTimeWindows=" + pickupTimeWindows
|
||||
+ "][deliveryTimeWindows=" + deliveryTimeWindows + "]";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
|
|||
|
|
@ -48,4 +48,12 @@ public class TimeWindowsImpl implements TimeWindows {
|
|||
return Collections.unmodifiableCollection(timeWindows);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer(timeWindows.size() * 60);
|
||||
for (TimeWindow tw : timeWindows) {
|
||||
sb.append("[timeWindow=").append(tw).append("]");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue