MATSIM
CityCenterEventEnterHandler.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * RunEmissionToolOffline.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2009 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 package tutorial.programming.example21tutorialTUBclass.events;
21 
22 import java.util.ArrayList;
23 import java.util.List;
24 
25 import org.matsim.api.core.v01.Id;
29 import org.matsim.vehicles.Vehicle;
30 
37 
38 
39  List<Id<Vehicle>> agentsInCityCenter = new ArrayList<>();
40  List<Id<Link>> cityCenterLinks = new ArrayList<>();
41 
42  @Override
43  public void reset(int iteration) {
44  this.agentsInCityCenter.clear();
45  }
46 
47  @Override
48  public void handleEvent(LinkEnterEvent event) {
49  if (this.cityCenterLinks.contains(event.getLinkId()))
50  {
51  this.agentsInCityCenter.add(event.getVehicleId());
52  }
53  }
54  public void addLinkId(Id<Link> linkId){
55  this.cityCenterLinks.add(linkId);
56  }
57 
58  public List<Id<Vehicle>> getVehiclesInCityCenter() {
59  return agentsInCityCenter;
60  }
61 
62 
63 }