Class SimpleTrafficLight
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
org.opentrafficsim.road.network.lane.object.trafficlight.SimpleTrafficLight
- All Implemented Interfaces:
java.io.Serializable,Locatable,EventProducerInterface,Identifiable,Drawable,ObjectInterface,LaneBasedObject,TrafficLight
public class SimpleTrafficLight extends AbstractTrafficLight
Standard 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 inherited from class org.opentrafficsim.road.network.lane.object.trafficlight.AbstractTrafficLight
DEFAULT_TRAFFICLIGHT_ELEVATIONFields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight
TRAFFICLIGHT_CHANGE_EVENT -
Constructor Summary
Constructors Constructor Description SimpleTrafficLight(java.lang.String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator) -
Method Summary
Modifier and Type Method Description SimpleTrafficLightclone(CrossSectionElement newCSE, SimulatorInterface.TimeDoubleUnit newSimulator)Clone the LaneBasedObject for e.g., copying a network.java.lang.StringtoString()Methods inherited from class org.opentrafficsim.road.network.lane.object.trafficlight.AbstractTrafficLight
getTrafficLightColor, setTrafficLightColorMethods inherited from class org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
clone, getDirection, getFullId, getLane, getLocation, getLongitudinalPosition, initMethods inherited from class org.opentrafficsim.core.object.StaticObject
create, create, getBounds, getGeometry, getHeight, getId, getSourceIdMethods 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, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, getSourceId, hasListeners, numberOfListeners, removeListenerMethods inherited from interface org.opentrafficsim.road.network.lane.object.LaneBasedObject
getBounds, getDirection, getLane, getLocation, getLongitudinalPositionMethods inherited from interface org.opentrafficsim.core.object.ObjectInterface
getFullId, getGeometry, getHeight
-
Constructor Details
-
SimpleTrafficLight
public SimpleTrafficLight(java.lang.String id, Lane lane, Length longitudinalPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator) throws NetworkException- 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
-
toString
public java.lang.String toString()- Overrides:
toStringin classAbstractLaneBasedObject
-
clone
public SimpleTrafficLight clone(CrossSectionElement newCSE, SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkExceptionClone the LaneBasedObject for e.g., copying a network.- Specified by:
clonein classAbstractLaneBasedObject- Parameters:
newCSE- CrossSectionElement; the new cross section element to which the clone belongsnewSimulator- SimulatorInterface.TimeDoubleUnit; the new simulator for this network- Returns:
- AbstractLaneBasedObject; a clone of this object
- Throws:
NetworkException- in case the cloning fails
-