//Point.java MrG 2013.0208
public class Point implements Comparable
{
private double x;
private double y;
public Point(double x, double y)
{
this.x=x;
this.y=y;
}
private double distance()
{
return Math.sqrt(x*x+y*y);
}
public int compareTo(Object other)
{
Point temp = (Point)other;
return (int)(this.distance()-temp.distance());
}
public boolean equals(Object other)
{
Point temp = (Point)other;
return this.compareTo(temp)==0;
}
public String toString()
{
return "(" + x + ", " + y + ")";
}
public double getX()
{
return x;
}
public double getY()
{
return y;
}
}