dpoint.java

来自「利用深度遍历的方法来检查8数码问题是否有解。」· Java 代码 · 共 26 行

JAVA
26
字号
public class DPoint implements Comparable
{
	public int x;
	public int y;

	public DPoint(int x,int y)
	{
		this.x=x;
		this.y=y;
	}
	
	public double distant(DPoint c)
	{
		return Math.sqrt(Math.pow((x-c.x),2)+Math.pow((y-c.y),2));
	}
	
	public int compareTo(Object e)
	{
		return x-((DPoint)e).x;
	}
	
	public String toString()
	{
		return "("+x+","+y+")";
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?