Record Class PerceivedObject.Kinematics.Overlap.Record

java.lang.Object
java.lang.Record
org.opentrafficsim.road.gtu.perception.object.PerceivedObject.Kinematics.Overlap.Record
Record Components:
getOverlap - overlap
getOverlapFront - front overlap
getOverlapRear - rear overlap
isAhead - whether the object is ahead
isBehind - whether the object is behind
All Implemented Interfaces:
PerceivedObject.Kinematics.Overlap
Enclosing interface:
PerceivedObject.Kinematics.Overlap

public static record PerceivedObject.Kinematics.Overlap.Record(Optional<org.djunits.value.vdouble.scalar.Length> getOverlap, Optional<org.djunits.value.vdouble.scalar.Length> getOverlapFront, Optional<org.djunits.value.vdouble.scalar.Length> getOverlapRear, boolean isAhead, boolean isBehind) extends Record implements PerceivedObject.Kinematics.Overlap
Record storing overlap information. The three overlap values are either all null or they all have a value. In the former case, either of isAhead and isBehind is true.
  • Constructor Details

    • Record

      public Record(org.djunits.value.vdouble.scalar.Length getOverlap, org.djunits.value.vdouble.scalar.Length getOverlapFront, org.djunits.value.vdouble.scalar.Length getOverlapRear, boolean isAhead, boolean isBehind)
      Constructor.
      Parameters:
      getOverlap - overlap
      getOverlapFront - front overlap
      getOverlapRear - rear overlap
      isAhead - whether the object is ahead
      isBehind - whether the object is behind
      Throws:
      NullPointerException - when getOverlapFront or getOverlapRear is null while getOverlap is not
      IllegalArgumentException - when getOverlapFront or getOverlapRear is not null while getOverlap is null
      IllegalArgumentException - if isAhead or isBehind is true while overlap is specified
    • Record

      public Record(Optional<org.djunits.value.vdouble.scalar.Length> getOverlap, Optional<org.djunits.value.vdouble.scalar.Length> getOverlapFront, Optional<org.djunits.value.vdouble.scalar.Length> getOverlapRear, boolean isAhead, boolean isBehind)
      Creates an instance of a Record record class.
      Parameters:
      getOverlap - the value for the getOverlap record component
      getOverlapFront - the value for the getOverlapFront record component
      getOverlapRear - the value for the getOverlapRear record component
      isAhead - the value for the isAhead record component
      isBehind - the value for the isBehind record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • getOverlap

      public Optional<org.djunits.value.vdouble.scalar.Length> getOverlap()
      Returns the value of the getOverlap record component.
      Specified by:
      getOverlap in interface PerceivedObject.Kinematics.Overlap
      Returns:
      the value of the getOverlap record component
    • getOverlapFront

      public Optional<org.djunits.value.vdouble.scalar.Length> getOverlapFront()
      Returns the value of the getOverlapFront record component.
      Specified by:
      getOverlapFront in interface PerceivedObject.Kinematics.Overlap
      Returns:
      the value of the getOverlapFront record component
    • getOverlapRear

      public Optional<org.djunits.value.vdouble.scalar.Length> getOverlapRear()
      Returns the value of the getOverlapRear record component.
      Specified by:
      getOverlapRear in interface PerceivedObject.Kinematics.Overlap
      Returns:
      the value of the getOverlapRear record component
    • isAhead

      public boolean isAhead()
      Returns the value of the isAhead record component.
      Specified by:
      isAhead in interface PerceivedObject.Kinematics.Overlap
      Returns:
      the value of the isAhead record component
    • isBehind

      public boolean isBehind()
      Returns the value of the isBehind record component.
      Specified by:
      isBehind in interface PerceivedObject.Kinematics.Overlap
      Returns:
      the value of the isBehind record component