From 6be06b34bc0083433c3716a26c1cf2dd8a22b5c6 Mon Sep 17 00:00:00 2001 From: sbonnet Date: Fri, 3 May 2024 14:04:43 +0200 Subject: [PATCH] Clean, comment and format --- .../impl/RemoveOldCalendarStatements.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/onebusaway-gtfs-transformer/src/main/java/org/onebusaway/gtfs_transformer/impl/RemoveOldCalendarStatements.java b/onebusaway-gtfs-transformer/src/main/java/org/onebusaway/gtfs_transformer/impl/RemoveOldCalendarStatements.java index 864ad9c9..5a9e0b98 100644 --- a/onebusaway-gtfs-transformer/src/main/java/org/onebusaway/gtfs_transformer/impl/RemoveOldCalendarStatements.java +++ b/onebusaway-gtfs-transformer/src/main/java/org/onebusaway/gtfs_transformer/impl/RemoveOldCalendarStatements.java @@ -15,23 +15,22 @@ */ package org.onebusaway.gtfs_transformer.impl; +import java.util.HashSet; +import java.util.Set; + import org.onebusaway.csv_entities.schema.annotations.CsvField; import org.onebusaway.gtfs.model.ServiceCalendar; -import org.onebusaway.gtfs.model.ServiceCalendarDate; import org.onebusaway.gtfs.services.GtfsMutableRelationalDao; import org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy; import org.onebusaway.gtfs_transformer.services.TransformContext; import org.onebusaway.gtfs_transformer.util.CalendarFunctions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.HashSet; -import java.util.Set; +/** + * Remove calendar dates that are past. + * + * remove_today: delete today's calendar dates if true. Default value is true + */ public class RemoveOldCalendarStatements implements GtfsTransformStrategy { - - private final Logger _log = LoggerFactory.getLogger(RemoveOldCalendarStatements.class); - @CsvField(optional = true) private boolean removeToday = true; @@ -53,12 +52,12 @@ public void run(TransformContext transformContext, GtfsMutableRelationalDao gtfs Set serviceCalendarsToRemove = new HashSet(); java.util.Date today = new java.util.Date(); - if(!removeToday) { + if (!removeToday) { today = helper.removeTime(today); } - for (ServiceCalendar calendar: gtfsMutableRelationalDao.getAllCalendars()) { - if (calendar.getEndDate().getAsDate().before(today)){ + for (ServiceCalendar calendar : gtfsMutableRelationalDao.getAllCalendars()) { + if (calendar.getEndDate().getAsDate().before(today)) { serviceCalendarsToRemove.add(calendar); } }