Record Class LanePosition
java.lang.Object
java.lang.Record
org.opentrafficsim.road.network.lane.LanePosition
- Record Components:
lane- the lane for the positionposition- the position on the lane, relative to the cross section link (design line) line, or against it
Store one position and lane of a GTU.
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
-
Constructor Summary
ConstructorsConstructorDescriptionLanePosition(Lane lane, Length position) Creates an instance of aLanePositionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.doubleReturns the fractional longitudinal position on the lane.Retrieve the location and direction of the GTU on the lane.final inthashCode()Returns a hash code value for this object.lane()Returns the value of thelanerecord component.position()Returns the value of thepositionrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
getLocation
Retrieve the location and direction of the GTU on the lane.- Returns:
- the location and direction of the GTU on the lane
-
getFraction
public double getFraction()Returns the fractional longitudinal position on the lane.- Returns:
- fractional longitudinal position on the lane
-
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). -
lane
Returns the value of thelanerecord component.- Returns:
- the value of the
lanerecord component
-
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-