Record Class AnticipationInfo

java.lang.Object
java.lang.Record
org.opentrafficsim.road.gtu.lane.tactical.util.AnticipationInfo
Record Components:
duration - Duration; duration of movement
endSpeed - 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

    Constructors
    Constructor
    Description
    AnticipationInfo(org.djunits.value.vdouble.scalar.Duration duration, org.djunits.value.vdouble.scalar.Speed endSpeed)
    Creates an instance of a AnticipationInfo record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    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
    Returns the value of the duration record component.
    org.djunits.value.vdouble.scalar.Speed
    Returns the value of the endSpeed record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AnticipationInfo

      public AnticipationInfo(org.djunits.value.vdouble.scalar.Duration duration, org.djunits.value.vdouble.scalar.Speed endSpeed)
      Creates an instance of a AnticipationInfo record class.
      Parameters:
      duration - the value for the duration record component
      endSpeed - the value for the endSpeed record component
  • 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 cover
      initialSpeed - Speed; initial speed
      acceleration - 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 cover
      initialSpeed - Speed; initial speed
      acceleration - Acceleration; (assumed) acceleration
      maxSpeed - 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 cover
      initialSpeed - Speed; initial speed
      parameters - Parameters; parameters of the anticipated GTU
      carFollowingModel - CarFollowingModel; car-following model of the anticipated GTU
      speedLimitInfo - SpeedLimitInfo; speed limit info of the anticipated GTU
      timeStep - Duration; time step to use
      Returns:
      info regarding anticipation of movement
      Throws:
      org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • duration

      public org.djunits.value.vdouble.scalar.Duration duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • endSpeed

      public org.djunits.value.vdouble.scalar.Speed endSpeed()
      Returns the value of the endSpeed record component.
      Returns:
      the value of the endSpeed record component