TrafficLightColor.java

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

  2. /**
  3.  * The colors for a normal traffic light.
  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/current/license.html">OpenTrafficSim License</a>.
  7.  * </p>
  8.  * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
  9.  * initial version Oct 6, 2016 <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.  * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
  13.  */
  14. public enum TrafficLightColor
  15. {
  16.     /** GTU needs to stop. */
  17.     RED,

  18.     /** GTU is allowed to continue if it cannot stop anymore. */
  19.     YELLOW,

  20.     /** GTU is allowed to drive. */
  21.     GREEN,

  22.     /** Traffic light is not working. */
  23.     BLACK;
  24.    
  25.     /** @return whether the light is red. */
  26.     public final boolean isRed()
  27.     {
  28.         return this.equals(RED);
  29.     }
  30.    
  31.     /** @return whether the light is yellow. */
  32.     public final boolean isYellow()
  33.     {
  34.         return this.equals(YELLOW);
  35.     }
  36.    
  37.     /** @return whether the light is green. */
  38.     public final boolean isGreen()
  39.     {
  40.         return this.equals(GREEN);
  41.     }
  42.    
  43.     /** @return whether the light is black (off). */
  44.     public final boolean isBlack()
  45.     {
  46.         return this.equals(BLACK);
  47.     }

  48. }