Move counting methods to street
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
b06a15e303
commit
86a4ac509a
@ -1,8 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="Hajj-simulation:jar-run">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/Hajj_simulation_jar_run</output-path>
|
||||
<root id="archive" name="Hajj-simulation.jar">
|
||||
<element id="module-output" name="Hajj-simulation" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
@ -335,8 +335,8 @@ public class MakkahCity {
|
||||
street.getName().name(),
|
||||
cap,
|
||||
street.getVehicles().size(),
|
||||
getNumberOfBuses(street),
|
||||
getNumberOfLocalCars(street));
|
||||
street.getNumberOfBuses(),
|
||||
street.getNumberOfLocalCars());
|
||||
}
|
||||
return report;
|
||||
}
|
||||
@ -398,20 +398,4 @@ public class MakkahCity {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int getNumberOfBuses(Street street) {
|
||||
int number = 0;
|
||||
for (Vehicle vehicle : street.getVehicles()) {
|
||||
if (vehicle instanceof Bus) number++;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
private static int getNumberOfLocalCars(Street street) {
|
||||
int number = 0;
|
||||
for (Vehicle vehicle : street.getVehicles()) {
|
||||
if (vehicle instanceof CivilVehicle && !(vehicle instanceof Bus)) number++;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -139,4 +139,20 @@ public class Street {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int getNumberOfBuses() {
|
||||
int number = 0;
|
||||
for (Vehicle vehicle : this.getVehicles()) {
|
||||
if (vehicle instanceof Bus) number++;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
public int getNumberOfLocalCars() {
|
||||
int number = 0;
|
||||
for (Vehicle vehicle : this.getVehicles()) {
|
||||
if (vehicle instanceof CivilVehicle && !(vehicle instanceof Bus)) number++;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user