Pre-simulation report:
- Make report with details per District (Still incomplete) - Use String builder for all reports.
This commit is contained in:
parent
946e4004ae
commit
bba5441aee
@ -40,8 +40,7 @@ public class MakkahCity {
|
|||||||
|
|
||||||
//Set Routes for Campaigns
|
//Set Routes for Campaigns
|
||||||
setRoutesForCampaigns(Mashier.ARAFAT);
|
setRoutesForCampaigns(Mashier.ARAFAT);
|
||||||
//TODO: print info before simulation. (Camps per District ...)
|
System.out.println(preSimulationReport());
|
||||||
//TODO: use Queues or Wating area for each street?
|
|
||||||
while(!firstDayTimeMan.isEnded()) {
|
while(!firstDayTimeMan.isEnded()) {
|
||||||
//Start of Every hour
|
//Start of Every hour
|
||||||
if (firstDayTimeMan.getCurrentCalendar().get(Calendar.MINUTE) == 0){
|
if (firstDayTimeMan.getCurrentCalendar().get(Calendar.MINUTE) == 0){
|
||||||
@ -471,26 +470,26 @@ public class MakkahCity {
|
|||||||
"Time: %s%s\n" +
|
"Time: %s%s\n" +
|
||||||
" Street name |Street Load| Total | Buses | Local Vehicles |" +
|
" Street name |Street Load| Total | Buses | Local Vehicles |" +
|
||||||
"*********| District | Average Arrival\n";
|
"*********| District | Average Arrival\n";
|
||||||
String report = "";
|
StringBuilder report = new StringBuilder();
|
||||||
report = report + String.format(headerFormat, currenttimeManager.getCurrentTime(), status);
|
report.append(String.format(headerFormat, currenttimeManager.getCurrentTime(), status));
|
||||||
String streetFormat = "%-27s | %%%-8s | %5d | %5d | %14d |";
|
String streetFormat = "%-27s | %%%-8s | %5d | %5d | %14d |";
|
||||||
String districtForamt = " | %-9s | %%%2d ";
|
String districtForamt = " | %-9s | %%%2d ";
|
||||||
for (int i = 0; i < stdStreet.length; i++) {
|
for (int i = 0; i < stdStreet.length; i++) {
|
||||||
int cap = stdStreet[i].getPercentRemainingCapacity();
|
int cap = stdStreet[i].getPercentRemainingCapacity();
|
||||||
report = report + String.format(streetFormat,
|
report.append(String.format(streetFormat,
|
||||||
getColoredStreetName(stdStreet[i],cap),
|
getColoredStreetName(stdStreet[i], cap),
|
||||||
cap,
|
cap,
|
||||||
stdStreet[i].getVehicles().size(),
|
stdStreet[i].getVehicles().size(),
|
||||||
stdStreet[i].getNumberOfBuses(),
|
stdStreet[i].getNumberOfBuses(),
|
||||||
stdStreet[i].getNumberOfLocalCars());
|
stdStreet[i].getNumberOfLocalCars()));
|
||||||
if (i < 3){
|
if (i < 3){
|
||||||
report = report + String.format(districtForamt, District.values()[i], getAvgOfDistrict(District.values()[i]));
|
report.append(String.format(districtForamt, District.values()[i], getAvgOfDistrict(District.values()[i])));
|
||||||
}
|
}
|
||||||
report += "\n";
|
report.append("\n");
|
||||||
}
|
}
|
||||||
report = report + "\n"+getFinalRep();
|
report.append("\n").append(getFinalRep());
|
||||||
report = report + "*************************";
|
report.append("*************************");
|
||||||
return report;
|
return report.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getFinalRep() {
|
private static String getFinalRep() {
|
||||||
@ -572,6 +571,22 @@ public class MakkahCity {
|
|||||||
return s + ANSI_RESET;
|
return s + ANSI_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String preSimulationReport() {
|
||||||
|
StringBuilder report = new StringBuilder();
|
||||||
|
report.append("******************************District details******************************\n");
|
||||||
|
report.append("District | Campaigns | Busses | Est. time to Arafat | Est. time to District \n");
|
||||||
|
for (int i = 0; i < campPerDistrict.length; i++) {
|
||||||
|
//Per District, i denotes district index
|
||||||
|
report.append(String.format("%-9s|",campPerDistrict[i].get(0).getHotelDistrict().name()));
|
||||||
|
|
||||||
|
report.append(String.format(" %-10d|",campPerDistrict[i].size()));
|
||||||
|
//Calc values per dist here.
|
||||||
|
|
||||||
|
report.append("\n");
|
||||||
|
}
|
||||||
|
return report.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public static final String ANSI_RESET = "\u001B[0m";
|
public static final String ANSI_RESET = "\u001B[0m";
|
||||||
public static final String ANSI_BLACK = "\u001B[30m";
|
public static final String ANSI_BLACK = "\u001B[30m";
|
||||||
public static final String ANSI_RED = "\u001B[31m";
|
public static final String ANSI_RED = "\u001B[31m";
|
||||||
|
Loading…
Reference in New Issue
Block a user