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;
}
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;
}
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());
}
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;
}
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;
}
Aggregations