/*******************************************************************************
 * Copyright (C) 2013  Stefan Schroeder
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either 
 * version 3.0 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
package jsprit.core.problem.solution.route.activity;

/**
 * 
 * @author stefan schroeder
 * 
 */

public class TimeWindow {
	
	public static TimeWindow newInstance(double start, double end){
		return new TimeWindow(start,end);
	}
	
	private final double start;
	private final double end;

	public TimeWindow(double start, double end) {
		super();
		this.start = start;
		this.end = end;
	}

	public double getStart() {
		return start;
	}

	public double getEnd() {
		return end;
	}

	@Override
	public String toString() {
		return "[start=" + start + "][end=" + end + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(end);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(start);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TimeWindow other = (TimeWindow) obj;
		if (Double.doubleToLongBits(end) != Double.doubleToLongBits(other.end))
			return false;
		if (Double.doubleToLongBits(start) != Double
				.doubleToLongBits(other.start))
			return false;
		return true;
	}

	
}

@@ -930,16 +930,67 @@
 y;%0A%0A/**%0A
+ * TimeWindow consists of a startTime and endTime.%0A
  * %0A * @
@@ -1055,319 +1055,1006 @@
 %0A%09%0A%09
-public static TimeWindow newInstance(double start, double end)%7B%0A%09%09return new TimeWindow(start,end);%0A%09%7D%0A%09%0A%09private final double start;%0A%09private final double end;%0A%0A%09public TimeWindow(double start, double end) %7B%0A%09%09super();%0A%09%09this.start = start;%0A%09%09this.end = end;%0A%09%7D%0A%0A%09public double getStart() %7B%0A%09%09return start;%0A%09%7D%0A
+/**%0A%09 * Returns new instance of TimeWindow.%0A%09 * %0A%09 * @param start%0A%09 * @param end%0A%09 * @return TimeWindow%0A%09 * @throw IllegalArgumentException either if start or end %3C 0.0 or end %3C start%0A%09 */%0A%09public static TimeWindow newInstance(double start, double end)%7B%0A%09%09return new TimeWindow(start,end);%0A%09%7D%0A%09%0A%09private final double start;%0A%09private final double end;%0A%0A%09/**%0A%09 * Constructs the timeWindow%0A%09 * %0A%09 * @param start%0A%09 * @param end%0A%09 * @throw IllegalArgumentException either if start or end %3C 0.0 or end %3C start%0A%09 */%0A%09public TimeWindow(double start, double end) %7B%0A%09%09super();%0A%09%09if(start %3C 0.0 %7C%7C end %3C 0.0) throw new IllegalArgumentException(%22neither start nor end must be %3C 0.0%22);%0A%09%09if(end %3C start) throw new IllegalArgumentException(%22end cannot be smaller than start%22);%0A%09%09this.start = start;%0A%09%09this.end = end;%0A%09%7D%0A%0A%09/**%0A%09 * Returns startTime of TimeWindow.%0A%09 * %0A%09 * @return startTime%0A%09 */%0A%09public double getStart() %7B%0A%09%09return start;%0A%09%7D%0A%0A%09/**%0A%09 * Returns endTime of TimeWindow.%0A%09 * %0A%09 * @return endTime%0A%09 */
 %0A%09pu
@@ -2492,24 +2492,105 @@
 result;%0A%09%7D%0A%0A
+%09/**%0A%09 * Two timeWindows are equal if they have the same start AND endTime.%0A%09 */%0A
 %09@Override%0A%09

add boundaries