Compare commits
3 Commits
master
...
add-loggin
Author | SHA1 | Date | |
---|---|---|---|
aa5cc9b68b | |||
1fa3e4f5f1 | |||
2d8456c975 |
@ -1,4 +1,8 @@
|
||||
import java.util.*;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
|
||||
public class MakkahCity {
|
||||
|
||||
@ -19,9 +23,22 @@ public class MakkahCity {
|
||||
);
|
||||
|
||||
private static PDate currenttimeManager = firstDayTimeMan;
|
||||
private static Logger log = Logger.getLogger("MakkahCity");
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
log.setLevel(Level.FINE);
|
||||
try {
|
||||
FileHandler fileHandler = new FileHandler("log.txt");
|
||||
SimpleFormatter f = new SimpleFormatter();
|
||||
fileHandler.setFormatter(f);
|
||||
log.addHandler(fileHandler);
|
||||
log.log(Level.FINE,"File Handler passed");
|
||||
}
|
||||
catch (Exception e){
|
||||
System.err.println("Cant start log");
|
||||
}
|
||||
log.log(Level.FINE,"Starting Hajj-simulation");
|
||||
//Gen Camp
|
||||
campPerDistrict[District.ALMANSOOR.ordinal()] = new ArrayList<>();
|
||||
campPerDistrict[District.ALAZIZIYA.ordinal()] = new ArrayList<>();
|
||||
@ -30,6 +47,8 @@ public class MakkahCity {
|
||||
generateCamps(District.ALMANSOOR, (int)getRandom(1600, 1800));
|
||||
generateCamps(District.ALHIJRA, (int)getRandom(1400, 1600));
|
||||
|
||||
log.fine(String.format("Generated %d Campaigns", listOfCampaigns.size()));
|
||||
|
||||
fillBusesToList();
|
||||
|
||||
makeStreets();
|
||||
@ -78,6 +97,7 @@ public class MakkahCity {
|
||||
if (!vehicle.isArrivedToDest()) {
|
||||
double factor = 1-(vehicle.getCurrentStreet().capcityPoint(vehicle.getCurrentLocation(),
|
||||
vehicle.getCurrentLocation()+1000,vehicle)) ;
|
||||
log.info(String.format("Vehicle %s moving with factor %f on street %s",vehicle, factor, vehicle.getCurrentStreet()));
|
||||
if (vehicle instanceof Bus) vehicle.move(Bus.MAX_FORWARD * factor );
|
||||
else if (vehicle instanceof Sedan) vehicle.move(Sedan.MAX_FORWARD * factor );
|
||||
else if (vehicle instanceof SUV) vehicle.move(SUV.MAX_FORWARD * factor );
|
||||
@ -423,6 +443,7 @@ public class MakkahCity {
|
||||
if (r.getTotalLength() < min) {
|
||||
min = r.getTotalLength();
|
||||
route = r;
|
||||
log.info(String.format("Set Route %s for campaign %s",r , campaign));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user