Class AbstractLaneBasedObject

java.lang.Object
org.djutils.event.EventProducer
org.opentrafficsim.core.object.StaticObject
org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
All Implemented Interfaces:
java.io.Serializable, Locatable, EventProducerInterface, Identifiable, Drawable, ObjectInterface, LaneBasedObject
Direct Known Subclasses:
AbstractSensor, AbstractTrafficLight, BusStop, Conflict, Conflict.ConflictEnd, Distraction, SpeedSign

public abstract class AbstractLaneBasedObject
extends StaticObject
implements LaneBasedObject
An abstract implementation of the LaneBasedObject interface with the required fields being initialized and getters for those fields. All StaticObjects are EventProducers, allowing them to provide state changes to subscribers.

Note that extending classes must use a create(...) factory method that calls init() after fully constructing the object to avoid "half constructed" objects to be registered in the network.

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.

$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Sep 10, 2016
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
See Also:
Serialized Form
  • Constructor Details

    • AbstractLaneBasedObject

      protected AbstractLaneBasedObject​(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, OTSLine3D geometry, Length height) throws NetworkException
      Construct a new AbstractLanebasedObject with the required fields.
      Parameters:
      id - String; the id of the new object
      lane - Lane; The lane on which the new object resides. If the new object is a Sensor; it is automatically registered on the lane
      direction - LongitudinalDirectionality; the directionality in which this is valid.
      longitudinalPosition - Length; The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      geometry - OTSLine3D; the geometry of the object, which provides its location and bounds as well
      height - Length; the height of the object, in case it is a 3D object
      Throws:
      NetworkException - when the position on the lane is out of bounds
    • AbstractLaneBasedObject

      protected AbstractLaneBasedObject​(java.lang.String id, Lane lane, Length longitudinalPosition, OTSLine3D geometry, Length height) throws NetworkException
      Construct a new AbstractLanebasedObject with the required fields.
      Parameters:
      id - String; the id of the new object
      lane - Lane; The lane on which the new object resides. If the new object is a Sensor; it is automatically registered on the lane
      longitudinalPosition - Length; The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      geometry - OTSLine3D; the geometry of the object, which provides its location and bounds as well
      height - Length; the height of the object, in case it is a 3D object
      Throws:
      NetworkException - when the position on the lane is out of bounds
    • AbstractLaneBasedObject

      protected AbstractLaneBasedObject​(java.lang.String id, Lane lane, LongitudinalDirectionality direction, Length longitudinalPosition, OTSLine3D geometry) throws NetworkException
      Construct a new LaneBasedObject with the required fields.
      Parameters:
      id - String; the id of the new AbstractLaneBasedObject
      lane - Lane; The lane for which this is a sensor
      direction - LongitudinalDirectionality; the directionality in which this is valid.
      longitudinalPosition - Length; The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      geometry - OTSLine3D; the geometry of the object, which provides its location and bounds as well
      Throws:
      NetworkException - when the position on the lane is out of bounds
    • AbstractLaneBasedObject

      protected AbstractLaneBasedObject​(java.lang.String id, Lane lane, Length longitudinalPosition, OTSLine3D geometry) throws NetworkException
      Construct a new LaneBasedObject with the required fields.
      Parameters:
      id - String; the id of the new AbstractLaneBasedObject
      lane - Lane; The lane for which this is a sensor
      longitudinalPosition - Length; The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      geometry - OTSLine3D; the geometry of the object, which provides its location and bounds as well
      Throws:
      NetworkException - when the position on the lane is out of bounds
  • Method Details