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