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