Class SinkDetector
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.core.object.StaticObject
org.opentrafficsim.road.network.object.AbstractLaneBasedObject
org.opentrafficsim.road.network.object.detector.LaneDetector
org.opentrafficsim.road.network.object.detector.SinkDetector
- All Implemented Interfaces:
Comparable<LaneDetector>,nl.tudelft.simulation.dsol.animation.Locatable,Identifiable,EventProducer,OtsShape,HierarchicallyTyped<DetectorType,,Detector> Detector,LocatedObject,LaneBasedObject
A SinkDetector is a detector that deletes GTUs that hit it, if they comply to a predicate.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands.
All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BiPredicate<SinkDetector,LaneBasedGtu> Predicate to use to destroy all GTUs with routes ending in the end node of this link, possibly via a connector.Fields inherited from class org.opentrafficsim.road.network.object.detector.LaneDetector
DEFAULT_DETECTOR_ELEVATION, DETECTOR_TRIGGER_EVENTFields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.base.geometry.OtsShape
DEFAULT_POLYGON_SEGMENTS, WORLD_MARGIN_LINE -
Constructor Summary
ConstructorsConstructorDescriptionSinkDetector(Lane lane, org.djunits.value.vdouble.scalar.Length position, DetectorType detectorType) Constructor.SinkDetector(Lane lane, org.djunits.value.vdouble.scalar.Length position, DetectorType detectorType, BiPredicate<SinkDetector, LaneBasedGtu> predicate) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal StringtoString()final voidImplementation of the response to a trigger of this detector by a GTU.booleanwillDestroy(LaneBasedGtu gtu) Returns whether the GTU will be removed by this sink.Methods inherited from class org.opentrafficsim.road.network.object.detector.LaneDetector
compareTo, equals, getPositionType, getType, hashCode, isCompatible, triggerMethods inherited from class org.opentrafficsim.road.network.object.AbstractLaneBasedObject
getFullId, getLane, getLine, getLongitudinalPosition, initMethods inherited from class org.opentrafficsim.core.object.StaticObject
create, create, getAbsoluteContour, getHeight, getId, getLocation, getRelativeBounds, getRelativeContourMethods inherited from class org.djutils.event.LocalEventProducer
getEventListenerMapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListenerMethods inherited from interface org.opentrafficsim.base.HierarchicallyTyped
isOfTypeMethods inherited from interface org.djutils.base.Identifiable
getIdMethods inherited from interface org.opentrafficsim.road.network.object.LaneBasedObject
getLane, getLength, getLine, getLocation, getLongitudinalPosition, getSimulatorMethods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getZMethods inherited from interface org.opentrafficsim.core.object.LocatedObject
getFullId, getHeightMethods inherited from interface org.opentrafficsim.base.geometry.OtsShape
contains, contains, getAbsoluteBounds, getAbsoluteContour, getAbsoluteContour, getDirZ, getRelativeBounds, getRelativeContour, signedDistance, signedDistance
-
Field Details
-
DESTINATION
Predicate to use to destroy all GTUs with routes ending in the end node of this link, possibly via a connector.
-
-
Constructor Details
-
SinkDetector
public SinkDetector(Lane lane, org.djunits.value.vdouble.scalar.Length position, DetectorType detectorType) throws NetworkException Constructor. All GTUs matching theDetectorTypewill be removed.- Parameters:
lane- the lane that triggers the deletion of the GTU.position- the position of the detectordetectorType- detector type.- Throws:
NetworkException- when the position on the lane is out of bounds w.r.t. the center line of the lane
-
SinkDetector
public SinkDetector(Lane lane, org.djunits.value.vdouble.scalar.Length position, DetectorType detectorType, BiPredicate<SinkDetector, LaneBasedGtu> predicate) throws NetworkExceptionConstructor.- Parameters:
lane- the lane that triggers the deletion of the GTU.position- the position of the detectordetectorType- detector type.predicate- predicate for what GTUs will be destroyed.- Throws:
NetworkException- when the position on the lane is out of bounds w.r.t. the center line of the lane
-
-
Method Details
-
triggerResponse
Description copied from class:LaneDetectorImplementation of the response to a trigger of this detector by a GTU.- Specified by:
triggerResponsein classLaneDetector- Parameters:
gtu- the lane based GTU that triggered this detector.
-
willDestroy
Returns whether the GTU will be removed by this sink.- Parameters:
gtu- gtu.- Returns:
- whether the GTU will be removed by this sink.
-
toString
- Overrides:
toStringin classLaneDetector
-