Class SimpleReportingSensor
java.lang.Object
nl.tudelft.simulation.event.EventProducer
org.opentrafficsim.core.object.StaticObject
org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
org.opentrafficsim.road.network.lane.object.sensor.AbstractSensor
org.opentrafficsim.road.network.lane.object.sensor.SimpleReportingSensor
- All Implemented Interfaces:
Serializable,Comparable<SingleSensor>,Locatable,EventProducerInterface,Identifiable,Drawable,Compatible,ObjectInterface,LaneBasedObject,Sensor,SingleSensor
public class SimpleReportingSensor extends AbstractSensor
Sensor that prints which GTU triggers it.
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands.
All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-08-12 16:37:45 +0200 (Wed, 12 Aug 2015) $, @version $Revision: 1240 $, by $Author: averbraeck $,
initial version an 30, 2015
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface org.opentrafficsim.core.compatibility.Compatible
EVERYTHING, MINUS, PLUSFields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.road.network.lane.object.sensor.SingleSensor
DEFAULT_SENSOR_ELEVATION, SENSOR_TRIGGER_EVENT -
Constructor Summary
Constructors Constructor Description SimpleReportingSensor(String id, Lane lane, Length position, RelativePosition.TYPE triggerPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator, Compatible compatible)Construct a new SimpleReportingSensor. -
Method Summary
Modifier and Type Method Description SimpleReportingSensorclone(CrossSectionElement newCSE, SimulatorInterface.TimeDoubleUnit newSimulator)Clone the LaneBasedObject for e.g., copying a network.StringtoString()voidtriggerResponse(LaneBasedGTU gtu)Implementation of the response to a trigger of this sensor by a GTU.Methods inherited from class org.opentrafficsim.road.network.lane.object.sensor.AbstractSensor
compareTo, equals, getDetectedGTUTypes, getPositionType, getSimulator, hashCode, isCompatible, makeGeometry, triggerMethods inherited from class org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
clone, getDirection, getFullId, getLane, getLocation, getLongitudinalPositionMethods inherited from class org.opentrafficsim.core.object.StaticObject
getBounds, getGeometry, getHeight, getIdMethods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListenerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, 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
-
SimpleReportingSensor
public SimpleReportingSensor(String id, Lane lane, Length position, RelativePosition.TYPE triggerPosition, DEVSSimulatorInterface.TimeDoubleUnit simulator, Compatible compatible) throws NetworkExceptionConstruct a new SimpleReportingSensor.- Parameters:
lane- Lane; the lane on which the new SimpleReportingSensor will be locatedposition- Length; the position of the sensor along the lanetriggerPosition- RelativePosition.TYPE; the relative position type (e.g., FRONT, BACK) of the vehicle that triggers the sensorid- String; the id of the new SimpleReportingSensorsimulator- DEVSSimulatorInterface.TimeDoubleUnit; the simulator to enable animationcompatible- Compatible; object that can decide if a particular GTU type in a particular driving direction will trigger the new SimpleReportingSensor- Throws:
NetworkException- when the position on the lane is out of bounds w.r.t. the center line of the lane
-
-
Method Details
-
triggerResponse
Implementation of the response to a trigger of this sensor by a GTU.- Specified by:
triggerResponsein classAbstractSensor- Parameters:
gtu- LaneBasedGTU; the lane based GTU that triggered this sensor.
-
clone
public SimpleReportingSensor clone(CrossSectionElement newCSE, SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkExceptionClone the LaneBasedObject for e.g., copying a network.- Specified by:
clonein classAbstractSensor- 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
-
toString
- Overrides:
toStringin classAbstractSensor
-