Class Line

java.lang.Object
io.r2dbc.postgresql.codec.Line

public final class Line extends Object
Value object that maps to the line datatype in Postgres. Lines are represented by the linear equation Ax + By + C = 0.

Uses double to represent the coordinates.

  • Method Details

    • of

      public static Line of(double a, double b, double c)
      Create a new Line given parameters a, b and c of the linear equation.
      Parameters:
      a - coefficient of x
      b - coefficient of y
      c - constant
      Returns:
      the new Line object
    • of

      public static Line of(Point p1, Point p2)
      Create a new Line defined by two points.
      Parameters:
      p1 - first point on the line
      p2 - second point on the line
      Returns:
      the new Line object
      Throws:
      IllegalArgumentException - if p1 or p2 is null
    • of

      public static Line of(double x1, double y1, double x2, double y2)
      Create a new Line defined by two points.
      Parameters:
      x1 - the x-coordinate of the first point on the line
      y1 - the y-coordinate of the first point on the line
      x2 - the x-coordinate of the second point on the line
      y2 - the y-coordinate of the second point on the line
      Returns:
      the new Line object
    • getA

      public double getA()
    • getB

      public double getB()
    • getC

      public double getC()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object