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

📄 configuration.java

📁 pastry 协议在peersim下的仿真环境。测试无误。在eclipse下打开源文件夹为工程即可使用和做仿真实验。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	}	config = new ConfigContainer(p, check);}// -------------------------------------------------------------------/** * @return true if and only if name is a specified (existing) property. */public static boolean contains(String name){	return config.contains(name);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, throws a * {@link MissingParameterException}. * @param name *          Name of configuration property * @param def *          default value */public static boolean getBoolean(String name, boolean def){	return config.getBoolean(name, def);}// -------------------------------------------------------------------/** * Reads given property. If not found, or the value is empty string then * throws a {@link MissingParameterException}. Empty string is not * accepted as false due to the similar function of {@link #contains} which * returns true in that case. True is returned if the lowercase value of * the property is "true", otherwise false is returned. * @param name *          Name of configuration property */public static boolean getBoolean(String name){	return config.getBoolean(name);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, returns the default * value. * @param name *          Name of configuration property * @param def *          default value */public static int getInt(String name, int def){	return config.getInt(name, def);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, throws a * {@link MissingParameterException}. * @param name *          Name of configuration property */public static int getInt(String name){	return config.getInt(name);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, returns the default * value. * @param name *          Name of configuration property * @param def *          default value */public static long getLong(String name, long def){	return config.getLong(name, def);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, throws a * {@link MissingParameterException}. * @param name *          Name of configuration property */public static long getLong(String name){	return config.getLong(name);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, returns the default * value. * @param name *          Name of configuration property * @param def *          default value */public static double getDouble(String name, double def){	return config.getDouble(name, def);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, throws a * MissingParameterException. * @param name *          Name of configuration property */public static double getDouble(String name){	return config.getDouble(name);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, returns the default * value. * @param name *          Name of configuration property * @param def *          default value */public static String getString(String name, String def){	return config.getString(name, def);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, throws a * MissingParameterException. Removes trailing whitespace characters. * @param name *          Name of configuration property */public static String getString(String name){	return config.getString(name);}// -------------------------------------------------------------------/** * Reads the given property from the configuration interpreting it as a * protocol name. Returns the numeric protocol identifier of this protocol * name. See the discussion of protocol name at {@link Configuration} for * details on how this numeric id is calculated *  * @param name *          Name of configuration property * @return the numeric protocol identifier associated to the value of the *         property */public static int getPid(String name){	return config.getPid(name);}// -------------------------------------------------------------------/** * Calls {@link #getPid(String)}, and returns the default if no property * is defined with the given name. *  * @param name *          Name of configuration property * @param pid *          the default protocol identifier * @return the numeric protocol identifier associated to the value of the *         property, or the default if not defined */public static int getPid(String name, int pid){	return config.getPid(name, pid);}// -------------------------------------------------------------------/** * Returns the numeric protocol identifier of the given protocol name. *  * @param protname *          the protocol name. * @return the numeric protocol identifier associated to the protocol name */public static int lookupPid(String protname){	return config.lookupPid(protname);}// -------------------------------------------------------------------/** * Returns the name of a protocol that has the given identifier. * <p> * Note that this is not a constant time operation in the number of * protocols, although typically there are very few protocols defined. *  * @param pid *          numeric protocol identifier. * @return name of the protocol that has the given id. null if no protocols *         have the given id. */public static String lookupPid(int pid){	return config.lookupPid(pid);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, throws a * {@link MissingParameterException}. When creating the Class object, a * few attempts are done to resolve the classname. See * {@link Configuration} for details. * @param name *          Name of configuration property */public static Class getClass(String name){	return config.getClass(name);}// -------------------------------------------------------------------/** * Reads given configuration property. If not found, returns the default * value. * @param name *          Name of configuration property * @param def *          default value * @see #getClass(String) */public static Class getClass(String name, Class def){	return config.getClass(name, def);}// -------------------------------------------------------------------/** * Reads given configuration property for a class name. It returns an * instance of the class. The class must implement a constructor that takes * a String as an argument. The value of this string will be <tt>name</tt>. * The constructor of the class can see the configuration so it can make * use of this name to read its own parameters from it. * @param name *          Name of configuration property * @throws MissingParameterException *           if the given property is not defined * @throws IllegalParameterException *           if there is any problem creating the instance */public static Object getInstance(String name){	return config.getInstance(name);}// -------------------------------------------------------------------/** * Reads given configuration property for a class name. It returns an * instance of the class. The class must implement a constructor that takes * a String as an argument. The value of this string will be <tt>name</tt>. * The constructor of the class can see the configuration so it can make * use of this name to read its own parameters from it. * @param name *          Name of configuration property * @param def *          The default object that is returned if there is no property *          defined with the given name * @throws IllegalParameterException *           if the given name is defined but there is a problem creating *           the instance. */public static Object getInstance(String name, Object def){	return config.getInstance(name, def);}// -------------------------------------------------------------------/** * It returns an array of class instances. The instances are constructed by * calling {@link #getInstance(String)} on the names returned by * {@link #getNames(String)}. * @param name *          The component type (i.e. prefix of the list of configuration *          properties) which will be passed to {@link #getNames(String)}. */public static Object[] getInstanceArray(String name){	return config.getInstanceArray(name);}// -------------------------------------------------------------------/** * Returns an array of names prefixed by the specified name. The array is * sorted as follows. If there is no config entry * <code>{@value #PAR_INCLUDE}+"."+name</code> or * <code>{@value #PAR_ORDER}+"."+name</code> then the order is * alphabetical. Otherwise this entry defines the order. For more * information see {@link Configuration}. * @param name *          the component type (i.e., the prefix) * @return the full property names in the order specified by the *         configuration */public static String[] getNames(String name){	return config.getNames(name);}}

⌨️ 快捷键说明

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