Class PerceivedTrafficLight
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.object.PerceivedObjectBase
org.opentrafficsim.road.gtu.lane.perception.object.PerceivedLaneBasedObjectBase
org.opentrafficsim.road.gtu.lane.perception.object.PerceivedTrafficLight
- All Implemented Interfaces:
Comparable<PerceivedObject>,Identifiable,PerceivedLaneBasedObject,PerceivedObject
- Direct Known Subclasses:
PerceivedTrafficLightChannel
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opentrafficsim.road.gtu.lane.perception.object.PerceivedObject
PerceivedObject.Kinematics, PerceivedObject.ObjectType -
Constructor Summary
ConstructorsConstructorDescriptionPerceivedTrafficLight(TrafficLight trafficLight, 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 TypeMethodDescriptionbooleanWhether the perceiving GTU may turn on red.protected TrafficLightReturns the traffic light for sub classes.Returns the traffic light color.toString()Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.object.PerceivedLaneBasedObjectBase
equals, getLane, hashCodeMethods inherited from class org.opentrafficsim.road.gtu.lane.perception.object.PerceivedObjectBase
getId, getKinematics, getLength, getObjectTypeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.base.Identifiable
getIdMethods inherited from interface org.opentrafficsim.road.gtu.lane.perception.object.PerceivedObject
compareTo, getAcceleration, getDistance, getKinematics, getLength, getObjectType, getSpeed
-
Constructor Details
-
PerceivedTrafficLight
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.
-
-
Method Details
-
getTrafficLightColor
Returns the traffic light color.- Returns:
- the traffic light color.
-
canTurnOnRed
public boolean canTurnOnRed()Whether the perceiving GTU may turn on red.- Returns:
- whether the perceiving GTU may turn on red.
-
getTrafficLight
Returns the traffic light for sub classes.- Returns:
- traffic light
-
toString
Description copied from class:PerceivedLaneBasedObjectBase- Overrides:
toStringin classPerceivedLaneBasedObjectBase
-