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

📄 beacon.java

📁 一个基于PlaceLab的室内和室外的智能导航系统
💻 JAVA
字号:
package org.placelab.mapper;import java.util.Hashtable;import org.placelab.core.Coordinate;import org.placelab.util.StringUtil;/** * A beacon is a generalized access point for a cellular network (like 802.11 or * Bluetooth or GSM). In the case of 802.11, humanReadableName maps to the SSID * and uniqueID maps to BSSID. All beacons must have a known location. *   */public abstract class Beacon {	public static Beacon create(Class klass, Hashtable map) {//		if (!Beacon.class.isAssignableFrom(klass)) {//			throw new IllegalArgumentException("klass must be a subclass of Beacon");//		}				try {			Class c = Class.forName("org.placelab.mapper.Beacon");			if(!c.isAssignableFrom(klass))				throw new IllegalArgumentException("klass must be a subclass of Beacon");		} catch(ClassNotFoundException e) {			throw new RuntimeException("Could not load class in Beacon");		}				Beacon beacon = null;		try {			beacon = (Beacon) klass.newInstance();		} catch (InstantiationException e) {			return null;		} catch (IllegalAccessException e) {			return null;		}		beacon.fromHashMap(map);		return beacon;	}	public String toString() {		return StringUtil.hashMapToStorageString(toHashMap());	}	/**	 * Loads the Beacon from a HashMap where values are keyed	 * by the appropriate fields for the Beacon type in 	 * {@link org.placelab.core.Types}	 */	public abstract void fromHashMap(Hashtable map);	/**	 * Stores the Beacon into a HashMap where values are keyed	 * by the appropriate fields for the Beacon type in 	 * {@link org.placelab.core.Types}	 */	public abstract Hashtable toHashMap();	/**	 * Gets the unique id for this Beacon as a String	 */	public abstract String getId();	/**	 * Gets the type of this Beacon as a String.  Known	 * Beacon types are listed in {@link org.placelab.core.Types}	 */	public abstract String getType();	/**	 * Gets the position for where this Beacon resides in the world	 */	public abstract Coordinate getPosition();	/**	 * Gets a sensible maximum range,	 * further than which the Beacon won't be detectable	 * 	 */	public abstract int getMaximumRange();}

⌨️ 快捷键说明

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