Route:
- 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:
parent
6d0ea7654e
commit
713e902e05
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user