<commit_before>/*-------------------------------------------------------------------------
*
* Copyright (c) 2003-2015 PostgreSQL Global Development Group
*
*
*-------------------------------------------------------------------------
*/

package org.postgresql.geometric;

import org.postgresql.util.GT;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState;

import java.io.Serializable;
import java.sql.SQLException;

/**
 * This implements a line represented by the linear equation Ax + By + C = 0
 *
 **/
public class PGline extends PGobject implements Serializable, Cloneable
{

    /**
     * Coefficient of x
     */
    public double a;

    /**
     * Coefficient of y
     */
    public double b;

    /**
     * Constant
     */
    public double c;

    /**
     * @param a coefficient of x
     * @param b coefficient of y
     * @param c constant
     */
    public PGline(double a, double b, double c) {
        this();
        this.a = a;
        this.b = b;
        this.c = c;
    }

    /**
     * @param x1 coordinate for first point on the line
     * @param y1 coordinate for first point on the line
     * @param x2 coordinate for second point on the line
     * @param y2 coordinate for second point on the line
     */
    public PGline(double x1, double y1, double x2, double y2)
    {
        this();
        double a = (y2 - y1) / (x2 - x1);
        double b = -1;
        double c = y1 - a * x1;
    }

    /**
     * @param p1 first point on the line
     * @param p2 second point on the line
     */
    public PGline(PGpoint p1, PGpoint p2)
    {
        this(p1.x, p1.y, p2.x, p2.y);
    }

    /**
     * @param lseg Line segment which calls on this line.
     */
    public PGline(PGlseg lseg) {
        this(lseg.point[0], lseg.point[1]);<commit_msg>Fix for issue https://github.com/pgjdbc/pgjdbc/issues/342 - Handle vertical lines.<commit_after>/*-------------------------------------------------------------------------
*
* Copyright (c) 2003-2015 PostgreSQL Global Development Group
*
*
*-------------------------------------------------------------------------
*/

package org.postgresql.geometric;

import org.postgresql.util.GT;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState;

import java.io.Serializable;
import java.sql.SQLException;

/**
 * This implements a line represented by the linear equation Ax + By + C = 0
 *
 **/
public class PGline extends PGobject implements Serializable, Cloneable
{

    /**
     * Coefficient of x
     */
    public double a;

    /**
     * Coefficient of y
     */
    public double b;

    /**
     * Constant
     */
    public double c;

    /**
     * @param a coefficient of x
     * @param b coefficient of y
     * @param c constant
     */
    public PGline(double a, double b, double c) {
        this();
        this.a = a;
        this.b = b;
        this.c = c;
    }

    /**
     * @param x1 coordinate for first point on the line
     * @param y1 coordinate for first point on the line
     * @param x2 coordinate for second point on the line
     * @param y2 coordinate for second point on the line
     */
    public PGline(double x1, double y1, double x2, double y2)
    {
        this();
        if (x1 == x2) {
            a = -1;
            b = 0;
        } else {
            a = (y2 - y1) / (x2 - x1);
            b = -1;
        }
        c = y1 - a * x1;
    }

    /**
     * @param p1 first point on the line
     * @param p2 second point on the line
     */
    public PGline(PGpoint p1, PGpoint p2)
    {
        this(p1.x, p1.y, p2.x, p2.y);
    }

    /**
     * @param lseg Line segment which calls on this line.
     */
    public PGline(PGlseg lseg) {
        this(lseg.point[0], lseg.point[1]);
{'fraction_non_alphanumeric': 0.17771545130035696, 'fraction_numerical': 0.01912289648138705, 'mean_word_length': 1.5911492734478203, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5433167', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1192, 'n_words': 380}