Search in sources :

Example 66 with BlockStopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockStopTimeIndicesFactory method getStopTimesAsFrequencyStopTimes.

private List<FrequencyBlockStopTimeEntry> getStopTimesAsFrequencyStopTimes(List<BlockStopTimeEntry> stopTimes) {
    List<FrequencyBlockStopTimeEntry> frequencyStopTimes = new ArrayList<FrequencyBlockStopTimeEntry>();
    for (BlockStopTimeEntry blockStopTime : stopTimes) {
        BlockTripEntry trip = blockStopTime.getTrip();
        BlockConfigurationEntry blockConfig = trip.getBlockConfiguration();
        for (FrequencyEntry frequency : blockConfig.getFrequencies()) {
            FrequencyBlockStopTimeEntry frequencyStopTime = new FrequencyBlockStopTimeEntryImpl(blockStopTime, frequency);
            frequencyStopTimes.add(frequencyStopTime);
        }
    }
    return frequencyStopTimes;
}
Also used : BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) ArrayList(java.util.ArrayList) FrequencyEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyEntry) BlockConfigurationEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry) FrequencyBlockStopTimeEntryImpl(org.onebusaway.transit_data_federation.impl.transit_graph.FrequencyBlockStopTimeEntryImpl) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry)

Example 67 with BlockStopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockStopTimeIndicesFactory method createIndicesFromGroups.

/**
 **
 *
 ***
 */
private List<BlockStopTimeIndex> createIndicesFromGroups(Map<BlockStopTimeKey, List<BlockStopTimeEntry>> stopTimesByKey) {
    List<BlockStopTimeIndex> allIndices = new ArrayList<BlockStopTimeIndex>();
    int logInterval = LoggingIntervalUtil.getAppropriateLoggingInterval(allIndices.size()) * 10;
    int count = 0;
    for (List<BlockStopTimeEntry> stopTimes : stopTimesByKey.values()) {
        if (_verbose && count % logInterval == 0)
            _log.info("groups processed: " + count + "/" + stopTimesByKey.size());
        count++;
        List<List<BlockStopTimeEntry>> groupedStopTimes = BlockLibrary.createStrictlyOrderedGroups(stopTimes, _blockStopTimeLooseComparator, _blockStopTimeStrictComparator);
        for (List<BlockStopTimeEntry> group : groupedStopTimes) {
            BlockStopTimeIndex index = createBlockStopTimeIndexForGroup(group);
            allIndices.add(index);
        }
    }
    return allIndices;
}
Also used : FrequencyBlockStopTimeIndex(org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockStopTimeIndex) BlockStopTimeIndex(org.onebusaway.transit_data_federation.services.blocks.BlockStopTimeIndex) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry)

Example 68 with BlockStopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockStopTimeIndicesFactory method getBlockStopTimeAsKey.

private BlockStopTimeKey getBlockStopTimeAsKey(BlockStopTimeEntry blockStopTime) {
    BlockTripEntry blockTrip = blockStopTime.getTrip();
    BlockConfigurationEntry blockConfig = blockTrip.getBlockConfiguration();
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    StopEntry stop = stopTime.getStop();
    return new BlockStopTimeKey(blockConfig.getServiceIds(), stop.getId());
}
Also used : BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry) StopEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopEntry) BlockConfigurationEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)

Example 69 with BlockStopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockStopTimeIndicesFactory method createFrequencyIndicesFromGroups.

/**
 **
 *
 ***
 */
private List<FrequencyBlockStopTimeIndex> createFrequencyIndicesFromGroups(Map<BlockStopTimeKey, List<BlockStopTimeEntry>> stopTimesByKey) {
    List<FrequencyBlockStopTimeIndex> allIndices = new ArrayList<FrequencyBlockStopTimeIndex>();
    int count = 0;
    for (List<BlockStopTimeEntry> stopTimes : stopTimesByKey.values()) {
        if (_verbose && count % 100 == 0)
            _log.info("groups processed: " + count + "/" + stopTimesByKey.size());
        count++;
        List<FrequencyBlockStopTimeEntry> frequencyStopTimes = getStopTimesAsFrequencyStopTimes(stopTimes);
        List<List<FrequencyBlockStopTimeEntry>> groupedStopTimes = BlockLibrary.createStrictlyOrderedGroups(frequencyStopTimes, _frequencyBlockStopTimeLooseComparator, _frequencyBlockStopTimeStrictComparator);
        for (List<FrequencyBlockStopTimeEntry> group : groupedStopTimes) {
            FrequencyBlockStopTimeIndex index = createFrequencyBlockStopTimeIndexForGroup(group);
            allIndices.add(index);
        }
    }
    return allIndices;
}
Also used : FrequencyBlockStopTimeIndex(org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockStopTimeIndex) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry) FrequencyBlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry)

Example 70 with BlockStopTimeEntry

use of org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry in project onebusaway-application-modules by camsys.

the class BlockStopTimeStrictComparator method compare.

@Override
public int compare(BlockStopTimeEntry o1, BlockStopTimeEntry o2) {
    StopTimeEntry stA = o1.getStopTime();
    StopTimeEntry stB = o2.getStopTime();
    if (stA.getArrivalTime() == stB.getArrivalTime() && stA.getDepartureTime() == stB.getDepartureTime()) {
        return 0;
    } else if (stA.getArrivalTime() <= stB.getArrivalTime() && stA.getDepartureTime() <= stB.getDepartureTime()) {
        return -1;
    }
    return 1;
}
Also used : StopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry) BlockStopTimeEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)

Aggregations

BlockStopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)71 StopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopTimeEntry)32 BlockTripEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry)29 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)23 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)20 StopTimeInstance (org.onebusaway.transit_data_federation.model.StopTimeInstance)16 TripEntry (org.onebusaway.transit_data_federation.services.transit_graph.TripEntry)15 ArrayList (java.util.ArrayList)14 FrequencyBlockStopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.FrequencyBlockStopTimeEntry)14 CoordinatePoint (org.onebusaway.geospatial.model.CoordinatePoint)11 StopEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopEntry)11 BlockInstance (org.onebusaway.transit_data_federation.services.blocks.BlockInstance)10 ScheduledBlockLocation (org.onebusaway.transit_data_federation.services.blocks.ScheduledBlockLocation)9 ArrivalAndDepartureInstance (org.onebusaway.transit_data_federation.services.realtime.ArrivalAndDepartureInstance)9 Date (java.util.Date)8 BlockEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl)8 InstanceState (org.onebusaway.transit_data_federation.services.blocks.InstanceState)8 BlockLocation (org.onebusaway.transit_data_federation.services.realtime.BlockLocation)8 BlockStopTimeIndex (org.onebusaway.transit_data_federation.services.blocks.BlockStopTimeIndex)7 FrequencyBlockStopTimeIndex (org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockStopTimeIndex)7