1 package org.opentrafficsim.road.gtu.lane.perception;
2
3 import java.io.Serializable;
4
5 import org.djunits.value.vdouble.scalar.Length;
6
7 import nl.tudelft.simulation.language.Throw;
8
9
10
11
12
13
14
15
16
17
18
19
20 public class InfrastructureLaneChangeInfo implements Comparable<InfrastructureLaneChangeInfo>, Serializable
21 {
22
23
24 private static final long serialVersionUID = 20160811L;
25
26
27 private final int requiredNumberOfLaneChanges;
28
29
30 private final Length remainingDistance;
31
32
33 private final boolean deadEnd;
34
35
36
37
38
39
40
41
42
43 public InfrastructureLaneChangeInfo(final int requiredNumberOfLaneChanges, final Length remainingDistance,
44 final boolean deadEnd)
45 {
46 Throw.when(requiredNumberOfLaneChanges < 0, IllegalArgumentException.class,
47 "Required number of lane changes may not be negative.");
48 Throw.whenNull(remainingDistance, "Remaining distance may not be null.");
49 Throw.when(remainingDistance.si < 0, IllegalArgumentException.class, "Remaining distance may not be negative.");
50 this.requiredNumberOfLaneChanges = requiredNumberOfLaneChanges;
51 this.remainingDistance = remainingDistance;
52 this.deadEnd = deadEnd;
53 }
54
55
56
57
58 public final int getRequiredNumberOfLaneChanges()
59 {
60 return this.requiredNumberOfLaneChanges;
61 }
62
63
64
65
66 public final Length getRemainingDistance()
67 {
68 return this.remainingDistance;
69 }
70
71
72
73
74 public boolean isDeadEnd()
75 {
76 return this.deadEnd;
77 }
78
79
80 @SuppressWarnings("checkstyle:designforextension")
81 @Override
82 public String toString()
83 {
84 return "InfrastructureLaneChangeInfo [requiredNumberOfLaneChanges=" + this.requiredNumberOfLaneChanges
85 + ", remainingDistance=" + this.remainingDistance + "]";
86 }
87
88
89 @Override
90 public final int compareTo(final InfrastructureLaneChangeInfo infrastructureLaneChangeInfo)
91 {
92 return this.remainingDistance.compareTo(infrastructureLaneChangeInfo.getRemainingDistance());
93 }
94
95 }