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.kpi.interfaces.LinkDataInterface;
6 import org.opentrafficsim.road.network.lane.Lane;
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 LinkDataInterface getLinkData()
50 {
51 return new LinkData(this.lane.getParentLink());
52 }
53
54
55 @Override
56 public final int hashCode()
57 {
58 final int prime = 31;
59 int result = 1;
60 result = prime * result + ((this.lane == null) ? 0 : this.lane.hashCode());
61 return result;
62 }
63
64
65 @Override
66 public final boolean equals(final Object obj)
67 {
68 if (this == obj)
69 {
70 return true;
71 }
72 if (obj == null)
73 {
74 return false;
75 }
76 if (getClass() != obj.getClass())
77 {
78 return false;
79 }
80 LaneData other = (LaneData) obj;
81 if (this.lane == null)
82 {
83 if (other.lane != null)
84 {
85 return false;
86 }
87 }
88 else if (!this.lane.equals(other.lane))
89 {
90 return false;
91 }
92 return true;
93 }
94
95
96 @Override
97 public final String toString()
98 {
99 return "LaneData [lane=" + this.lane + "]";
100 }
101
102 }