use of org.onebusaway.transit_data_federation.impl.transit_graph.FrequencyEntryImpl in project onebusaway-application-modules by camsys.
the class FrequencyEntriesFactory method processRawFrequency.
private void processRawFrequency(TransitGraphImpl graph, Frequency frequency, Map<AgencyAndId, List<FrequencyEntry>> frequenciesByTripId, Map<AgencyAndId, Integer> exactTimesValueByTrip) {
AgencyAndId tripId = frequency.getTrip().getId();
/**
* The value of frequencies.txt exact_times is expected to be the same
* across all entries for the same trip id.
*/
Integer exactTimesValue = exactTimesValueByTrip.get(tripId);
if (exactTimesValue == null) {
exactTimesValue = frequency.getExactTimes();
exactTimesValueByTrip.put(tripId, exactTimesValue);
} else if (exactTimesValue != frequency.getExactTimes()) {
throw new IllegalStateException("The value of frequencies.txt exact_times differed for frequency entries with tripId=" + tripId);
}
FrequencyEntryImpl entry = new FrequencyEntryImpl(frequency.getStartTime(), frequency.getEndTime(), frequency.getHeadwaySecs(), frequency.getExactTimes());
List<FrequencyEntry> frequencies = frequenciesByTripId.get(tripId);
if (frequencies == null) {
frequencies = new ArrayList<FrequencyEntry>();
frequenciesByTripId.put(tripId, frequencies);
}
frequencies.add(entry);
}
Aggregations