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 @Override
39 public final String getId()
40 {
41 return this.id;
42 }
43
44 @Override
45 public final String getOriginId()
46 {
47 return this.route.getStartNode();
48 }
49
50 @Override
51 public final String getDestinationId()
52 {
53 return this.route.getEndNode();
54 }
55
56 @Override
57 public final String getGtuTypeId()
58 {
59 return this.gtuType;
60 }
61
62 @Override
63 public final String getRouteId()
64 {
65 return this.route.getId();
66 }
67
68 @Override
69 public Speed getReferenceSpeed()
70 {
71 return null;
72 }
73
74 @Override
75 public int hashCode()
76 {
77 final int prime = 31;
78 int result = 1;
79 result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
80 return result;
81 }
82
83 @Override
84 public boolean equals(final Object obj)
85 {
86 if (this == obj)
87 return true;
88 if (obj == null)
89 return false;
90 if (getClass() != obj.getClass())
91 return false;
92 GtuDataSim0 other = (GtuDataSim0) obj;
93 if (this.id == null)
94 {
95 if (other.id != null)
96 return false;
97 }
98 else if (!this.id.equals(other.id))
99 return false;
100 return true;
101 }
102
103 @Override
104 public String toString()
105 {
106 return "GtuData [id=" + this.id + ", gtuType=" + this.gtuType + ", route=" + this.route + "]";
107 }
108
109 }