Search in sources :

Example 31 with BlockEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry 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));
}
Also used : AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) BlockLayoverIndex(org.onebusaway.transit_data_federation.services.blocks.BlockLayoverIndex) FrequencyBlockTripIndex(org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockTripIndex) BlockEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry) ArrayList(java.util.ArrayList) List(java.util.List) BlockTripIndex(org.onebusaway.transit_data_federation.services.blocks.BlockTripIndex) FrequencyBlockTripIndex(org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockTripIndex)

Aggregations

BlockEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry)31 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)13 ArrayList (java.util.ArrayList)11 TripEntry (org.onebusaway.transit_data_federation.services.transit_graph.TripEntry)10 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)9 List (java.util.List)8 BlockTripEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry)8 Test (org.junit.Test)7 Date (java.util.Date)6 BlockEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl)6 BlockInstance (org.onebusaway.transit_data_federation.services.blocks.BlockInstance)6 FrequencyBlockTripIndex (org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockTripIndex)6 ServiceIdActivation (org.onebusaway.transit_data_federation.services.transit_graph.ServiceIdActivation)6 FactoryMap (org.onebusaway.collections.FactoryMap)5 StopEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.StopEntryImpl)5 TripEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl)5 Cacheable (org.onebusaway.container.cache.Cacheable)3 ServiceDate (org.onebusaway.gtfs.model.calendar.ServiceDate)3 BlockLayoverIndex (org.onebusaway.transit_data_federation.services.blocks.BlockLayoverIndex)3 BlockTripIndex (org.onebusaway.transit_data_federation.services.blocks.BlockTripIndex)3