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