use of org.onebusaway.gtfs.model.calendar.ServiceDate in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarServiceImpl method isLocalizedServiceIdActiveOnDate.
@Override
public boolean isLocalizedServiceIdActiveOnDate(LocalizedServiceId localizedServiceId, Date serviceDate) {
// TODO : Make this more efficient?
CalendarServiceData data = getData();
List<Date> dates = data.getDatesForLocalizedServiceId(localizedServiceId);
return Collections.binarySearch(dates, serviceDate) >= 0;
}
use of org.onebusaway.gtfs.model.calendar.ServiceDate in project onebusaway-gtfs-modules by OneBusAway.
the class AnomalyCheckFutureTripCounts method constructDate.
private Date constructDate(ServiceDate date) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, date.getYear());
calendar.set(Calendar.MONTH, date.getMonth() - 1);
calendar.set(Calendar.DATE, date.getDay());
Date date1 = calendar.getTime();
date1 = removeTime(date1);
return date1;
}
use of org.onebusaway.gtfs.model.calendar.ServiceDate in project onebusaway-gtfs-modules by OneBusAway.
the class CountAndTest method constructDate.
private Date constructDate(ServiceDate date) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, date.getYear());
calendar.set(Calendar.MONTH, date.getMonth() - 1);
calendar.set(Calendar.DATE, date.getDay());
Date date1 = calendar.getTime();
date1 = removeTime(date1);
return date1;
}
use of org.onebusaway.gtfs.model.calendar.ServiceDate in project onebusaway-gtfs-modules by OneBusAway.
the class CountAndTestBus method constructDate.
private Date constructDate(ServiceDate date) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, date.getYear());
calendar.set(Calendar.MONTH, date.getMonth() - 1);
calendar.set(Calendar.DATE, date.getDay());
Date date1 = calendar.getTime();
date1 = removeTime(date1);
return date1;
}
use of org.onebusaway.gtfs.model.calendar.ServiceDate in project onebusaway-gtfs-modules by OneBusAway.
the class CountAndTestBus method tripIsThisWeek.
private boolean tripIsThisWeek(Set<ServiceDate> serviceDates) {
Date today = removeTime(new Date());
Date inOneWeek = removeTime(addDays(new Date(), 7));
for (ServiceDate calDate : serviceDates) {
Date date = removeTime(calDate.getAsDate());
if (date.after(today) && date.before(inOneWeek)) {
return true;
}
}
return false;
}
Aggregations