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