51 lines
934 B
Java
51 lines
934 B
Java
package Model;
|
|
|
|
/**
|
|
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
|
*
|
|
* @Author: Armin Wolf
|
|
* @Email: a_wolf28@uni-muenster.de
|
|
* @Date: 28.05.2017.
|
|
*/
|
|
public class Pair implements Comparable<Pair> {
|
|
|
|
private Double x;
|
|
private Double y;
|
|
|
|
public Pair(Double x, Double y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
public Double getX() {
|
|
return x;
|
|
}
|
|
|
|
public void setX(Double x) {
|
|
this.x = x;
|
|
}
|
|
|
|
public Double getY() {
|
|
return y;
|
|
}
|
|
|
|
public void setY(Double y) {
|
|
this.y = y;
|
|
}
|
|
|
|
@Override
|
|
public int compareTo(Pair o) {
|
|
if(this.getX() == o.getX()){
|
|
if (this.getY() <= o.getY()){
|
|
return -1;
|
|
} else {
|
|
return 1;
|
|
}
|
|
} else if (this.getX() < o.getX()){
|
|
return -1;
|
|
} else {
|
|
return 1;
|
|
}
|
|
}
|
|
}
|