private void parsePredictions(Hashtable<?, ?> ht) {
Map<AgencyAndId, List<TimepointPrediction>> predictionsByBlockId = new HashMap<AgencyAndId, List<TimepointPrediction>>();
if (ht.containsKey("PREDICTIONS")) {
ContentsData data = (ContentsData) ht.get("PREDICTIONS");
data.resetRowIndex();
while (data.next()) {
_predictionCount++;
String agencyId = data.getString(0);
// We override the agency id in the stream, since it's usually 0
if (!_agencyIds.isEmpty())
agencyId = _agencyIds.get(0);
String tripId = data.getString(2);
TripEntry tripEntry = getTripEntryForId(agencyId, tripId);
if (tripEntry == null) {
_unmappedTripIdCount++;
continue;
}
BlockEntry block = tripEntry.getBlock();
TimepointPrediction record = new TimepointPrediction();
record.setBlockId(block.getId());
record.setTripId(tripEntry.getId());
String tripAgencyId = tripEntry.getId().getAgencyId();
record.setVehicleId(new AgencyAndId(tripAgencyId, data.getString(6)));
record.setScheduleDeviation(data.getInt(14));
record.setTimepointId(new AgencyAndId(agencyId, data.getString(3)));
record.setTimepointScheduledTime(data.getInt(4));
record.setTimepointPredictedTime(data.getInt(13));
record.setTimeOfPrediction(data.getInt(9));
record.setPredictorType(data.getString(12));
// Indicates that we don't have any real-time predictions for this
// record
if (record.getTimepointPredictedTime() == -1 || ! "p".equals(record.getPredictorType())) {
_noPredictionCount++;