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:
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.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Nov 30, 2015
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 class org.djutils.event.EventProducer
eventProducerImpl
-
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(String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator)
Construct an AbstractTrafficLight at default elevation (use only on roads at elevation 0).AbstractTrafficLight(String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator, Length height)
Construct an AbstractTrafficLight with specified elevation.
-
Method Summary
All Methods Instance Methods Concrete Methods 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, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, 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.base.Identifiable
getId
-
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 Detail
-
DEFAULT_TRAFFICLIGHT_ELEVATION
public static final Length DEFAULT_TRAFFICLIGHT_ELEVATION
Default elevation of a traffic light (above zero; don't use this for lanes at non-zero elevation).
-
-
Constructor Detail
-
AbstractTrafficLight
public AbstractTrafficLight(String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator, Length height) throws NetworkException
Construct 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(String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator) throws NetworkException
Construct 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 Detail
-
getTrafficLightColor
public final TrafficLightColor getTrafficLightColor()
- Specified by:
getTrafficLightColor
in interfaceTrafficLight
- Returns:
- the trafficLightColor
-
setTrafficLightColor
public final void setTrafficLightColor(TrafficLightColor trafficLightColor)
Set the new traffic light color.- Specified by:
setTrafficLightColor
in interfaceTrafficLight
- Parameters:
trafficLightColor
- TrafficLightColor; set the trafficLightColor
-
-