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