use of org.onebusaway.gtfs.model.calendar.LocalizedServiceId in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarServiceImpl method getServiceDates.
private Map<LocalizedServiceId, List<Date>> getServiceDates(ServiceIdIntervals serviceIdIntervals, ServiceIdOp op, Date from, Date to, boolean includeNextDate) {
CalendarServiceData allData = getData();
Map<LocalizedServiceId, List<Date>> results = new HashMap<LocalizedServiceId, List<Date>>();
for (Map.Entry<LocalizedServiceId, ServiceInterval> entry : serviceIdIntervals) {
LocalizedServiceId serviceId = entry.getKey();
ServiceInterval interval = entry.getValue();
List<Date> serviceDates = getServiceDates(allData, serviceId, interval, op, from, to, includeNextDate);
if (!serviceDates.isEmpty())
results.put(serviceId, serviceDates);
}
return results;
}
use of org.onebusaway.gtfs.model.calendar.LocalizedServiceId in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarServiceImplSyntheticTest method testGetServiceDatesWithinRange06.
@Test
public void testGetServiceDatesWithinRange06() {
Date from = date("2010-02-02 00:30 Pacific Standard Time");
Date to = date("2010-02-02 00:45 Pacific Standard Time");
Map<LocalizedServiceId, List<Date>> result = service.getServiceDateArrivalsWithinRange(intervals, from, to);
assertEquals(1, result.size());
List<Date> dates = result.get(lsid1);
assertEquals(1, dates.size());
assertTrue(dates.contains(d1.getAsDate(tz)));
result = service.getServiceDateDeparturesWithinRange(intervals, from, to);
assertEquals(1, result.size());
dates = result.get(lsid1);
assertEquals(1, dates.size());
assertTrue(dates.contains(d1.getAsDate(tz)));
}
use of org.onebusaway.gtfs.model.calendar.LocalizedServiceId in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarServiceImplSyntheticTest method testGetServiceDatesWithinRange03.
@Test
public void testGetServiceDatesWithinRange03() {
Date from = date("2010-02-02 03:30 Pacific Standard Time");
Date to = date("2010-02-02 03:45 Pacific Standard Time");
Map<LocalizedServiceId, List<Date>> result = service.getServiceDateArrivalsWithinRange(intervals, from, to);
assertEquals(0, result.size());
}
use of org.onebusaway.gtfs.model.calendar.LocalizedServiceId in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarServiceImplSyntheticTest method testGetServiceDatesWithinRange07.
@Test
public void testGetServiceDatesWithinRange07() {
Date from = date("2010-02-02 00:30 Pacific Standard Time");
Date to = date("2010-02-02 01:45 Pacific Standard Time");
Map<LocalizedServiceId, List<Date>> result = service.getServiceDateArrivalsWithinRange(intervals, from, to);
assertEquals(1, result.size());
List<Date> dates = result.get(lsid1);
assertEquals(1, dates.size());
assertTrue(dates.contains(d1.getAsDate(tz)));
result = service.getServiceDateDeparturesWithinRange(intervals, from, to);
assertEquals(1, result.size());
dates = result.get(lsid1);
assertEquals(1, dates.size());
assertTrue(dates.contains(d1.getAsDate(tz)));
result = service.getServiceDatesWithinRange(intervals, from, to);
assertEquals(1, result.size());
dates = result.get(lsid1);
assertEquals(1, dates.size());
assertTrue(dates.contains(d1.getAsDate(tz)));
}
use of org.onebusaway.gtfs.model.calendar.LocalizedServiceId in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarServiceImplSyntheticTest method testGetServiceDatesWithinRange05.
@Test
public void testGetServiceDatesWithinRange05() {
Date from = date("2010-02-02 04:30 Pacific Standard Time");
Date to = date("2010-02-02 04:45 Pacific Standard Time");
Map<LocalizedServiceId, List<Date>> result = service.getServiceDateDeparturesWithinRange(intervals, from, to);
assertEquals(0, result.size());
}
Aggregations