@Override public int compareTo(Object o) { if (this == o) { return 0; } else if (o instanceof Client) { Client to = (Client) o; if (this.getCoordinateX() <= to.getCoordinateX()) { return -1; } else { return 1; } } else { return -1; } }
public static double getDistance(Client a, Client b) { return Math.sqrt( ((a.getCoordinateX() - b.getCoordinateX()) * (a.getCoordinateX() - b.getCoordinateX())) + ((a.getCoordinateY() - b.getCoordinateY()) * (a.getCoordinateY() - b.getCoordinateY()))); }