MATSIM
Public Member Functions | Private Member Functions | Private Attributes | List of all members
tutorial.programming.example06EventsHandling.MyEventHandler3 Class Reference
Inheritance diagram for tutorial.programming.example06EventsHandling.MyEventHandler3:
Inheritance graph
[legend]

Public Member Functions

 MyEventHandler3 ()
 
double getTravelTime (int slot)
 
void reset (int iteration)
 
void handleEvent (LinkEnterEvent event)
 
void writeChart (String filename)
 

Private Member Functions

int getSlot (double time)
 

Private Attributes

double[] volumeLink6
 

Detailed Description

This EventHandler implementation counts the traffic volume on the link with id number 6 and provides a method to write the hourly volumes to a chart png.

Author
dgrether

Definition at line 16 of file MyEventHandler3.java.

Constructor & Destructor Documentation

tutorial.programming.example06EventsHandling.MyEventHandler3.MyEventHandler3 ( )

Definition at line 21 of file MyEventHandler3.java.

References tutorial.programming.example06EventsHandling.MyEventHandler3.reset().

21  {
22  reset(0);
23  }

Here is the call graph for this function:

Member Function Documentation

double tutorial.programming.example06EventsHandling.MyEventHandler3.getTravelTime ( int  slot)

Definition at line 25 of file MyEventHandler3.java.

25  {
26  return this.volumeLink6[slot];
27  }
int tutorial.programming.example06EventsHandling.MyEventHandler3.getSlot ( double  time)
private

Definition at line 29 of file MyEventHandler3.java.

Referenced by tutorial.programming.example06EventsHandling.MyEventHandler3.handleEvent().

29  {
30  return (int)time/3600;
31  }
void tutorial.programming.example06EventsHandling.MyEventHandler3.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 34 of file MyEventHandler3.java.

Referenced by tutorial.programming.example06EventsHandling.MyEventHandler3.MyEventHandler3().

34  {
35  this.volumeLink6 = new double[24];
36  }
void tutorial.programming.example06EventsHandling.MyEventHandler3.handleEvent ( LinkEnterEvent  event)
void tutorial.programming.example06EventsHandling.MyEventHandler3.writeChart ( String  filename)

Definition at line 46 of file MyEventHandler3.java.

References org.matsim.core.utils.charts.XYLineChart.addSeries(), and org.matsim.core.utils.charts.ChartUtil.saveAsPng().

Referenced by tutorial.programming.example06EventsHandling.RunEventsHandlingExample.main().

46  {
47  double[] hours = new double[24];
48  for (double i = 0.0; i < 24.0; i++){
49  hours[(int)i] = i;
50  }
51  XYLineChart chart = new XYLineChart("Traffic link 6", "hour", "departures");
52  chart.addSeries("times", hours, this.volumeLink6);
53  chart.saveAsPng(filename, 800, 600);
54  }

Here is the call graph for this function:

Member Data Documentation

double [] tutorial.programming.example06EventsHandling.MyEventHandler3.volumeLink6
private

Definition at line 18 of file MyEventHandler3.java.


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