use of org.onebusaway.transit_data_federation.services.transit_graph.FrequencyEntry in project onebusaway-application-modules by camsys.
the class BlockIndexFactoryServiceImpl method getBestFrequencyTripGroup.
private FrequencyTripGroup getBestFrequencyTripGroup(List<FrequencyTripGroup> groups, BlockTripWithFrequency bcwf) {
for (FrequencyTripGroup group : groups) {
if (group.isEmpty())
return group;
List<FrequencyEntry> frequencies = group.getFrequencies();
FrequencyEntry prev = frequencies.get(frequencies.size() - 1);
FrequencyEntry next = bcwf.getFrequency();
if (prev.getEndTime() <= next.getStartTime())
return group;
}
return null;
}
use of org.onebusaway.transit_data_federation.services.transit_graph.FrequencyEntry 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.FrequencyEntry in project onebusaway-application-modules by camsys.
the class FrequencyBlockStopTimeStrictComparator method compare.
@Override
public int compare(FrequencyBlockStopTimeEntry o1, FrequencyBlockStopTimeEntry o2) {
FrequencyEntry f1 = o1.getFrequency();
FrequencyEntry f2 = o2.getFrequency();
if (f1.getStartTime() == f2.getStartTime() && f1.getEndTime() == f2.getEndTime()) {
return 0;
} else if (f1.getStartTime() < f2.getStartTime() && f1.getEndTime() < f2.getEndTime()) {
return -1;
} else {
return 1;
}
}
Aggregations