MATSIM
VehicleLeavesTrafficEvent.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * AgentWait2LinkEvent.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2007, 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;
28 import org.matsim.vehicles.Vehicle;
29 
31 
32  public static final String EVENT_TYPE = "vehicle leaves traffic";
33  public static final String ATTRIBUTE_VEHICLE = "vehicle";
34 
35  public static final String ATTRIBUTE_LINK = "link";
36  public static final String ATTRIBUTE_NETWORKMODE = "networkMode";
37  public static final String ATTRIBUTE_DRIVER = "person";
38  public static final String ATTRIBUTE_POSITION = "relativePosition";
39 
40  private final Id<Person> driverId;
41  private final Id<Link> linkId;
42  private final Id<Vehicle> vehicleId;
43  private final String networkMode;
44  private final double relativePositionOnLink;
45 
46 
47  public VehicleLeavesTrafficEvent(final double time, final Id<Person> driverId, final Id<Link> linkId, Id<Vehicle> vehicleId, String networkMode, double relativePositionOnLink) {
48  super(time);
49  this.driverId = driverId;
50  this.linkId = linkId;
51  this.vehicleId = vehicleId;
52  this.networkMode = networkMode;
53  this.relativePositionOnLink = relativePositionOnLink;
54 
55  }
56 
57  @Override
59  return this.driverId;
60  }
61 
62  @Override
63  public Id<Link> getLinkId() {
64  return this.linkId;
65  }
66 
68  return vehicleId;
69  }
70 
71  @Override
72  public String getEventType() {
73  return EVENT_TYPE;
74  }
75 
76  public String getNetworkMode() {
77  return networkMode;
78  }
79 
80  public double getRelativePositionOnLink() {
82  }
83 
84  @Override
85  public Map<String, String> getAttributes() {
86  Map<String, String> attr = super.getAttributes();
87  // personId, linkId, vehicleId handled by superclass
88  if (this.networkMode != null) {
89  attr.put(ATTRIBUTE_NETWORKMODE, networkMode);
90  }
91  attr.put(ATTRIBUTE_POSITION, Double.toString(this.relativePositionOnLink));
92  return attr;
93  }
94 }
VehicleLeavesTrafficEvent(final double time, final Id< Person > driverId, final Id< Link > linkId, Id< Vehicle > vehicleId, String networkMode, double relativePositionOnLink)