Merge branch 'master' into master

This commit is contained in:
HeshamTB 2020-11-10 17:06:28 +03:00 committed by GitHub
commit f3258355fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -14,7 +14,9 @@ public class MakkahCity {
generateCamps(District.ALAZIZIYA, getRandom(70, 100));
generateCamps(District.ALMANSOOR, getRandom(110, 160));
generateCamps(District.ALHIJRA, getRandom(80, 110));
fillBusesToList();
//Make Streets
makeStreets();
@ -60,6 +62,8 @@ public class MakkahCity {
}
private static void fillBusesToList() {
//TODO: add all buses from campaigns to vehiclesList
for (Campaign camp : allCampgains) {
vehiclesList.addAll(camp.getVehicles());
}
}
}

View File

@ -12,6 +12,7 @@ public class Street {
setNumberOfLanes(numberOfLanes);
}
//TODO: should be removed. list can be over the capacity Unless we check with street cap.
public Street(double length, int numberOfLanes, ArrayList<Vehicle> vehicles) {
this(length, numberOfLanes);
this.vehicles = vehicles;
@ -56,6 +57,10 @@ public class Street {
}
return totalLength -(totalLenthofCar + 0.5*(vehicles.size() - 2));
}
public int getPercentRemainingCapacity() {
return (int) (capcity()/(this.length*this.numberOfLanes))*100;
}
public boolean canTakeVehicles( Vehicle vehicle ) {
if ( vehicle.getVehicleSize() > capcity() )