package com.dayou.report.kmeans;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class Point {

    private String name;
    private double x;
//    private double y;

    public Point(){}

    public Point(String name ,double x){
        this.name = name;
        this.x = x;
        //this.y = y;
    }

    public static boolean getIsSame(Point p1, Point p2){
        if (p1.getX() == p2.getX()) return true;
        return false;
    }

    public static double calculateDistance(Point p1, Point p2){
        double xDistance = p1.getX() - p2.getX();
        //double yDistance = p1.getY() - p2.getY();
        double tmp = xDistance * xDistance;
        return Math.sqrt(tmp);
    }

    public static double calculateMHDDistance(Point p1, Point p2){
        return Math.abs(p1.getX() - p2.getX());
    }

}

