⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 closestfind.java

📁 java写的Archreport
💻 JAVA
字号:
/**	File Name:    	ClosestFind.java	Author:	黄增博   #B02251132	Date:		March 20 2004	Description:	The ClosestFind class is used to find the artifact closest                        to the provided ArchFind object.**/class ClosestFind{	private ArchFind item;    // the provide item	private ArchFind closestToItem; // the item closest to 'item'	private double distance;	// the distance between the two items	public ClosestFind(ArchFind it){		item = it;		closestToItem = null;	//null indicates there are no other items		distance = Double.NaN;  // initialize distance to not a number;	}	/* If the find object is closer to the item object than	* closestToItem object, then replace closestToItem by find	*/	public void update(ArchFind find){		//if there is no current item, then find becomes closestToItem		if(closestToItem==null){			closestToItem = find;			distance = closestToItem.distanceBetween(item);			return;		}		/*provide the implementation that check distance,		* and updates closestToItem if necessary		*/                else                if(closestToItem.distanceBetween(item)>find.distanceBetween(item))                closestToItem=find;		}	public ArchFind getClosest(){		return closestToItem;//return closest to item	}}

⌨️ 快捷键说明

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