MATSIM
PersonLeavesVehicleEvent.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 
33 public class PersonLeavesVehicleEvent extends Event implements HasPersonId, HasVehicleId {
34 
35  public static final String EVENT_TYPE = "PersonLeavesVehicle";
36  public static final String ATTRIBUTE_PERSON = "person";
37  public static final String ATTRIBUTE_VEHICLE = "vehicle";
38 
39  private final Id<Person> personId;
41 
42  /*package*/ public PersonLeavesVehicleEvent(final double time, final Id<Person> personId, final Id<Vehicle> vehicleId) {
43  super(time);
44  this.personId = personId;
45  this.vehicleId = vehicleId;
46  }
47 
48  @Override
50  return this.personId;
51  }
52 
54  return this.vehicleId;
55  }
56 
57  public void setVehicleId(Id<Vehicle> vehicleId) {
58  this.vehicleId = vehicleId;
59  }
60 
61  @Override
62  public String getEventType() {
63  return EVENT_TYPE;
64  }
65 
66  @Override
67  public Map<String, String> getAttributes() {
68  Map<String, String> attrs = super.getAttributes();
69  // personId, vehicleId handled by superclass
70  return attrs;
71  }
72 
73  @Override
74  public void writeAsXML(StringBuilder out) {
75  // Writes all common attributes
76  writeXMLStart(out);
77  writeXMLEnd(out);
78  }
79 }
final void writeXMLEnd(StringBuilder out)
Definition: Event.java:151
PersonLeavesVehicleEvent(final double time, final Id< Person > personId, final Id< Vehicle > vehicleId)
final void writeXMLStart(StringBuilder out)
Definition: Event.java:116