1 package org.opentrafficsim.sim0mq.kpi;
2
3 import org.opentrafficsim.kpi.interfaces.GtuData;
4
5
6
7
8
9
10
11
12
13
14 public class GtuDataSim0 implements GtuData
15 {
16
17 private final String id;
18
19
20 private final String gtuType;
21
22
23 private final RouteData route;
24
25
26
27
28
29
30 public GtuDataSim0(final String id, final String gtuType, final RouteData route)
31 {
32 this.id = id;
33 this.gtuType = gtuType;
34 this.route = route;
35 }
36
37
38 @Override
39 public final String getId()
40 {
41 return this.id;
42 }
43
44
45 @Override
46 public final String getOriginId()
47 {
48 return this.route.getStartNode();
49 }
50
51
52 @Override
53 public final String getDestinationId()
54 {
55 return this.route.getEndNode();
56 }
57
58
59 @Override
60 public final String getGtuId()
61 {
62 return this.gtuType;
63 }
64
65
66 @Override
67 public final String getRouteId()
68 {
69 return this.route.getId();
70 }
71
72
73 @Override
74 public int hashCode()
75 {
76 final int prime = 31;
77 int result = 1;
78 result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
79 return result;
80 }
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
104 @Override
105 public String toString()
106 {
107 return "GtuData [id=" + this.id + ", gtuType=" + this.gtuType + ", route=" + this.route + "]";
108 }
109
110 }