MATSIM
PersonEntersVehicleEvent.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * PersonEntersVehicleEvent.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2008 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 
21 package org.matsim.api.core.v01.events;
22 
23 import java.util.Map;
24 
25 import org.matsim.api.core.v01.Id;
27 import org.matsim.vehicles.Vehicle;
28 
32 public class PersonEntersVehicleEvent extends Event implements HasPersonId, HasVehicleId {
33 
34  public static final String EVENT_TYPE = "PersonEntersVehicle";
35  public static final String ATTRIBUTE_PERSON = "person";
36  public static final String ATTRIBUTE_VEHICLE = "vehicle";
37 
38  private final Id<Person> personId;
40 
41  public PersonEntersVehicleEvent(final double time, final Id<Person> personId, final Id<Vehicle> vehicleId) {
42  super(time);
43  this.personId = personId;
44  this.vehicleId = vehicleId;
45  }
46 
48  return this.vehicleId;
49  }
50 
51  public void setVehicleId(Id<Vehicle> vehicleId) {
52  this.vehicleId = vehicleId;
53  }
54 
55  @Override
57  return this.personId;
58  }
59 
60  @Override
61  public String getEventType() {
62  return EVENT_TYPE;
63  }
64 
65  @Override
66  public Map<String, String> getAttributes() {
67  Map<String, String> atts = super.getAttributes();
68  // personId, vehicleId handled by superclass
69  return atts;
70  }
71 
72  @Override
73  public void writeAsXML(StringBuilder out) {
74  // Writes all common attributes
75  writeXMLStart(out);
76  writeXMLEnd(out);
77  }
78 }
final void writeXMLEnd(StringBuilder out)
Definition: Event.java:151
PersonEntersVehicleEvent(final double time, final Id< Person > personId, final Id< Vehicle > vehicleId)
final void writeXMLStart(StringBuilder out)
Definition: Event.java:116