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

📄 trivialproperties.java

📁 p2p仿真器。开发者可以工作在覆盖层中进行创造和测试逻辑算法或者创建和测试新的服务。PlanetSim还可以将仿真代码平稳转换为在Internet上的实验代码
💻 JAVA
字号:
package planet.trivialp2p;

import planet.commonapi.exception.InitializationException;
import planet.util.OverlayProperties;
import planet.util.PropertiesWrapper;

/**
 * This class includes the initialization and the values for all
 * configuration properties of the Chord overlay.
 * @author <a href="mailto: jordi.pujol@estudiants.urv.es">Jordi Pujol</a>
 * @author <a href="mailto: marc.sanchez@estudiants.urv.es">Marc Sanchez</a>
 * Date: 05/07/2004
 */
public class TrivialProperties implements OverlayProperties { 

	/* *********************** TRIVIALP2P PROPERTIES ***********************/
	/* Theese must to appear on the properties file */
	
    /**
     * TrivialP2P property: Default key for 'debug' flag.
     */
    public static final String TRIVIAL_DEBUG = "TRIVIAL_DEBUG";
	/* *********************** TRIVIALP2P ATTRIBUTES   **********************/
    /**
     * When true, shows information for debug purposes.
     */
    public boolean debug;


	/**
	 * Initialize all configuration properties of the Symphony overlay.
	 * @see planet.util.OverlayProperties#init(planet.util.PropertiesWrapper)
	 * @param properties Properties with all (key,value) pairs.
	 * @throws InitializationException
	 */
	public void init(PropertiesWrapper properties) throws InitializationException {
		//Load properties
        debug = properties.getPropertyAsBoolean(TRIVIAL_DEBUG);
	}
	
    /**
     * Makes the postinitialization process. Does nothing.
     * @throws InitializationException if an error occurs during
     * the initialization of the different properties.
     * @param properties A Properties instance with all required configuration properties.
     * @see planet.util.PropertiesInitializer#postinit(planet.util.PropertiesWrapper)
     */
    public void postinit(PropertiesWrapper properties) throws InitializationException
    {
        //does nothing
    }
	
	/**
	 * Returns a String representation of the constant specific values
	 * of type the RouteMessage. Its use is only for human readable 
	 * logs. Based on SymphonyNode implementation.
	 * @param type Value to get its String representation.
	 * @return The String representation of the type.
	 */
	public String typeToString(int type) {
		return TrivialNode.TYPES[type];
	}
	/**
	 * Returns a string representation of each of event mode and 
	 * RouteMessage mode.
	 * @param mode Mode of the RouteMessage to get its 
	 * String representation.
	 * @return String representation of the mode of RouteMessage.
	 */
	public String modeToString(int mode) {
		return TrivialNode.MODES[mode];
	}
	
	/**
	 * Returns RouteMessage type for Application level.
	 * @return RouteMessage type for Application level.
	 */
	public int getTypeForApplicationMessage()
	{
	    return TrivialNode.DATA;
	}
}

⌨️ 快捷键说明

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