MATSIM
TeleportationArrivalEvent.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * *
4  * *********************************************************************** *
5  * *
6  * copyright : (C) 2011 by the members listed in the COPYING, *
7  * LICENSE and WARRANTY file. *
8  * email : info at matsim dot org *
9  * *
10  * *********************************************************************** *
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * See also COPYING, LICENSE and WARRANTY file *
17  * *
18  * *********************************************************************** */
19 
20 package org.matsim.core.api.experimental.events;
21 
22 import java.util.Map;
23 
24 import org.matsim.api.core.v01.Id;
28 
33 public final class TeleportationArrivalEvent extends Event implements HasPersonId {
34 
35  public static final String ATTRIBUTE_PERSON = "person";
36  public static final String ATTRIBUTE_DISTANCE = "distance";
37  public static final String ATTRIBUTE_MODE = "mode";
38 
39  public static final String EVENT_TYPE = "travelled";
40  private final String mode;
41 
42  private final Id<Person> agentId;
43  private final double distance;
44 
45  public TeleportationArrivalEvent(double time, Id<Person> agentId, double distance, String mode) {
46  super(time);
47  this.agentId = agentId;
48  this.distance = distance;
49  this.mode = mode;
50  }
51 
53  return agentId;
54  }
55 
56  public double getDistance() {
57  return distance;
58  }
59 
60  public String getMode() {
61  return mode;
62  }
63 
64  @Override
65  public String getEventType() {
66  return EVENT_TYPE;
67  }
68 
69  @Override
70  public Map<String, String> getAttributes() {
71  Map<String, String> attributes = super.getAttributes();
72  // attributes.put(ATTRIBUTE_PERSON, agentId.toString()); // done in super-class
73  attributes.put(ATTRIBUTE_DISTANCE, Double.toString(distance));
74  attributes.put(ATTRIBUTE_MODE, mode);
75  return attributes;
76  }
77 }
TeleportationArrivalEvent(double time, Id< Person > agentId, double distance, String mode)