Skip to content

Commit

Permalink
use Logger instead of System.out (GTFS library does not use that Logger)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsp-gleich committed Nov 4, 2019
1 parent 013f4ae commit 877e211
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/org/matsim/contrib/gtfs/GtfsConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void convert(){
}
}
}
System.out.println("Earliest date mentioned in feed: "+startDate);
log.info("Earliest date mentioned in feed: "+startDate);

LocalDate endDate = LocalDate.MIN;
for(Service service: this.feed.services.values()) {
Expand All @@ -83,15 +83,15 @@ public void convert(){
}

}
System.out.println("Latest date mentioned in feed: " + endDate);
log.info("Latest date mentioned in feed: " + endDate);

// Get the used service Id for the chosen weekday and date
List<String> activeServiceIds = this.getActiveServiceIds(this.feed.services);
System.out.printf("Active Services: %d %s\n", activeServiceIds.size(), activeServiceIds);
log.info(String.format("Active Services: %d %s", activeServiceIds.size(), activeServiceIds));

// Get the Trips which are active today
List<Trip> activeTrips = feed.trips.values().stream().filter(trip -> feed.services.get(trip.service_id).activeOn(this.date)).collect(Collectors.toList());
System.out.printf("Active Trips: %d %s\n", activeTrips.size(), activeTrips.stream().map(trip -> trip.trip_id).collect(Collectors.toList()));
log.info(String.format("Active Trips: %d %s", activeTrips.size(), activeTrips.stream().map(trip -> trip.trip_id).collect(Collectors.toList())));

// Create one TransitLine for each GTFS-Route which has an active trip
activeTrips.stream().map(trip -> feed.routes.get(trip.route_id)).distinct().forEach(route -> {
Expand All @@ -114,9 +114,9 @@ public void convert(){
this.convertTrips(activeTrips);

if(activeTrips.isEmpty()){
System.out.println("There are no converted trips. You might need to change the date for better results.");
log.warn("There are no converted trips. You might need to change the date for better results.");
}
System.out.println("Conversion successfull");
log.info("Conversion successfull");
}


Expand All @@ -131,7 +131,7 @@ private void convertStops(){

private List<String> getActiveServiceIds(Map<String, Service> services) {
List<String> serviceIds = new ArrayList<>();
System.out.println("Used Date for active schedules: " + this.date.toString() + " (weekday: " + date.getDayOfWeek().toString() + "). If you want to choose another date, please specify it, before running the converter");
log.info("Used Date for active schedules: " + this.date.toString() + " (weekday: " + date.getDayOfWeek().toString() + "). If you want to choose another date, please specify it, before running the converter");
for(Service service: services.values()){
if(service.activeOn(date)){
serviceIds.add(service.service_id);
Expand Down Expand Up @@ -202,8 +202,8 @@ private void convertTrips(List<Trip> trips) {
}
}
}
System.out.println("Created schedule-based departures: " + scheduleDepartures);
System.out.println("Created frequency-based departures: " + frequencyDepartures);
log.info("Created schedule-based departures: " + scheduleDepartures);
log.info("Created frequency-based departures: " + frequencyDepartures);
}


Expand Down

0 comments on commit 877e211

Please sign in to comment.