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