org.opentripplanner.model.calendar.impl.CalendarServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
/* This file is based on code copied from project OneBusAway, see the LICENSE file for further information. */
package org.opentripplanner.model.calendar.impl;
import org.opentripplanner.model.calendar.CalendarService;
import org.opentripplanner.model.FeedScopedId;
import org.opentripplanner.model.calendar.CalendarServiceData;
import org.opentripplanner.model.calendar.ServiceDate;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
/**
* An implementation of {@link CalendarService}. Requires a pre-computed
* {@link CalendarServiceData} bundle for efficient operation.
*
* @author bdferris
*
*/
public class CalendarServiceImpl implements CalendarService {
private final CalendarServiceData data;
public CalendarServiceImpl(CalendarServiceData data) {
this.data = data;
}
@Override
public Set getServiceIds() {
return data.getServiceIds();
}
@Override
public Set getServiceDatesForServiceId(FeedScopedId serviceId) {
Set dates = new HashSet<>();
List serviceDates = data.getServiceDatesForServiceId(serviceId);
if (serviceDates != null) {
dates.addAll(serviceDates);
}
return dates;
}
@Override
public Set getServiceIdsOnDate(ServiceDate date) {
return data.getServiceIdsForDate(date);
}
@Override
public TimeZone getTimeZoneForAgencyId(FeedScopedId agencyId) {
return data.getTimeZoneForAgencyId(agencyId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy