Record Class AnticipationInfo
java.lang.Object
java.lang.Record
org.opentrafficsim.road.gtu.lane.tactical.util.AnticipationInfo
- Record Components:
duration
- Duration; duration of movementendSpeed
- Speed; end speed of movement
- All Implemented Interfaces:
Serializable
public record AnticipationInfo(org.djunits.value.vdouble.scalar.Duration duration, org.djunits.value.vdouble.scalar.Speed endSpeed)
extends Record
implements Serializable
Utility class that stores duration and end-speed for a given anticipated movement.
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
- See Also:
-
Constructor Summary
ConstructorDescriptionAnticipationInfo
(org.djunits.value.vdouble.scalar.Duration duration, org.djunits.value.vdouble.scalar.Speed endSpeed) Creates an instance of aAnticipationInfo
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic AnticipationInfo
anticipateMovement
(org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed initialSpeed, org.djunits.value.vdouble.scalar.Acceleration acceleration) Returns info of the anticipation assuming constant acceleration.static AnticipationInfo
anticipateMovementFreeAcceleration
(org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed initialSpeed, org.opentrafficsim.base.parameters.Parameters parameters, CarFollowingModel carFollowingModel, SpeedLimitInfo speedLimitInfo, org.djunits.value.vdouble.scalar.Duration timeStep) Returns info of the anticipation using free acceleration from car-following model.static AnticipationInfo
anticipateMovementSpeedLimited
(org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed initialSpeed, org.djunits.value.vdouble.scalar.Acceleration acceleration, org.djunits.value.vdouble.scalar.Speed maxSpeed) Returns info of the anticipation assuming constant acceleration, without exceeding maximum speed.org.djunits.value.vdouble.scalar.Duration
duration()
Returns the value of theduration
record component.org.djunits.value.vdouble.scalar.Speed
endSpeed()
Returns the value of theendSpeed
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
AnticipationInfo
public AnticipationInfo(org.djunits.value.vdouble.scalar.Duration duration, org.djunits.value.vdouble.scalar.Speed endSpeed) Creates an instance of aAnticipationInfo
record class.
-
-
Method Details
-
anticipateMovement
public static AnticipationInfo anticipateMovement(org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed initialSpeed, org.djunits.value.vdouble.scalar.Acceleration acceleration) Returns info of the anticipation assuming constant acceleration.- Parameters:
distance
- Length; distance to coverinitialSpeed
- Speed; initial speedacceleration
- Acceleration; (assumed) acceleration- Returns:
- duration to cover given distance with given initial speed and acceleration
-
anticipateMovementSpeedLimited
public static AnticipationInfo anticipateMovementSpeedLimited(org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed initialSpeed, org.djunits.value.vdouble.scalar.Acceleration acceleration, org.djunits.value.vdouble.scalar.Speed maxSpeed) Returns info of the anticipation assuming constant acceleration, without exceeding maximum speed.- Parameters:
distance
- Length; distance to coverinitialSpeed
- Speed; initial speedacceleration
- Acceleration; (assumed) accelerationmaxSpeed
- Speed; maximum speed- Returns:
- duration to cover given distance with given initial speed and acceleration, without exceeding maximum speed
-
anticipateMovementFreeAcceleration
public static AnticipationInfo anticipateMovementFreeAcceleration(org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed initialSpeed, org.opentrafficsim.base.parameters.Parameters parameters, CarFollowingModel carFollowingModel, SpeedLimitInfo speedLimitInfo, org.djunits.value.vdouble.scalar.Duration timeStep) throws org.opentrafficsim.base.parameters.ParameterException Returns info of the anticipation using free acceleration from car-following model.- Parameters:
distance
- Length; distance to coverinitialSpeed
- Speed; initial speedparameters
- Parameters; parameters of the anticipated GTUcarFollowingModel
- CarFollowingModel; car-following model of the anticipated GTUspeedLimitInfo
- SpeedLimitInfo; speed limit info of the anticipated GTUtimeStep
- Duration; time step to use- Returns:
- info regarding anticipation of movement
- Throws:
org.opentrafficsim.base.parameters.ParameterException
- if parameter is not defined
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
duration
public org.djunits.value.vdouble.scalar.Duration duration()Returns the value of theduration
record component.- Returns:
- the value of the
duration
record component
-
endSpeed
public org.djunits.value.vdouble.scalar.Speed endSpeed()Returns the value of theendSpeed
record component.- Returns:
- the value of the
endSpeed
record component
-