MATSIM
Vehicle2DriverEventHandler.java
Go to the documentation of this file.
1 /*
2  * *********************************************************************** *
3  * * project: org.matsim.*
4  * * DefaultControlerModules.java
5  * * *
6  * * *********************************************************************** *
7  * * *
8  * * copyright : (C) 2014 by the members listed in the COPYING, *
9  * * LICENSE and WARRANTY file. *
10  * * email : info at matsim dot org *
11  * * *
12  * * *********************************************************************** *
13  * * *
14  * * This program is free software; you can redistribute it and/or modify *
15  * * it under the terms of the GNU General Public License as published by *
16  * * the Free Software Foundation; either version 2 of the License, or *
17  * * (at your option) any later version. *
18  * * See also COPYING, LICENSE and WARRANTY file *
19  * * *
20  * * ***********************************************************************
21  */
22 package org.matsim.core.events.algorithms;
23 
24 import org.matsim.api.core.v01.Id;
30 import org.matsim.vehicles.Vehicle;
31 
32 import java.util.Map;
33 import java.util.concurrent.ConcurrentHashMap;
34 
42 
43  private final Map<Id<Vehicle>, Id<Person>> driverAgents = new ConcurrentHashMap<>();
44 
45  @Override
46  public void reset(int iteration) {
47  driverAgents.clear();
48  }
49 
50  @Override
52  driverAgents.put(event.getVehicleId(), event.getPersonId());
53  }
54 
55  @Override
57  driverAgents.remove(event.getVehicleId());
58  }
59 
65  return driverAgents.get(vehicleId);
66  }
67 
68 }