1 package org.opentrafficsim.sim0mq.kpi;
2
3 import org.djunits.value.vdouble.scalar.Speed;
4 import org.opentrafficsim.kpi.interfaces.GtuData;
5
6
7
8
9
10
11
12
13
14
15 public class GtuDataSim0 implements GtuData
16 {
17
18 private final String id;
19
20
21 private final String gtuType;
22
23
24 private final RouteData route;
25
26
27
28
29
30
31 public GtuDataSim0(final String id, final String gtuType, final RouteData route)
32 {
33 this.id = id;
34 this.gtuType = gtuType;
35 this.route = route;
36 }
37
38
39 @Override
40 public final String getId()
41 {
42 return this.id;
43 }
44
45
46 @Override
47 public final String getOriginId()
48 {
49 return this.route.getStartNode();
50 }
51
52
53 @Override
54 public final String getDestinationId()
55 {
56 return this.route.getEndNode();
57 }
58
59
60 @Override
61 public final String getGtuTypeId()
62 {
63 return this.gtuType;
64 }
65
66
67 @Override
68 public final String getRouteId()
69 {
70 return this.route.getId();
71 }
72
73
74 @Override
75 public Speed getReferenceSpeed()
76 {
77 return null;
78 }
79
80
81 @Override
82 public int hashCode()
83 {
84 final int prime = 31;
85 int result = 1;
86 result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
87 return result;
88 }
89
90
91 @Override
92 public boolean equals(final Object obj)
93 {
94 if (this == obj)
95 return true;
96 if (obj == null)
97 return false;
98 if (getClass() != obj.getClass())
99 return false;
100 GtuDataSim0 other = (GtuDataSim0) obj;
101 if (this.id == null)
102 {
103 if (other.id != null)
104 return false;
105 }
106 else if (!this.id.equals(other.id))
107 return false;
108 return true;
109 }
110
111
112 @Override
113 public String toString()
114 {
115 return "GtuData [id=" + this.id + ", gtuType=" + this.gtuType + ", route=" + this.route + "]";
116 }
117
118 }