MATSIM
VehicleEntersTrafficEvent.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 enters traffic";
33  public static final String ATTRIBUTE_NETWORKMODE = "networkMode";
34  public static final String ATTRIBUTE_POSITION = "relativePosition";
35 
36  private final Id<Person> driverId;
37  private final Id<Link> linkId;
38  private final Id<Vehicle> vehicleId;
39  private final String networkMode;
40  private final double relativePositionOnLink;
41 
42 
43  public VehicleEntersTrafficEvent(final double time, final Id<Person> driverId, final Id<Link> linkId, Id<Vehicle> vehicleId, String networkMode, double relativePositionOnLink) {
44  super(time);
45  this.driverId = driverId;
46  this.linkId = linkId;
47  this.vehicleId = vehicleId;
48  this.networkMode = networkMode;
49  this.relativePositionOnLink = relativePositionOnLink;
50  }
51 
52  @Override
54  return this.driverId;
55  }
56 
57  @Override
58  public Id<Link> getLinkId() {
59  return this.linkId;
60  }
61 
63  return vehicleId;
64  }
65 
66  @Override
67  public String getEventType() {
68  return EVENT_TYPE;
69  }
70 
71  public String getNetworkMode() {
72  return networkMode;
73  }
74 
75  public double getRelativePositionOnLink() {
77  }
78 
79  @Override
80  public Map<String, String> getAttributes() {
81  Map<String, String> attr = super.getAttributes();
82  // personId, linkId, vehicleId handled by superclass
83  if (this.networkMode != null) {
84  attr.put(ATTRIBUTE_NETWORKMODE, networkMode);
85  }
86  attr.put(ATTRIBUTE_POSITION, Double.toString(this.relativePositionOnLink));
87  return attr;
88  }
89 }
VehicleEntersTrafficEvent(final double time, final Id< Person > driverId, final Id< Link > linkId, Id< Vehicle > vehicleId, String networkMode, double relativePositionOnLink)