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