MATSIM
LaneEnterEvent.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * LaneEnterEvent
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2009 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 package org.matsim.core.api.experimental.events;
21 
22 import java.util.Map;
23 
24 import org.matsim.api.core.v01.Id;
27 import org.matsim.lanes.Lane;
28 import org.matsim.vehicles.Vehicle;
29 
30 
36 public final class LaneEnterEvent extends Event {
37 
38  public static final String EVENT_TYPE = "entered lane";
39  public static final String ATTRIBUTE_VEHICLE = "vehicle";
40  public static final String ATTRIBUTE_LINK = "link";
41  public static final String ATTRIBUTE_LANE = "lane";
42 
43  private final Id<Vehicle> vehicleId;
44  private final Id<Link> linkId;
45  private final Id<Lane> laneId;
46 
47  public LaneEnterEvent(double time, Id<Vehicle> vehicleId, Id<Link> linkId, Id<Lane> laneId) {
48  super(time);
49  this.laneId = laneId;
50  this.vehicleId = vehicleId;
51  this.linkId = linkId;
52  }
53 
54  @Override
55  public String getEventType() {
56  return EVENT_TYPE;
57  }
58 
59  @Override
60  public Map<String, String> getAttributes() {
61  Map<String, String> attr = super.getAttributes();
62  attr.put(ATTRIBUTE_VEHICLE, this.vehicleId.toString());
63  attr.put(ATTRIBUTE_LINK, this.linkId.toString());
64  attr.put(ATTRIBUTE_LANE, this.laneId.toString());
65  return attr;
66  }
67 
69  return vehicleId;
70  }
71 
72  public Id<Link> getLinkId() {
73  return this.linkId;
74  }
75 
76  public Id<Lane> getLaneId() {
77  return this.laneId;
78  }
79 }
LaneEnterEvent(double time, Id< Vehicle > vehicleId, Id< Link > linkId, Id< Lane > laneId)