use of org.onebusaway.transit_data_federation.services.blocks.BlockLayoverIndex in project onebusaway-application-modules by camsys.
the class BlockIndexServiceImpl method loadBlockLayoverIndices.
private void loadBlockLayoverIndices() throws IOException, ClassNotFoundException {
File path = _bundle.getBlockLayoverIndicesPath();
if (path.exists()) {
_log.info("loading block layover indices data");
List<BlockLayoverIndexData> datas = ObjectSerializationLibrary.readObject(path);
_blockLayoverIndices = new ArrayList<BlockLayoverIndex>(datas.size());
for (BlockLayoverIndexData data : datas) _blockLayoverIndices.add(data.createIndex(_graphDao));
_blockLayoverIndicesByAgencyId = getBlockTripIndicesByAgencyId(_blockLayoverIndices);
_blockLayoverIndicesByRouteId = getBlockTripsByRouteId(_blockLayoverIndices);
_log.info("block layover indices data loaded");
} else {
_blockLayoverIndices = Collections.emptyList();
_blockLayoverIndicesByAgencyId = Collections.emptyMap();
_blockLayoverIndicesByRouteId = Collections.emptyMap();
}
}
use of org.onebusaway.transit_data_federation.services.blocks.BlockLayoverIndex in project onebusaway-application-modules by camsys.
the class BlockIndexServiceImpl method loadBlockTripIndicesByBlockId.
/**
**
*
***
*/
private void loadBlockTripIndicesByBlockId() {
_log.info("calculating block trip indices by blockId...");
long t1 = SystemTime.currentTimeMillis();
_blockTripIndicesByBlockId = new HashMap<AgencyAndId, List<BlockTripIndex>>();
_blockLayoverIndicesByBlockId = new HashMap<AgencyAndId, List<BlockLayoverIndex>>();
_frequencyBlockTripIndicesByBlockId = new HashMap<AgencyAndId, List<FrequencyBlockTripIndex>>();
for (BlockEntry block : _graphDao.getAllBlocks()) {
List<BlockEntry> list = Arrays.asList(block);
List<BlockTripIndex> indices = _factory.createTripIndices(list);
List<BlockLayoverIndex> layoverIndices = _factory.createLayoverIndices(list);
List<FrequencyBlockTripIndex> frequencyIndices = _factory.createFrequencyTripIndices(list);
if (!indices.isEmpty())
_blockTripIndicesByBlockId.put(block.getId(), indices);
if (!layoverIndices.isEmpty())
_blockLayoverIndicesByBlockId.put(block.getId(), layoverIndices);
if (!frequencyIndices.isEmpty())
_frequencyBlockTripIndicesByBlockId.put(block.getId(), frequencyIndices);
}
long t2 = SystemTime.currentTimeMillis();
_log.info("completed calculating block trip indices by blockId: t=" + (t2 - t1));
}
Aggregations