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