java.lang.Object
java.lang.Record
com.portingdeadmods.researchd.client.screens.research.graph.lines.PotentialOverlap
Record Components:
length - The length of the overlap, or 1 for point intersections
point - The intersection/middle point
seg1 - First segment involved
seg2 - Second segment involved
isOverlap - True if segments overlap, false if they just intersect
isSegment - True if the overlap is a segment (horizontal or vertical), false if it's just a point intersection

public record PotentialOverlap(int length, Point point, LineSegment seg1, LineSegment seg2, boolean isOverlap, boolean isSegment) extends Record
Represents a potential overlap/intersection between line segments. May be empty.
  • Constructor Details

    • PotentialOverlap

      public PotentialOverlap(int length, Point point, LineSegment seg1, LineSegment seg2, boolean isOverlap, boolean isSegment)
      Creates an instance of a PotentialOverlap record class.
      Parameters:
      length - the value for the length record component
      point - the value for the point record component
      seg1 - the value for the seg1 record component
      seg2 - the value for the seg2 record component
      isOverlap - the value for the isOverlap record component
      isSegment - the value for the isSegment record component
  • Method Details

    • toString

      @NotNull public @NotNull 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
    • of

      public static PotentialOverlap of(LineSegment seg1, LineSegment seg2)
    • 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.
    • length

      public int length()
      Returns the value of the length record component.
      Returns:
      the value of the length record component
    • point

      public Point point()
      Returns the value of the point record component.
      Returns:
      the value of the point record component
    • seg1

      public LineSegment seg1()
      Returns the value of the seg1 record component.
      Returns:
      the value of the seg1 record component
    • seg2

      public LineSegment seg2()
      Returns the value of the seg2 record component.
      Returns:
      the value of the seg2 record component
    • isOverlap

      public boolean isOverlap()
      Returns the value of the isOverlap record component.
      Returns:
      the value of the isOverlap record component
    • isSegment

      public boolean isSegment()
      Returns the value of the isSegment record component.
      Returns:
      the value of the isSegment record component