Class Distraction
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.Distraction
- All Implemented Interfaces:
java.io.Serializable,Locatable,EventProducerInterface,Identifiable,Drawable,ObjectInterface,LaneBasedObject
public class Distraction extends AbstractLaneBasedObject
Distraction following a distance profile.
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.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 5 apr. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDistraction.DistractionProfileDescribes the profile around the distraction.static classDistraction.TrapezoidProfileDistraction profile with trapezoid shape. -
Field Summary
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION -
Constructor Summary
Constructors Constructor Description Distraction(java.lang.String id, Lane lane, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Distraction.DistractionProfile profile) -
Method Summary
Modifier and Type Method Description AbstractLaneBasedObjectclone(CrossSectionElement newCSE, SimulatorInterface.TimeDoubleUnit newSimulator)Clone the LaneBasedObject for e.g., copying a network.java.lang.DoublegetDistraction(Length distance)Returns the level of distraction at the given distance.Methods inherited from class org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
clone, getDirection, getFullId, getLane, getLocation, getLongitudinalPosition, init, toStringMethods 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
getBoundsMethods inherited from interface org.opentrafficsim.core.object.ObjectInterface
getGeometry, getHeight
-
Constructor Details
-
Distraction
public Distraction(java.lang.String id, Lane lane, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Distraction.DistractionProfile profile) throws NetworkException- Parameters:
id- String; idlane- Lane; lanelongitudinalPosition- Length; longitudinal positionsimulator- SimulatorInterface.TimeDoubleUnit; simulatorprofile- DistractionProfile; distraction profile- Throws:
NetworkException- on network exception
-
-
Method Details
-
clone
public AbstractLaneBasedObject 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
-
getDistraction
Returns the level of distraction at the given distance.- Parameters:
distance- Distance to distraction; negative when approaching- Returns:
- Double; level of distraction (task-demand), or
nullif the distraction is no longer important
-