MATSIM
Public Member Functions | Private Attributes | List of all members
org.matsim.pt.analysis.VehicleTracker Class Reference
Inheritance diagram for org.matsim.pt.analysis.VehicleTracker:
Inheritance graph
[legend]

Public Member Functions

void handleEvent (VehicleArrivesAtFacilityEvent event)
 
void handleEvent (VehicleDepartsAtFacilityEvent event)
 
void reset (int iteration)
 
Id getFacilityIdForVehicle (final Id vehicleId)
 

Private Attributes

final Map< Id, IdvehicleFacilityMap = new HashMap<Id, Id>()
 

Detailed Description

Tracks at which facility a vehicle is currently located. If a vehicle departs at a facility, no information about its location can be returned until the vehicle arrives at some other facility.

Author
mrieser

Definition at line 39 of file VehicleTracker.java.

Member Function Documentation

◆ handleEvent() [1/2]

void org.matsim.pt.analysis.VehicleTracker.handleEvent ( VehicleArrivesAtFacilityEvent  event)

Implements org.matsim.core.api.experimental.events.handler.VehicleArrivesAtFacilityEventHandler.

Definition at line 43 of file VehicleTracker.java.

References org.matsim.core.api.experimental.events.VehicleArrivesAtFacilityEvent.getVehicleId().

43  {
44  this.vehicleFacilityMap.put(event.getVehicleId(), event.getFacilityId());
45  }
Here is the call graph for this function:

◆ handleEvent() [2/2]

void org.matsim.pt.analysis.VehicleTracker.handleEvent ( VehicleDepartsAtFacilityEvent  event)

Implements org.matsim.core.api.experimental.events.handler.VehicleDepartsAtFacilityEventHandler.

Definition at line 47 of file VehicleTracker.java.

References org.matsim.core.api.experimental.events.VehicleDepartsAtFacilityEvent.getVehicleId().

47  {
48  this.vehicleFacilityMap.remove(event.getVehicleId());
49 
50  }
Here is the call graph for this function:

◆ reset()

void org.matsim.pt.analysis.VehicleTracker.reset ( int  iteration)

Gives the event handler the possibility to clean up its internal state. Within a Controler-Simulation, this is called before the mobsim starts.

Parameters
iterationthe up-coming iteration from which up-coming events will be from.

Implements org.matsim.core.events.handler.EventHandler.

Definition at line 52 of file VehicleTracker.java.

52  {
53  this.vehicleFacilityMap.clear();
54  }

◆ getFacilityIdForVehicle()

Id org.matsim.pt.analysis.VehicleTracker.getFacilityIdForVehicle ( final Id  vehicleId)
Parameters
vehicleId
Returns
the id of the facility where the specified vehicle is currently located, null if the vehicle is currently at no known location.

Definition at line 61 of file VehicleTracker.java.

References org.matsim.api.core.v01.Id< T >.get().

Referenced by org.matsim.pt.analysis.RouteOccupancy.handleEvent(), and org.matsim.pt.analysis.TransitRouteAccessEgressAnalysis.handleEvent().

61  {
62  return this.vehicleFacilityMap.get(vehicleId);
63  }
Here is the call graph for this function:

Member Data Documentation

◆ vehicleFacilityMap

final Map<Id, Id> org.matsim.pt.analysis.VehicleTracker.vehicleFacilityMap = new HashMap<Id, Id>()
private

Definition at line 41 of file VehicleTracker.java.


The documentation for this class was generated from the following file: