Menu functions:

- View Vehicles
    - View Routes
This commit is contained in:
HeshamTB 2020-11-27 19:18:44 +03:00
parent b85a4040f2
commit 4346b9348d
Signed by: Hesham
GPG Key ID: 74876157D199B09E
2 changed files with 19 additions and 4 deletions

View File

@ -4,9 +4,9 @@ public class InputListener implements Runnable {
private volatile String input = "";
private volatile boolean hasNew;
private volatile boolean pause;
private final Scanner in;
private boolean stop;
private boolean pause;
public InputListener() {
in = new Scanner(System.in);

View File

@ -152,7 +152,7 @@ public class MakkahCity {
lastDayTimeMan.step(Calendar.MINUTE, 1);
//for (int i = 0; i < 46; i++) System.out.print("\b");
}
inputListener.stop();
t.interrupt();
//TODO: print final report
}
@ -182,6 +182,23 @@ public class MakkahCity {
"[3] View Campaigns\n" +
"[4] View Routes");
String chose = in.next();
if (chose.equals("1")){
System.out.printf("choose from 0 to %d", listOfVehicles.size()-1);
String c = in.next();
Vehicle v = listOfVehicles.get(Integer.parseInt(c));
//TODO: override toString() in vehicle then Bus. This will throw cast ex.
System.out.printf("%s\n Campaign: %s Street: %s Location: %.1f\n" +
"Arrived: %s Starting time: %s Arrive Time: %s\n",
v.toString(), ((Bus)v).getCampaign().getUID(),v.getCurrentStreet().getName().name(),
v.getCurrentLocation(),v.isArrivedToDest(),v.getTimeStartedMoving(),v.getTimeOfArrival());
startMenu();
}
if (chose.equals("4")){
for (int i = 0; i < stdRoutes.length; i++){
System.out.printf("[%d] %s\n", i, stdRoutes[i]);
}
String c = in.next();
}
}
private static void clearDoneCivilVehicles() {
@ -350,8 +367,6 @@ public class MakkahCity {
},District.ALAZIZIYA, Mashier.MINA);
//******Mina Leave end
// for (Route r : stdRoutes)
// System.out.println(r.toString());
}
private static void fillBusesToList() {