Route override toString()
- Print length, names of streets Estimated time (Best case) and endpoints.
This commit is contained in:
parent
b214b279db
commit
5fde1eee7e
@ -315,6 +315,8 @@ public class MakkahCity {
|
||||
},District.ALAZIZIYA, Mashier.MINA);
|
||||
//******Mina Leave end
|
||||
|
||||
// for (Route r : stdRoutes)
|
||||
// System.out.println(r.toString());
|
||||
}
|
||||
|
||||
private static void fillBusesToList() {
|
||||
|
@ -42,6 +42,20 @@ public class Route {
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(super.toString())
|
||||
.append("\n").append(String.format("%s:%s",getHotelArea().name(),getMashier().name()))
|
||||
.append("\n")
|
||||
.append("Length: ").append(getTotalLength())
|
||||
.append("\n")
|
||||
.append("Streets: ");
|
||||
for (Street street : this.getStreets())
|
||||
s.append(street.getName().name()).append(" ");
|
||||
s.append("\nBest Time: ").append(getFastestTimeOfTravel(new Bus())).append("\n");
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public District getHotelArea() {
|
||||
return hotelArea;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user