Search in sources :

Example 6 with BlockSequenceIndex

use of org.onebusaway.transit_data_federation.services.blocks.BlockSequenceIndex in project onebusaway-application-modules by camsys.

the class BlockIndexFactoryServiceImpl method createSequenceIndexForGroupOfBlockSequences.

public BlockSequenceIndex createSequenceIndexForGroupOfBlockSequences(List<BlockSequence> sequences) {
    ServiceIntervalBlock serviceIntervalBlock = getBlockStopTimesAsBlockInterval(sequences);
    String agencyId = sequences.get(0).getBlockConfig().getBlock().getId().getAgencyId();
    boolean privateService = _privateAgencyIds.contains(agencyId);
    return new BlockSequenceIndex(sequences, serviceIntervalBlock, privateService);
}
Also used : ServiceIntervalBlock(org.onebusaway.transit_data_federation.services.blocks.ServiceIntervalBlock) FrequencyServiceIntervalBlock(org.onebusaway.transit_data_federation.services.blocks.FrequencyServiceIntervalBlock) BlockSequenceIndex(org.onebusaway.transit_data_federation.services.blocks.BlockSequenceIndex)

Example 7 with BlockSequenceIndex

use of org.onebusaway.transit_data_federation.services.blocks.BlockSequenceIndex 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++;
        }
    }
}
Also used : BlockStopSequenceIndex(org.onebusaway.transit_data_federation.services.blocks.BlockStopSequenceIndex) FrequencyBlockTripIndex(org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockTripIndex) FrequencyStopTripIndex(org.onebusaway.transit_data_federation.services.blocks.FrequencyStopTripIndex) StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) BlockSequenceIndex(org.onebusaway.transit_data_federation.services.blocks.BlockSequenceIndex) StopEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) StopEntryImpl(org.onebusaway.transit_data_federation.impl.transit_graph.StopEntryImpl)

Aggregations

BlockSequenceIndex (org.onebusaway.transit_data_federation.services.blocks.BlockSequenceIndex)7 ArrayList (java.util.ArrayList)3 List (java.util.List)3 HashSet (java.util.HashSet)2 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)2 Record (org.onebusaway.transit_data.model.realtime.CurrentVehicleEstimateQueryBean.Record)2 BlockStopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)2 BlockTripEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry)2 DoubleArrayList (cern.colt.list.DoubleArrayList)1 Envelope (com.vividsolutions.jts.geom.Envelope)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 FactoryMap (org.onebusaway.collections.FactoryMap)1 CoordinateBounds (org.onebusaway.geospatial.model.CoordinateBounds)1 ListBean (org.onebusaway.transit_data.model.ListBean)1 CurrentVehicleEstimateBean (org.onebusaway.transit_data.model.realtime.CurrentVehicleEstimateBean)1 StopEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.StopEntryImpl)1 BlockInstance (org.onebusaway.transit_data_federation.services.blocks.BlockInstance)1 BlockStopSequenceIndex (org.onebusaway.transit_data_federation.services.blocks.BlockStopSequenceIndex)1