Class HeadwayTrafficLight

All Implemented Interfaces:
Serializable, Comparable<Headway>, org.djutils.base.Identifiable, PerceivedObject, Headway, HeadwayLaneBasedObject

public class HeadwayTrafficLight extends AbstractHeadwayLaneBasedObject
Container for a reference to information about a (lane based) traffic light and a headway to the traffic light.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers
See Also:
  • Constructor Details

    • HeadwayTrafficLight

      public HeadwayTrafficLight(TrafficLight trafficLight, org.djunits.value.vdouble.scalar.Length distance, boolean turnOnRed) throws GtuException
      Construct a new Headway information object, for a traffic light ahead of us (or behind us, although that does not seem very useful).
      Parameters:
      trafficLight - TrafficLight; the traffic light object for further observation, can not be null.
      distance - Length; the distance to the traffic light, distance cannot be null.
      turnOnRed - boolean; whether the perceiving GTU may turn on red.
      Throws:
      GtuException - when id is null, or parameters are inconsistent
  • Method Details

    • getTrafficLightColor

      public final TrafficLightColor getTrafficLightColor()
      Returns:
      the traffic light color.
    • canTurnOnRed

      public final boolean canTurnOnRed()
      Whether the perceiving GTU may turn on red.
      Returns:
      boolean; whether the perceiving GTU may turn on red.
    • toString

      public final String toString()
      Overrides:
      toString in class AbstractHeadway