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

📄 loadserializedfile.java

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


import planet.commonapi.Network;
import planet.generic.commonapi.GenericApp;
import planet.generic.commonapi.factory.GenericFactory;
import planet.generic.commonapi.factory.Topology;
import planet.test.TestNames;
import planet.util.Properties;
/**
 * Builds a network based with a serialized network specified in the
 * properties file. 
 * @author Ruben Mondejar
 * @author Jordi Pujol
 */
 
public class LoadSerializedFile {

	/**
	 * Loads a serialized network from the specified serialized file
	 * at properties file.
	 * @param args Waiting nothing.
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		//init context
        //arguments: properties file, application level, events, results, serialization
        GenericApp.start("../conf/master.properties",TestNames.SERIALIZE_LOADSERIALIZEDFILE,true,false,false,true);

        if (!Properties.factoriesNetworkTopology.equalsIgnoreCase(Topology.SERIALIZED))
            throw new Error ("This test must only run under a Serialized network.");
        
		System.out.println("Properties.serializedFile = "+Properties.serializedInputFile);

		//loads network.
		long t1,t2;
		t1 = System.currentTimeMillis();
		Network net = GenericFactory.buildNetwork();
		t2 = System.currentTimeMillis(); 
		int steps = net.getSimulatedSteps();
		System.out.println("Load time ["+((t2-t1)/1000)+"] seconds for ["+net.size()+"] nodes with ["+steps+"] steps.");
	}
}

⌨️ 快捷键说明

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