Class AbstractTrafficLight
java.lang.Object
org.djutils.event.EventProducer
org.opentrafficsim.core.object.StaticObject
org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
org.opentrafficsim.road.network.lane.object.trafficlight.AbstractTrafficLight
- All Implemented Interfaces:
java.io.Serializable
,Locatable
,EventProducerInterface
,Identifiable
,Drawable
,ObjectInterface
,LaneBasedObject
,TrafficLight
- Direct Known Subclasses:
SimpleTrafficLight
public abstract class AbstractTrafficLight extends AbstractLaneBasedObject implements TrafficLight
Basic, abstract implementation of a traffic light.
Copyright (c) 2013-2020 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:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static Length
DEFAULT_TRAFFICLIGHT_ELEVATION
Default elevation of a traffic light (above zero; don't use this for lanes at non-zero elevation).Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
Fields inherited from interface org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight
TRAFFICLIGHT_CHANGE_EVENT
-
Constructor Summary
Constructors Constructor Description AbstractTrafficLight(java.lang.String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator)
Construct an AbstractTrafficLight at default elevation (use only on roads at elevation 0).AbstractTrafficLight(java.lang.String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator, Length height)
Construct an AbstractTrafficLight with specified elevation. -
Method Summary
Modifier and Type Method Description TrafficLightColor
getTrafficLightColor()
void
setTrafficLightColor(TrafficLightColor trafficLightColor)
Set the new traffic light color.Methods inherited from class org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
clone, clone, getDirection, getFullId, getLane, getLocation, getLongitudinalPosition, init, toString
Methods inherited from class org.opentrafficsim.core.object.StaticObject
create, create, getBounds, getGeometry, getHeight, getId, getSourceId
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, getSourceId, hasListeners, numberOfListeners, removeListener
Methods inherited from interface org.opentrafficsim.road.network.lane.object.LaneBasedObject
getBounds, getDirection, getLane, getLocation, getLongitudinalPosition
Methods inherited from interface org.opentrafficsim.core.object.ObjectInterface
getFullId, getGeometry, getHeight
-
Field Details
-
DEFAULT_TRAFFICLIGHT_ELEVATION
Default elevation of a traffic light (above zero; don't use this for lanes at non-zero elevation).
-
-
Constructor Details
-
AbstractTrafficLight
public AbstractTrafficLight(java.lang.String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator, Length height) throws NetworkExceptionConstruct an AbstractTrafficLight with specified elevation.- Parameters:
id
- String; traffic light idlane
- Lane; lane where the traffic light is locatedlongitudinalPosition
- Length; position of the traffic light on the lane, in the design directionsimulator
- DEVSSimulatorInterface.TimeDoubleUnit; the simulator for animation and timed eventsheight
- Length; the elevation of the traffic light- Throws:
NetworkException
- on failure to place the object
-
AbstractTrafficLight
public AbstractTrafficLight(java.lang.String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator) throws NetworkExceptionConstruct an AbstractTrafficLight at default elevation (use only on roads at elevation 0).- Parameters:
id
- String; traffic light idlane
- Lane; lane where the traffic light is locatedlongitudinalPosition
- Length; position of the traffic light on the lane, in the design directionsimulator
- DEVSSimulatorInterface.TimeDoubleUnit; the simulator for animation and timed events- Throws:
NetworkException
- on failure to place the object
-
-
Method Details
-
getTrafficLightColor
- Specified by:
getTrafficLightColor
in interfaceTrafficLight
- Returns:
- the trafficLightColor
-
setTrafficLightColor
Set the new traffic light color.- Specified by:
setTrafficLightColor
in interfaceTrafficLight
- Parameters:
trafficLightColor
- TrafficLightColor; set the trafficLightColor
-