use of org.opentripplanner.graph_builder.issues.NoFutureDates in project OpenTripPlanner by opentripplanner.
the class Graph method updateTransitFeedValidity.
// Infer the time period covered by the transit feed
public void updateTransitFeedValidity(CalendarServiceData data, DataImportIssueStore issueStore) {
long now = new Date().getTime() / 1000;
final long SEC_IN_DAY = 24 * 60 * 60;
HashSet<String> agenciesWithFutureDates = new HashSet<String>();
HashSet<String> agencies = new HashSet<String>();
for (FeedScopedId sid : data.getServiceIds()) {
agencies.add(sid.getFeedId());
for (ServiceDate sd : data.getServiceDatesForServiceId(sid)) {
// Adjust for timezone, assuming there is only one per graph.
long t = sd.getAsDate(getTimeZone()).getTime() / 1000;
if (t > now) {
agenciesWithFutureDates.add(sid.getFeedId());
}
// assume feed is unreliable after midnight on last service day
long u = t + SEC_IN_DAY;
if (t < this.transitServiceStarts)
this.transitServiceStarts = t;
if (u > this.transitServiceEnds)
this.transitServiceEnds = u;
}
}
for (String agency : agencies) {
if (!agenciesWithFutureDates.contains(agency)) {
issueStore.add(new NoFutureDates(agency));
}
}
}
Aggregations