Class SpeedSign
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.SpeedSign
- All Implemented Interfaces:
java.io.Serializable,Locatable,EventProducerInterface,Identifiable,Drawable,ObjectInterface,LaneBasedObject
public class SpeedSign extends AbstractLaneBasedObject
Speed sign.
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 20 apr. 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION -
Constructor Summary
Constructors Constructor Description SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed)Speed sign active all day for all GTU types.SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed, Duration startTimeOfDay, Duration endTimeOfDay)Speed sign for all GTU types.SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed, GTUType gtuType)Speed sign active all day.SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed, GTUType gtuType, Duration startTimeOfDay, Duration endTimeOfDay)Construct a new SpeedSign. -
Method Summary
Modifier and Type Method Description AbstractLaneBasedObjectclone(CrossSectionElement newCSE, SimulatorInterface.TimeDoubleUnit newSimulator)Clone the LaneBasedObject for e.g., copying a network.booleanequals(java.lang.Object obj)SpeedgetSpeed()Returns the speed.inthashCode()booleanisActive(GTUType gtuTypeIn, Duration time)Return whether this speed limit is currently active.java.lang.StringtoString()Methods 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, finalize, getClass, 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
-
SpeedSign
public SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed, GTUType gtuType, Duration startTimeOfDay, Duration endTimeOfDay) throws NetworkExceptionConstruct a new SpeedSign.- Parameters:
id- String; the id of the new SpeedSignlane- Lane; Lane on/over which the SpeedSign is positioneddirection- LongitudinalDirectionality; driving direction for which the new SpeedSign applieslongitudinalPosition- Length; the longitudinal position along the lane of the new SpeedSignsimulator- SimulatorInterface.TimeDoubleUnit; the simulatorspeed- Speed; the speed limit shown by the new SpeedSigngtuType- GTUType; GTU type that should obey the speed signstartTimeOfDay- Duration; start time-of-dayendTimeOfDay- Duration; end time-of-day- Throws:
NetworkException- when the position on the lane is out of bounds
-
SpeedSign
public SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed, GTUType gtuType) throws NetworkExceptionSpeed sign active all day.- Parameters:
id- String; idlane- Lane; lanedirection- LongitudinalDirectionality; directionlongitudinalPosition- Length; longitudinal positionsimulator- SimulatorInterface.TimeDoubleUnit; simulatorspeed- Speed; speedgtuType- GTUType; GTU type- Throws:
NetworkException- when the position on the lane is out of bounds
-
SpeedSign
public SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed, Duration startTimeOfDay, Duration endTimeOfDay) throws NetworkExceptionSpeed sign for all GTU types.- Parameters:
id- String; idlane- Lane; lanedirection- LongitudinalDirectionality; directionlongitudinalPosition- Length; longitudinal positionsimulator- SimulatorInterface.TimeDoubleUnit; simulatorspeed- Speed; speedstartTimeOfDay- Duration; start time-of-dayendTimeOfDay- Duration; end time-of-day- Throws:
NetworkException- when the position on the lane is out of bounds
-
SpeedSign
public SpeedSign(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, SimulatorInterface.TimeDoubleUnit simulator, Speed speed) throws NetworkExceptionSpeed sign active all day for all GTU types.- Parameters:
id- String; idlane- Lane; lanedirection- LongitudinalDirectionality; directionlongitudinalPosition- Length; longitudinal positionsimulator- SimulatorInterface.TimeDoubleUnit; simulatorspeed- Speed; speed- Throws:
NetworkException- when the position on the lane is out of bounds
-
-
Method Details
-
isActive
Return whether this speed limit is currently active.- Parameters:
gtuTypeIn- GTUType; GTU typetime- Duration; current time-of-day- Returns:
- whether this speed limit is currently active
-
getSpeed
Returns the speed.- Returns:
- the speed
-
clone
public final 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
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
toString
public final java.lang.String toString()- Overrides:
toStringin classAbstractLaneBasedObject
-