MATSIM
RunEventsHandlingExample.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * EventsReader
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 org.matsim.api.core.v01.Id;
26 
27 
28 
29 
37 
38 
39 
40  public static void main(String[] args) {
41 
42  //path to events file
43  String inputFile = "output/nullfall/ITERS/it.50/50.events.xml.gz";
44 
45  //create an event object
47 
48  //create the handler and add it
49  CityCenterEventEnterHandler cityCenterEventEnterHandler = new CityCenterEventEnterHandler();
50 
51  //add the links here that you want to monitor
52  cityCenterEventEnterHandler.addLinkId(Id.createLinkId(28112));
53 
54 
55  events.addHandler(cityCenterEventEnterHandler);
56 
57 
58  //create the reader and read the file
59  MatsimEventsReader reader = new MatsimEventsReader(events);
60  reader.readFile(inputFile);
61 
62  System.out.println(cityCenterEventEnterHandler.getVehiclesInCityCenter());
63 
64  System.out.println("Events file read!");
65  }
66 
67 }
void addHandler(final EventHandler handler)
static EventsManager createEventsManager()