1 package org.opentrafficsim.imb.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
65
66 public final void setLinkData(LinkData linkData)
67 {
68 this.linkData = linkData;
69 }
70
71
72 @Override
73 public int hashCode()
74 {
75 final int prime = 31;
76 int result = 1;
77 result = prime * result + ((this.laneName == null) ? 0 : this.laneName.hashCode());
78 result = prime * result + ((this.length == null) ? 0 : this.length.hashCode());
79 result = prime * result + ((this.linkData == null) ? 0 : this.linkData.hashCode());
80 return result;
81 }
82
83
84 @Override
85 public boolean equals(Object obj)
86 {
87 if (this == obj)
88 return true;
89 if (obj == null)
90 return false;
91 if (getClass() != obj.getClass())
92 return false;
93 LaneData other = (LaneData) obj;
94 if (this.laneName == null)
95 {
96 if (other.laneName != null)
97 return false;
98 }
99 else if (!this.laneName.equals(other.laneName))
100 return false;
101 if (this.length == null)
102 {
103 if (other.length != null)
104 return false;
105 }
106 else if (!this.length.equals(other.length))
107 return false;
108 if (this.linkData == null)
109 {
110 if (other.linkData != null)
111 return false;
112 }
113 else if (!this.linkData.equals(other.linkData))
114 return false;
115 return true;
116 }
117
118
119 @Override
120 public String toString()
121 {
122 return "LaneData [linkData=" + this.linkData + ", laneName=" + this.laneName + ", length=" + this.length + "]";
123 }
124
125 }