package treeset2;

/**
 * Hilfsklasse.
 * 
 * @author  Ralf Kunze (rkunze@uos.de), Institut fuer Informatik, Universitaet Osnabrueck
 * @date 18.05.2007
 */
public class Point implements Comparable<Point> {

	private int x;
	private int y;
	
	public Point(int x, int y) {
		this.x=x;
		this.y = y;
	}
	
	public int compareTo(Point p) {
		return (int)(Math.sqrt(this.x * this.x + this.y * this.y) - Math.sqrt(p.x * p.x + p.y * p.y));
	}
	
	public boolean equals(Point p) {
		return this.x == p.x && this.y == p.y;
	}
	
	public int hashCode() {
		return x * x + y * y;
	}

}
