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