Package org.opentrafficsim.road.gtu.lane
Class CollisionDetector
java.lang.Object
org.opentrafficsim.road.gtu.lane.AbstractLaneBasedMoveChecker
org.opentrafficsim.road.gtu.lane.CollisionDetector
- All Implemented Interfaces:
EventListener,EventListener,EventProducer
Checks for collisions.
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
FieldsFields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckMove(LaneBasedGtu gtu) Check the move of the given GTU.Destroys the GTU upon a collision.Logs collision with distance, speed difference and angle at info level.Stops the GTU and the object if it is a GTU.Throws an exception upon a collision.Methods inherited from class org.opentrafficsim.road.gtu.lane.AbstractLaneBasedMoveChecker
notifyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Field Details
-
COLLISION
Collision event.
-
-
Constructor Details
-
CollisionDetector
Constructor.- Parameters:
network- network
-
-
Method Details
-
checkMove
Description copied from class:AbstractLaneBasedMoveCheckerCheck the move of the given GTU.- Specified by:
checkMovein classAbstractLaneBasedMoveChecker- Parameters:
gtu- GTU.- Throws:
Exception- thrown when something is not all right
-
getEventListenerMap
- Specified by:
getEventListenerMapin interfaceEventProducer
-
logCollisions
Logs collision with distance, speed difference and angle at info level.- Returns:
- this collision detector for method chaining
-
stopCollided
Stops the GTU and the object if it is a GTU.- Returns:
- this collision detector for method chaining
-
throwException
Throws an exception upon a collision.- Returns:
- this collision detector for method chaining
-
destroyGtu
Destroys the GTU upon a collision.- Returns:
- this collision detector for method chaining
-