MATSIM
VehicleArrivesAtFacilityEvent.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * VehicleArrivesAtFacilityEvent.java
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 
21 package org.matsim.core.api.experimental.events;
22 
23 import org.matsim.api.core.v01.Id;
26 import org.matsim.vehicles.Vehicle;
27 
28 import java.util.Map;
29 
36 public final class VehicleArrivesAtFacilityEvent extends Event {
37 
38  public static final String EVENT_TYPE = "VehicleArrivesAtFacility";
39  public static final String ATTRIBUTE_VEHICLE = "vehicle";
40  public static final String ATTRIBUTE_FACILITY = "facility";
41  public static final String ATTRIBUTE_DELAY = "delay";
42 
43  private final Id<Vehicle> vehicleId;
45  private double delay;
46 
47  public VehicleArrivesAtFacilityEvent(final double time, final Id<Vehicle> vehicleId,
48  final Id<TransitStopFacility> facilityId, double delay) {
49  super(time);
50  this.vehicleId = vehicleId;
51  this.facilityId = facilityId;
52  this.delay = delay;
53  }
54 
55  public double getDelay() {
56  return this.delay;
57  }
58 
60  return this.facilityId;
61  }
62 
64  return this.vehicleId;
65  }
66 
67  @Override
68  public String getEventType() {
69  return EVENT_TYPE;
70  }
71 
72  public void setDelay(double delay) {
73  this.delay = delay;
74  }
75 
76  @Override
77  public Map<String, String> getAttributes() {
78  Map<String, String> attributes = super.getAttributes();
79  attributes.put(ATTRIBUTE_VEHICLE, this.vehicleId.toString());
80  attributes.put(ATTRIBUTE_FACILITY, this.facilityId.toString());
81  attributes.put(ATTRIBUTE_DELAY, Double.toString(this.delay));
82  return attributes;
83  }
84 }
VehicleArrivesAtFacilityEvent(final double time, final Id< Vehicle > vehicleId, final Id< TransitStopFacility > facilityId, double delay)