Class HeadwayDistance
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayDistance
- All Implemented Interfaces:
Serializable,Comparable<Headway>,org.djutils.base.Identifiable,PerceivedObject,Headway
Container for a reference to information about a headway with just a distance, without any further information about the
object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop. The reason for
storing a speed of zero at the end of a maximum headway is that we did not check the conditions beyond that point. A GTU or
lane drop could be right behind the last point we checked.
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
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway
Headway.ObjectType -
Constructor Summary
ConstructorsConstructorDescriptionHeadwayDistance(double distance) Construct a new Headway information object with just a distance, without any further information about the object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop.HeadwayDistance(org.djunits.value.vdouble.scalar.Length distance) Construct a new Headway information object with just a distance, without any further information about the object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.djunits.value.vdouble.scalar.Accelerationfinal org.djunits.value.vdouble.scalar.LengthRetrieve the strongly typed distance to the other object.final StringgetId()final org.djunits.value.vdouble.scalar.Lengthfinal Headway.ObjectTypefinal org.djunits.value.vdouble.scalar.LengthReturn the (perceived) overlap with the other object.final org.djunits.value.vdouble.scalar.LengthReturn the (perceived) front overlap to the other object.final org.djunits.value.vdouble.scalar.LengthReturn the (perceived) rear overlap to the other object.final org.djunits.value.vdouble.scalar.SpeedgetSpeed()final booleanisAhead()final booleanisBehind()final booleanfinal StringtoString()
-
Constructor Details
-
HeadwayDistance
public HeadwayDistance(double distance) Construct a new Headway information object with just a distance, without any further information about the object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop.- Parameters:
distance- the distance that needs to be stored.
-
HeadwayDistance
public HeadwayDistance(org.djunits.value.vdouble.scalar.Length distance) Construct a new Headway information object with just a distance, without any further information about the object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop.- Parameters:
distance- the distance that needs to be stored.
-
-
Method Details
-
getId
-
getLength
public final org.djunits.value.vdouble.scalar.Length getLength() -
getSpeed
public final org.djunits.value.vdouble.scalar.Speed getSpeed() -
getDistance
public final org.djunits.value.vdouble.scalar.Length getDistance()Description copied from interface:HeadwayRetrieve the strongly typed distance to the other object.- Specified by:
getDistancein interfaceHeadway- Returns:
- the distance to the object, return value null indicates that the other object is parallel to the reference object
-
getObjectType
- Specified by:
getObjectTypein interfaceHeadway- Returns:
- the (perceived) object Type, can be null if no object type unknown.
-
getAcceleration
public final org.djunits.value.vdouble.scalar.Acceleration getAcceleration()- Specified by:
getAccelerationin interfaceHeadway- Returns:
- acceleration the (perceived) acceleration of the other object; can be null if unknown.
-
getOverlapFront
public final org.djunits.value.vdouble.scalar.Length getOverlapFront()Description copied from interface:HeadwayReturn the (perceived) front overlap to the other object. This value should be null if there is no overlap. In the figure for two GTUs below, it is distance c, positive for GTU1, negative for GTU2.---------- | GTU 1 | -----> ---------- --------------- | GTU 2 | -----> --------------- | a | b | c |- Specified by:
getOverlapFrontin interfaceHeadway- Returns:
- the (perceived) front overlap to the other object or null if there is no overlap.
-
getOverlapRear
public final org.djunits.value.vdouble.scalar.Length getOverlapRear()Description copied from interface:HeadwayReturn the (perceived) rear overlap to the other object. This value should be null if there is no overlap.In the figure below for two GTUs, it is distance a, positive for GTU1, negative for GTU2.---------- | GTU 1 | -----> ---------- --------------- | GTU 2 | -----> --------------- | a | b | c |- Specified by:
getOverlapRearin interfaceHeadway- Returns:
- the (perceived) rear overlap to the other object or null if there is no overlap.
-
getOverlap
public final org.djunits.value.vdouble.scalar.Length getOverlap()Description copied from interface:HeadwayReturn the (perceived) overlap with the other object. This value should be null if there is no overlap. In the figure below for two GTUs, it is distance b, positive for GTU1 and GTU2.---------- | GTU 1 | -----> ---------- --------------- | GTU 2 | -----> --------------- | a | b | c |- Specified by:
getOverlapin interfaceHeadway- Returns:
- Length, the (perceived) overlap with the other object or null if there is no overlap.
-
isAhead
public final boolean isAhead() -
isBehind
public final boolean isBehind() -
isParallel
public final boolean isParallel()- Specified by:
isParallelin interfaceHeadway- Returns:
- whether the other object is parallel the reference object.
-
toString
-