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

add boundaries

This commit is contained in:
oblonski 2014-01-16 16:55:26 -05:00
parent 7b1a2bd9b0
commit ca0caf450c

View file

@ -17,6 +17,7 @@
package jsprit.core.problem.solution.route.activity;
/**
* TimeWindow consists of a startTime and endTime.
*
* @author stefan schroeder
*
@ -24,6 +25,14 @@ package jsprit.core.problem.solution.route.activity;
public class TimeWindow {
/**
* Returns new instance of TimeWindow.
*
* @param start
* @param end
* @return TimeWindow
* @throw IllegalArgumentException either if start or end < 0.0 or end < start
*/
public static TimeWindow newInstance(double start, double end){
return new TimeWindow(start,end);
}
@ -31,16 +40,35 @@ public class TimeWindow {
private final double start;
private final double end;
/**
* Constructs the timeWindow
*
* @param start
* @param end
* @throw IllegalArgumentException either if start or end < 0.0 or end < start
*/
public TimeWindow(double start, double end) {
super();
if(start < 0.0 || end < 0.0) throw new IllegalArgumentException("neither start nor end must be < 0.0");
if(end < start) throw new IllegalArgumentException("end cannot be smaller than start");
this.start = start;
this.end = end;
}
/**
* Returns startTime of TimeWindow.
*
* @return startTime
*/
public double getStart() {
return start;
}
/**
* Returns endTime of TimeWindow.
*
* @return endTime
*/
public double getEnd() {
return end;
}
@ -62,6 +90,9 @@ public class TimeWindow {
return result;
}
/**
* Two timeWindows are equal if they have the same start AND endTime.
*/
@Override
public boolean equals(Object obj) {
if (this == obj)