1 package org.opentrafficsim.road.network;
2
3 import org.djunits.value.vdouble.scalar.Length;
4 import org.djutils.exceptions.Throw;
5 import org.opentrafficsim.core.network.LateralDirectionality;
6
7
8
9
10
11
12
13
14
15
16
17 public class LaneChangeInfo implements Comparable<LaneChangeInfo>
18 {
19
20
21 private final int n;
22
23
24 private final Length remainingDistance;
25
26
27 private final boolean deadEnd;
28
29
30 private final LateralDirectionality lat;
31
32
33
34
35
36
37
38
39 public LaneChangeInfo(final int n, final Length remainingDistance, final boolean deadEnd, final LateralDirectionality lat)
40 {
41 Throw.whenNull(remainingDistance, "remainingDistance may not be null");
42 Throw.whenNull(lat, "lat may not be null");
43 this.n = n;
44 this.remainingDistance = remainingDistance;
45 this.deadEnd = deadEnd;
46 this.lat = lat;
47 }
48
49
50
51
52
53 public int getNumberOfLaneChanges()
54 {
55 return this.n;
56 }
57
58
59
60
61
62 public Length getRemainingDistance()
63 {
64 return this.remainingDistance;
65 }
66
67
68
69
70
71 public boolean deadEnd()
72 {
73 return this.deadEnd;
74 }
75
76
77
78
79
80 public final LateralDirectionality getLateralDirectionality()
81 {
82 return this.lat;
83 }
84
85
86 @Override
87 public int compareTo(final LaneChangeInfo o)
88 {
89 if (o == null)
90 {
91 return 1;
92 }
93 if (o.remainingDistance.equals(this.remainingDistance))
94 {
95 return Integer.compare(this.n, o.n);
96 }
97 return this.remainingDistance.compareTo(o.remainingDistance);
98 }
99
100 }