1 package org.opentrafficsim.road.gtu.lane.tactical;
2
3 import java.io.Serializable;
4 import java.util.Set;
5
6 import org.opentrafficsim.core.network.Node;
7 import org.opentrafficsim.road.network.lane.Lane;
8
9 /**
10 * This class provides information for an operational plan about the next location where the network splits. if the networks
11 * splits, the node where it splits, and the current lanes that lead to the right node are calculated.
12 * <p>
13 * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
15 * </p>
16 * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
17 * initial version Dec 31, 2015 <br>
18 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
19 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
20 */
21 public class NextSplitInfo implements Serializable
22 {
23 /** */
24 private static final long serialVersionUID = 20151231L;
25
26 /** If the route splits, at what node does it split? */
27 private final Node nextSplitNode;
28
29 /**
30 * If the route splits, what are the lane(s) and/or adjacent lane(s) on which the reference point of the GTU is registered
31 * that lead us in the direction of the route provided by the strategical planner.
32 */
33 private final Set<Lane> correctCurrentLanes;
34
35 /**
36 * @param nextSplitNode the first subsequent node at which the route splits.
37 * @param correctCurrentLanes the lane(s) and/or adjacent lane(s) on which the reference point of the GTU is registered that
38 * lead us in the direction of the route provided by the strategical planner.
39 */
40 public NextSplitInfo(final Node nextSplitNode, final Set<Lane> correctCurrentLanes)
41 {
42 super();
43 this.nextSplitNode = nextSplitNode;
44 this.correctCurrentLanes = correctCurrentLanes;
45 }
46
47 /**
48 * @return split indicates whether the route splits within the given distance.
49 */
50 public final boolean isSplit()
51 {
52 return this.nextSplitNode != null;
53 }
54
55 /**
56 * @return nextSplitNode the first subsequent node at which the route splits.
57 */
58 public final Node getNextSplitNode()
59 {
60 return this.nextSplitNode;
61 }
62
63 /**
64 * @return correctCurrentLanes the lane(s) and/or adjacent lane(s) on which the reference point of the GTU is registered
65 * that lead us in the direction of the route provided by the strategical planner.
66 */
67 public final Set<Lane> getCorrectCurrentLanes()
68 {
69 return this.correctCurrentLanes;
70 }
71
72 /** {@inheritDoc} */
73 @Override
74 public final String toString()
75 {
76 return "NextSplitInfo [nextSplitNode=" + this.nextSplitNode + ", correctCurrentLanes=" + this.correctCurrentLanes + "]";
77 }
78 }