1 package org.opentrafficsim.road.network.lane;
2
3 import java.io.Serializable;
4
5 import org.opentrafficsim.core.gtu.GTUDirectionality;
6
7 /**
8 * <p>
9 * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
10 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
11 * </p>
12 * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
13 * initial version Mar 30, 2016 <br>
14 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
16 */
17 public class LaneDirection implements Serializable
18 {
19 /** */
20 private static final long serialVersionUID = 20160330L;
21
22 /** The lane. */
23 private final Lane lane;
24
25 /** The GTU direction to drive on this lane. */
26 private final GTUDirectionality direction;
27
28 /**
29 * @param lane the lane
30 * @param direction the direction to drive on this lane
31 */
32 public LaneDirection(final Lane lane, final GTUDirectionality direction)
33 {
34 super();
35 this.lane = lane;
36 this.direction = direction;
37 }
38
39 /**
40 * @return the lane
41 */
42 public final Lane getLane()
43 {
44 return this.lane;
45 }
46
47 /**
48 * @return the direction to drive on this lane
49 */
50 public final GTUDirectionality getDirection()
51 {
52 return this.direction;
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public String toString()
58 {
59 return "[" + this.lane + (this.direction.isPlus() ? " +]" : " -]");
60 }
61
62 }