Class 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
  • 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 NetworkException
      Construct a new SpeedSign.
      Parameters:
      id - String; the id of the new SpeedSign
      lane - Lane; Lane on/over which the SpeedSign is positioned
      direction - LongitudinalDirectionality; driving direction for which the new SpeedSign applies
      longitudinalPosition - Length; the longitudinal position along the lane of the new SpeedSign
      simulator - SimulatorInterface.TimeDoubleUnit; the simulator
      speed - Speed; the speed limit shown by the new SpeedSign
      gtuType - GTUType; GTU type that should obey the speed sign
      startTimeOfDay - Duration; start time-of-day
      endTimeOfDay - 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 NetworkException
      Speed sign active all day.
      Parameters:
      id - String; id
      lane - Lane; lane
      direction - LongitudinalDirectionality; direction
      longitudinalPosition - Length; longitudinal position
      simulator - SimulatorInterface.TimeDoubleUnit; simulator
      speed - Speed; speed
      gtuType - 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 NetworkException
      Speed sign for all GTU types.
      Parameters:
      id - String; id
      lane - Lane; lane
      direction - LongitudinalDirectionality; direction
      longitudinalPosition - Length; longitudinal position
      simulator - SimulatorInterface.TimeDoubleUnit; simulator
      speed - Speed; speed
      startTimeOfDay - Duration; start time-of-day
      endTimeOfDay - 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 NetworkException
      Speed sign active all day for all GTU types.
      Parameters:
      id - String; id
      lane - Lane; lane
      direction - LongitudinalDirectionality; direction
      longitudinalPosition - Length; longitudinal position
      simulator - SimulatorInterface.TimeDoubleUnit; simulator
      speed - Speed; speed
      Throws:
      NetworkException - when the position on the lane is out of bounds
  • Method Details

    • isActive

      public final boolean isActive​(GTUType gtuTypeIn, Duration time)
      Return whether this speed limit is currently active.
      Parameters:
      gtuTypeIn - GTUType; GTU type
      time - Duration; current time-of-day
      Returns:
      whether this speed limit is currently active
    • getSpeed

      public final Speed getSpeed()
      Returns the speed.
      Returns:
      the speed
    • clone

      Clone the LaneBasedObject for e.g., copying a network.
      Specified by:
      clone in class AbstractLaneBasedObject
      Parameters:
      newCSE - CrossSectionElement; the new cross section element to which the clone belongs
      newSimulator - 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:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • toString

      public final java.lang.String toString()
      Overrides:
      toString in class AbstractLaneBasedObject