Search in sources :

Example 11 with VehicleLocationCacheElements

use of org.onebusaway.transit_data_federation.services.realtime.VehicleLocationCacheElements in project onebusaway-application-modules by camsys.

the class VehicleStatusServiceImpl method getVehicleStatusForId.

/**
 **
 * {@link VehicleStatusService} Interface
 ***
 */
@Override
public VehicleStatus getVehicleStatusForId(AgencyAndId vehicleId) {
    VehicleLocationRecord record = _vehicleRecordsById.get(vehicleId);
    if (record == null)
        return null;
    List<VehicleLocationRecord> records = new ArrayList<VehicleLocationRecord>();
    VehicleLocationCacheElements elements = _vehicleLocationRecordCache.getRecordForVehicleId(vehicleId);
    if (elements != null) {
        for (VehicleLocationCacheElement element : elements.getElements()) records.add(element.getRecord());
    }
    VehicleStatus status = new VehicleStatus();
    status.setRecord(record);
    status.setAllRecords(records);
    return status;
}
Also used : VehicleLocationCacheElements(org.onebusaway.transit_data_federation.services.realtime.VehicleLocationCacheElements) VehicleLocationCacheElement(org.onebusaway.transit_data_federation.services.realtime.VehicleLocationCacheElement) ArrayList(java.util.ArrayList) VehicleLocationRecord(org.onebusaway.realtime.api.VehicleLocationRecord) VehicleStatus(org.onebusaway.transit_data_federation.services.realtime.VehicleStatus)

Aggregations

VehicleLocationCacheElements (org.onebusaway.transit_data_federation.services.realtime.VehicleLocationCacheElements)11 ArrayList (java.util.ArrayList)6 ScheduledBlockLocation (org.onebusaway.transit_data_federation.services.blocks.ScheduledBlockLocation)4 BlockLocation (org.onebusaway.transit_data_federation.services.realtime.BlockLocation)4 VehicleLocationRecord (org.onebusaway.realtime.api.VehicleLocationRecord)3 BlockInstance (org.onebusaway.transit_data_federation.services.blocks.BlockInstance)3 List (java.util.List)2 Test (org.junit.Test)2 FactoryMap (org.onebusaway.collections.FactoryMap)2 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)2 BlockEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl)2 TripEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl)2 VehicleLocationCacheElement (org.onebusaway.transit_data_federation.services.realtime.VehicleLocationCacheElement)2 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)2 Date (java.util.Date)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 Range (org.onebusaway.collections.Range)1 TargetTime (org.onebusaway.transit_data_federation.model.TargetTime)1