Main view updates every Hour instead of min

This commit is contained in:
HeshamTB 2020-12-14 04:40:45 +03:00
parent 5143ae2891
commit 270e89ee5b
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -68,10 +68,7 @@ public class MakkahCity {
addCivilVehicleNoise(); addCivilVehicleNoise();
makeRoutes(); makeRoutes();
// Vehicle car = traceCar();
//TODO Arrival Time for Each Day
//GUI //GUI
autoModeCheckBox = new Checkbox(); autoModeCheckBox = new Checkbox();
makkahFrame = new JFrame("Hajj Simulation"); makkahFrame = new JFrame("Hajj Simulation");
@ -165,7 +162,7 @@ public class MakkahCity {
btnViewBuses.setForeground(Color.white); btnViewBuses.setForeground(Color.white);
btnViewBuses.addActionListener(e -> { btnViewBuses.addActionListener(e -> {
GUI_ViewBuses t = new GUI_ViewBuses(listOfCampaigns , currenttimeManager); GUI_ViewBuses t = new GUI_ViewBuses(listOfCampaigns , currenttimeManager);
});// TODO: the list is update every MINUTE, we don't need it. });
JButton btnViewCampaigns = new JButton("View Campaigns"); JButton btnViewCampaigns = new JButton("View Campaigns");
btnViewCampaigns.setBounds(1307, 119, 166, 29); btnViewCampaigns.setBounds(1307, 119, 166, 29);
@ -369,6 +366,7 @@ public class MakkahCity {
//Start of Every hour //Start of Every hour
if (firstDayTimeMan.getCurrentCalendar().get(Calendar.MINUTE) == 0){ if (firstDayTimeMan.getCurrentCalendar().get(Calendar.MINUTE) == 0){
System.out.println("\n\n" + getStreetsReport()); System.out.println("\n\n" + getStreetsReport());
updateStreetFrame();
saveState(); saveState();
} }
else System.out.print("."); else System.out.print(".");
@ -407,9 +405,7 @@ public class MakkahCity {
} }
} }
if (isAllArrived() && allArrivedToArafatTime == null) allArrivedToArafatTime = (Date)currenttimeManager.getCurrentTime().clone(); if (isAllArrived() && allArrivedToArafatTime == null) allArrivedToArafatTime = (Date)currenttimeManager.getCurrentTime().clone();
updateStreetFrame();
firstDayTimeMan.step(Calendar.MINUTE, 1); firstDayTimeMan.step(Calendar.MINUTE, 1);
// System.out.println(car);
} }
currenttimeManager = lastDayTimeMan; currenttimeManager = lastDayTimeMan;
@ -430,6 +426,8 @@ public class MakkahCity {
//Start of Every hour //Start of Every hour
if (lastDayTimeMan.getCurrentCalendar().get(Calendar.MINUTE) == 0){ if (lastDayTimeMan.getCurrentCalendar().get(Calendar.MINUTE) == 0){
System.out.println("\n\n" + getStreetsReport()); System.out.println("\n\n" + getStreetsReport());
updateStreetFrame();
saveState();
} }
else System.out.print("."); else System.out.print(".");
@ -467,7 +465,6 @@ public class MakkahCity {
} }
} }
if (isAllArrived() && allArrivedToHotelsTime == null) allArrivedToHotelsTime = (Date)currenttimeManager.getCurrentTime().clone(); if (isAllArrived() && allArrivedToHotelsTime == null) allArrivedToHotelsTime = (Date)currenttimeManager.getCurrentTime().clone();
updateStreetFrame();
lastDayTimeMan.step(Calendar.MINUTE, 1); lastDayTimeMan.step(Calendar.MINUTE, 1);
} }
//When done show menu to analyze. Exit from menu too. //When done show menu to analyze. Exit from menu too.