LaneDirection.java

  1. package org.opentrafficsim.road.network.lane;

  2. import java.io.Serializable;

  3. import org.opentrafficsim.core.gtu.GTUDirectionality;

  4. /**
  5.  * <p>
  6.  * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  7.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  8.  * </p>
  9.  * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
  10.  * initial version Mar 30, 2016 <br>
  11.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  12.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  13.  */
  14. public class LaneDirection implements Serializable
  15. {
  16.     /** */
  17.     private static final long serialVersionUID = 20160330L;

  18.     /** The lane. */
  19.     private final Lane lane;

  20.     /** The GTU direction to drive on this lane. */
  21.     private final GTUDirectionality direction;

  22.     /**
  23.      * @param lane the lane
  24.      * @param direction the direction to drive on this lane
  25.      */
  26.     public LaneDirection(final Lane lane, final GTUDirectionality direction)
  27.     {
  28.         super();
  29.         this.lane = lane;
  30.         this.direction = direction;
  31.     }

  32.     /**
  33.      * @return the lane
  34.      */
  35.     public final Lane getLane()
  36.     {
  37.         return this.lane;
  38.     }

  39.     /**
  40.      * @return the direction to drive on this lane
  41.      */
  42.     public final GTUDirectionality getDirection()
  43.     {
  44.         return this.direction;
  45.     }

  46.     /** {@inheritDoc} */
  47.     @Override
  48.     public String toString()
  49.     {
  50.         return "[" + this.lane + (this.direction.isPlus() ? " +]" : " -]");
  51.     }

  52. }