- Changed constructor to take
	Enums of District and Mashier
	as endpoint (start, end)

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2020-11-10 00:00:20 +03:00
parent 6d0ea7654e
commit 713e902e05

View File

@ -1,9 +1,13 @@
public class Route {
private Street[] streets;
private District hotelArea;
private Mashier mashier;
public Route(Street[] streets) {
this.streets = streets;
public Route(Street[] streets, District hotelArea, Mashier mashier) {
setStreets(streets);
setHotelArea(hotelArea);
setMashier(mashier);
}
public Street[] getStreets() {
@ -18,4 +22,30 @@ public class Route {
return totalLength;
}
public District getHotelArea() {
return hotelArea;
}
public Mashier getMashier() {
return mashier;
}
private void setStreets(Street[] streets) {
if (streets != null) this.streets = streets;
else throwIllegal();
}
private void setHotelArea(District hotelArea) {
if (hotelArea != null) this.hotelArea = hotelArea;
else throwIllegal();
}
private void setMashier(Mashier mashier) {
if (mashier != null) this.mashier = mashier;
else throwIllegal();
}
private void throwIllegal() {
throw new IllegalArgumentException();
}
}