Class HeadwayTrafficLightReal
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadway
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayCopy
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayLaneBasedObject
org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayTrafficLightReal
- All Implemented Interfaces:
Serializable,Comparable<Headway>,org.djutils.base.Identifiable,PerceivedObject,Headway,HeadwayLaneBasedObject,HeadwayTrafficLight
public class HeadwayTrafficLightReal
extends AbstractHeadwayLaneBasedObject
implements HeadwayTrafficLight
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway
Headway.ObjectType -
Constructor Summary
ConstructorsConstructorDescriptionHeadwayTrafficLightReal(TrafficLight trafficLight, org.djunits.value.vdouble.scalar.Length distance, boolean turnOnRed) Construct a new Headway information object, for a traffic light ahead of us (or behind us, although that does not seem very useful). -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanWhether the perceiving GTU may turn on red.final TrafficLightColorReturns the traffic light color.final StringtoString()Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayLaneBasedObject
getLaneMethods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayCopy
equals, getAcceleration, getId, getLength, getObjectType, getSpeed, hashCodeMethods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadway
getDistance, getOverlap, getOverlapFront, getOverlapRear, isAhead, isBehind, isParallelMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway
compareTo, getAcceleration, getDistance, getId, getLength, getObjectType, getOverlap, getOverlapFront, getOverlapRear, getSpeed, isAhead, isBehind, isParallelMethods inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayLaneBasedObject
getLane
-
Constructor Details
-
HeadwayTrafficLightReal
public HeadwayTrafficLightReal(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- the traffic light object for further observation, can not be null.distance- the distance to the traffic light, distance cannot be null.turnOnRed- whether the perceiving GTU may turn on red.- Throws:
GtuException- when id is null, or parameters are inconsistent
-
-
Method Details
-
getTrafficLightColor
Description copied from interface:HeadwayTrafficLightReturns the traffic light color.- Specified by:
getTrafficLightColorin interfaceHeadwayTrafficLight- Returns:
- the traffic light color.
-
canTurnOnRed
public final boolean canTurnOnRed()Description copied from interface:HeadwayTrafficLightWhether the perceiving GTU may turn on red.- Specified by:
canTurnOnRedin interfaceHeadwayTrafficLight- Returns:
- whether the perceiving GTU may turn on red.
-
toString
- Overrides:
toStringin classAbstractHeadway
-