use of org.onebusaway.transit_data_federation.services.blocks.FrequencyStopTripIndex in project onebusaway-application-modules by camsys.
the class StopTimeServiceImpl method getStopTimeInstancesInTimeRange.
@Override
public List<StopTimeInstance> getStopTimeInstancesInTimeRange(StopEntry stopEntry, Date from, Date to, EFrequencyStopTimeBehavior frequencyBehavior) {
List<StopTimeInstance> stopTimeInstances = new ArrayList<StopTimeInstance>();
for (BlockStopTimeIndex index : _blockIndexService.getStopTimeIndicesForStop(stopEntry)) {
Collection<Date> serviceDates = _calendarService.getServiceDatesWithinRange(index.getServiceIds(), index.getServiceInterval(), from, to);
for (Date serviceDate : serviceDates) {
getStopTimesForStopAndServiceDateAndTimeRange(index, serviceDate, from, to, stopTimeInstances);
}
}
List<FrequencyStopTripIndex> frequencyStopTripIndices = _blockIndexService.getFrequencyStopTripIndicesForStop(stopEntry);
for (FrequencyStopTripIndex index : frequencyStopTripIndices) {
Collection<Date> serviceDates = _calendarService.getServiceDatesWithinRange(index.getServiceIds(), index.getServiceInterval(), from, to);
for (Date serviceDate : serviceDates) {
getFrequenciesForStopAndServiceIdsAndTimeRange(index, serviceDate, from, to, stopTimeInstances, frequencyBehavior);
}
}
return stopTimeInstances;
}
use of org.onebusaway.transit_data_federation.services.blocks.FrequencyStopTripIndex in project onebusaway-application-modules by camsys.
the class BlockIndexServiceImpl method loadStopTripIndices.
private void loadStopTripIndices() {
// Clear any existing indices
for (StopEntry stop : _graphDao.getAllStops()) {
StopEntryImpl stopImpl = (StopEntryImpl) stop;
stopImpl.getStopTripIndices().clear();
stopImpl.getFrequencyStopTripIndices().clear();
}
for (BlockSequenceIndex index : _blockSequenceIndices) {
BlockSequence sequence = index.getSequences().get(0);
int offset = 0;
for (BlockStopTimeEntry bst : sequence.getStopTimes()) {
StopTimeEntry stopTime = bst.getStopTime();
StopEntryImpl stop = (StopEntryImpl) stopTime.getStop();
BlockStopSequenceIndex blockStopTripIndex = new BlockStopSequenceIndex(index, offset);
stop.addBlockStopTripIndex(blockStopTripIndex);
offset++;
}
}
for (FrequencyBlockTripIndex index : _frequencyBlockTripIndices) {
BlockTripEntry trip = index.getTrips().get(0);
int offset = 0;
for (BlockStopTimeEntry bst : trip.getStopTimes()) {
StopTimeEntry stopTime = bst.getStopTime();
StopEntryImpl stop = (StopEntryImpl) stopTime.getStop();
FrequencyStopTripIndex stopTripIndex = new FrequencyStopTripIndex(index, offset);
stop.addFrequencyStopTripIndex(stopTripIndex);
offset++;
}
}
}
Aggregations