Report
This commit is contained in:
parent
3e1b1f162c
commit
bb46419ed3
@ -3,10 +3,9 @@ import java.util.*;
|
||||
public class MakkahCity {
|
||||
|
||||
private static final ArrayList<Campaign> listOfCampaigns = new ArrayList<>();
|
||||
|
||||
private static final ArrayList<Vehicle> listOfVehicles = new ArrayList<>();
|
||||
private static final Route[] stdRoutes = new Route[6];
|
||||
private static final Street[] stdStreet = new Street[8];
|
||||
private static final Street[] stdStreet = new Street[9];
|
||||
|
||||
private static final PDate timeManager = new PDate(
|
||||
new GregorianCalendar(2020, Calendar.JANUARY, 1, 4, 0, 0),
|
||||
@ -20,7 +19,7 @@ public class MakkahCity {
|
||||
generateCamps(District.ALMANSOOR, (int)getRandom(110, 160));
|
||||
generateCamps(District.ALHIJRA, (int)getRandom(80, 110));
|
||||
|
||||
//fillBusesToList();
|
||||
fillBusesToList();
|
||||
|
||||
//Make Streets
|
||||
makeStreets();
|
||||
@ -46,6 +45,8 @@ public class MakkahCity {
|
||||
//Start of every 10min
|
||||
if (timeManager.getCurrentCalendar().get(Calendar.MINUTE) % 10 == 0){
|
||||
addCivilVehicleNoise();
|
||||
printReport();
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
if (timeManager.getCurrentCalendar().get(Calendar.MINUTE) == getRandom(0,59)
|
||||
@ -80,20 +81,21 @@ public class MakkahCity {
|
||||
}
|
||||
}
|
||||
}
|
||||
Vehicle v = listOfVehicles.get(10);
|
||||
if (v.getCurrentStreet() != null) {
|
||||
System.out.printf("St: %s distance: %f total: %f %s\n",
|
||||
v.getCurrentStreet().getName(),
|
||||
v.getCurrentLocation(),
|
||||
v.getTotalDistanceTraveled(),
|
||||
timeManager.getCurrentTime());
|
||||
}
|
||||
// Vehicle v = listOfVehicles.get(150);
|
||||
// if (v.getCurrentStreet() != null) {
|
||||
// System.out.printf("St: %s distance: %f total: %f %s\n",
|
||||
// v.getCurrentStreet().getName(),
|
||||
// v.getCurrentLocation(),
|
||||
// v.getTotalDistanceTraveled(),
|
||||
// timeManager.getCurrentTime());
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//noise based on time of day (From PDate)
|
||||
|
||||
//TODO: [5]Streets move forward.
|
||||
//TODO: Get real car values.
|
||||
//TODO: Get real street lengths
|
||||
//TODO: UID For all vehicles
|
||||
|
||||
|
||||
/*
|
||||
Output:
|
||||
@ -135,14 +137,15 @@ public class MakkahCity {
|
||||
}
|
||||
|
||||
private static void makeStreets(){
|
||||
stdStreet[StreetNames.KA_STREET.ordinal()] = new Street(22700,3, StreetNames.KA_STREET);
|
||||
stdStreet[StreetNames.FOURTH_HIGHWAY.ordinal()] = new Street(24600,4, StreetNames.FOURTH_HIGHWAY);
|
||||
stdStreet[StreetNames.KUDAY.ordinal()] = new Street(22000,3, StreetNames.KUDAY);
|
||||
stdStreet[StreetNames.STREET1.ordinal()] = new Street(4000,2, StreetNames.STREET1);
|
||||
stdStreet[StreetNames.STREET2.ordinal()] = new Street(7000,2,StreetNames.STREET2);
|
||||
stdStreet[StreetNames.STREET3.ordinal()] = new Street(400,2, StreetNames.STREET3);
|
||||
stdStreet[StreetNames.STREET4.ordinal()] = new Street(8200,2,StreetNames.STREET4);
|
||||
stdStreet[StreetNames.IBRAHIM_ALKHALIL.ordinal()] = new Street(100,2, StreetNames.IBRAHIM_ALKHALIL); //TODO: [7]Change numbers
|
||||
stdStreet[StreetNames.KA_STREET.ordinal()] = new Street(4700,3, StreetNames.KA_STREET);
|
||||
stdStreet[StreetNames.FOURTH_HIGHWAY.ordinal()] = new Street(9700,4, StreetNames.FOURTH_HIGHWAY);
|
||||
stdStreet[StreetNames.THIRD_HIGHWAY.ordinal()] = new Street(8200,3, StreetNames.THIRD_HIGHWAY);
|
||||
stdStreet[StreetNames.STREET1.ordinal()] = new Street(7800,3, StreetNames.STREET1);
|
||||
stdStreet[StreetNames.STREET2.ordinal()] = new Street(2400,3,StreetNames.STREET2);
|
||||
stdStreet[StreetNames.STREET3.ordinal()] = new Street(4800,2, StreetNames.STREET3);
|
||||
stdStreet[StreetNames.STREET4.ordinal()] = new Street(3800,3,StreetNames.STREET4);
|
||||
stdStreet[StreetNames.STREET5.ordinal()] = new Street(3200,2, StreetNames.STREET5);
|
||||
stdStreet[StreetNames.IBRAHIM_ALKHALIL.ordinal()] = new Street(4500,3, StreetNames.IBRAHIM_ALKHALIL);
|
||||
}
|
||||
|
||||
private static void makeRoutes() {
|
||||
@ -151,7 +154,7 @@ public class MakkahCity {
|
||||
new Street[]{
|
||||
stdStreet[StreetNames.STREET1.ordinal()],
|
||||
stdStreet[StreetNames.STREET2.ordinal()],
|
||||
stdStreet[StreetNames.KUDAY.ordinal()]},
|
||||
stdStreet[StreetNames.THIRD_HIGHWAY.ordinal()]},
|
||||
District.ALHIJRA, Mashier.ARAFAT);
|
||||
|
||||
stdRoutes[RouteName.mashierToAlHijra2.ordinal()] = new Route(new Street[]{
|
||||
@ -172,8 +175,8 @@ public class MakkahCity {
|
||||
new Street[]{
|
||||
stdStreet[StreetNames.STREET1.ordinal()],
|
||||
stdStreet[StreetNames.STREET2.ordinal()],
|
||||
stdStreet[StreetNames.KUDAY.ordinal()],
|
||||
stdStreet[StreetNames.IBRAHIM_ALKHALIL.ordinal()]//TODO: [8]is actually half of ibrahim khalil.
|
||||
stdStreet[StreetNames.THIRD_HIGHWAY.ordinal()],
|
||||
stdStreet[StreetNames.STREET5.ordinal()]//TODO: [8]is actually half of ibrahim khalil.
|
||||
},District.ALMANSOOR, Mashier.ARAFAT);
|
||||
|
||||
//Optimal for Almansoor
|
||||
@ -207,7 +210,8 @@ public class MakkahCity {
|
||||
int numOfTruck = (int)getRandom(0, 2);
|
||||
|
||||
if (street.getName() == StreetNames.FOURTH_HIGHWAY) numOfSedan = (int) (numOfSedan * 0.5);
|
||||
if (street.getName() == StreetNames.STREET1) numOfSedan = (int) (numOfSedan * 1.5); //add more streets
|
||||
if (street.getName() == StreetNames.STREET3) numOfSedan = (int) (numOfSedan * 1.5);
|
||||
if (street.getName() == StreetNames.STREET5) numOfSedan = (int) (numOfSedan * 1.5);
|
||||
for (int x = 0; x < numOfSedan; x++) {
|
||||
Sedan car = new Sedan(getRandom(4, 5));
|
||||
double pointOfEntry = getRandom(0, street.getLength());
|
||||
@ -221,7 +225,8 @@ public class MakkahCity {
|
||||
}
|
||||
|
||||
if (street.getName() == StreetNames.FOURTH_HIGHWAY) numOfTruck = (int) (numOfTruck * 0.5);
|
||||
if (street.getName() == StreetNames.STREET1) numOfTruck = (int) (numOfTruck * 1.5); //add more streets
|
||||
if (street.getName() == StreetNames.STREET3) numOfTruck = (int) (numOfTruck * 1.5);
|
||||
if (street.getName() == StreetNames.STREET5) numOfSedan = (int) (numOfSedan * 1.5);
|
||||
for (int x = 0; x < numOfTruck; x++) {
|
||||
Truck car = new Truck(getRandom(4, 5));
|
||||
double pointOfEntry = getRandom(0, street.getLength());
|
||||
@ -234,7 +239,8 @@ public class MakkahCity {
|
||||
}
|
||||
|
||||
if (street.getName() == StreetNames.FOURTH_HIGHWAY) numOfSUV = (int) (numOfSUV * 0.5);
|
||||
if (street.getName() == StreetNames.STREET1) numOfSUV = (int) (numOfSUV * 1.5); //add more streets
|
||||
if (street.getName() == StreetNames.STREET3) numOfSUV = (int) (numOfSUV * 1.5);
|
||||
if (street.getName() == StreetNames.STREET5) numOfSedan = (int) (numOfSedan * 1.5);
|
||||
for (int x = 0; x < numOfSUV; x++) {
|
||||
SUV car = new SUV(getRandom(4, 5));
|
||||
double pointOfEntry = getRandom(0, street.getLength());
|
||||
@ -312,5 +318,24 @@ public class MakkahCity {
|
||||
Route[] routesArray = new Route[routes.size()];
|
||||
return routes.toArray(routesArray);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void printReport() {
|
||||
for(Street street : stdStreet) {
|
||||
System.out.printf("StreetName: %s NumberOfVheciles : %d Capcity: %f\n",street.getName().name(),street.getVehicles().size(), street.capcity());
|
||||
int qurter = (int) street.getLength()/4;
|
||||
double capcity = 0;
|
||||
for(int i = 0; i < 4; i++) {
|
||||
capcity = street.capcityPoint(i * qurter, qurter * (i+1));
|
||||
System.out.printf("qurter%d : %.2f", (1+1) , capcity );
|
||||
}
|
||||
System.out.println("\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,12 +4,15 @@
|
||||
public enum StreetNames {
|
||||
|
||||
KA_STREET,
|
||||
KUDAY,
|
||||
THIRD_HIGHWAY,
|
||||
FOURTH_HIGHWAY,
|
||||
STREET1,
|
||||
STREET2,
|
||||
STREET3,
|
||||
STREET4,
|
||||
IBRAHIM_ALKHALIL
|
||||
STREET5,
|
||||
IBRAHIM_ALKHALIL,
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user