GTUDirectionality.java

  1. package org.opentrafficsim.core.gtu;

  2. /**
  3.  * Longitudinal driving directions for a GTU. The driving directions can be used on a link or a lane.
  4.  * <p>
  5.  * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  6.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  7.  * <p>
  8.  * $LastChangedDate: 2015-11-11 13:25:26 +0100 (Wed, 11 Nov 2015) $, @version $Revision: 1548 $, by $Author: averbraeck $,
  9.  * initial version Nov 11, 2015 <br>
  10.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  11.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  12.  */
  13. public enum GTUDirectionality
  14. {
  15.     /**
  16.      * Driving direction matches the direction of the graph, increasing fractional position when driving in this direction.
  17.      */
  18.     DIR_PLUS,
  19.     /**
  20.      * Driving direction opposite to the direction of the graph, decreasing fractional position when driving in this direction.
  21.      */
  22.     DIR_MINUS;

  23.     /**
  24.      * @return whether the gtu drives in the design direction on the link
  25.      */
  26.     public boolean isPlus()
  27.     {
  28.         return this.equals(DIR_PLUS);
  29.     }

  30.     /**
  31.      * @return whether the gtu drives against the design direction on the link
  32.      */
  33.     public boolean isMinus()
  34.     {
  35.         return this.equals(DIR_MINUS);
  36.     }
  37. }