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 String getId()
57 {
58 return this.lane.getId();
59 }
60
61
62
63 @Override
64 public final int hashCode()
65 {
66 final int prime = 31;
67 int result = 1;
68 result = prime * result + ((this.lane == null) ? 0 : this.lane.hashCode());
69 return result;
70 }
71
72
73 @Override
74 public final boolean equals(final Object obj)
75 {
76 if (this == obj)
77 {
78 return true;
79 }
80 if (obj == null)
81 {
82 return false;
83 }
84 if (getClass() != obj.getClass())
85 {
86 return false;
87 }
88 LaneData other = (LaneData) obj;
89 if (this.lane == null)
90 {
91 if (other.lane != null)
92 {
93 return false;
94 }
95 }
96 else if (!this.lane.equals(other.lane))
97 {
98 return false;
99 }
100 return true;
101 }
102
103
104 @Override
105 public final String toString()
106 {
107 return "LaneData [lane=" + this.lane + "]";
108 }
109
110 }