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

📄 patternstatus.java

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

import java.io.Serializable;

/**
 *  Statistic class pattern-oriented.
 *  It stores the number of RouteMessages with <b>type</b>
 *  and <b>mode</b> issued and the total number of hops to
 *  reach its destination. 
 *  @author Marc Sanchez	   <marc.sanchez@estudiants.urv.es>
 *  @version 1.0
 */
public class PatternStatus implements Serializable {
	/**
	 * RouteMessage's type: human readable string representation of the
	 * type of a RouteMessage which depends on the overlay impl. 
	 * @see planet.commonapi.Node 
	 */
	private String typeOf;
	/**
	 * RouteMessage's mode: human readable string representation of the
	 * mode of a RouteMessage which depends on the overlay impl. 
	 * @see planet.commonapi.Node 
	 */
	private String modeOf;
	/**
	 * Total number of messages of RouteMessage's type <b>typeOf</b> and 
	 * mode <b>modeOf</b>.
	 */
	private int messagesPerType = 1;
	/**
	 * Stores the number of hops indexed by RouteMessage's type and mode.
	 */
	private int hopsPerType = 0;
	
	//Constructor
	public PatternStatus(String typeOf) {
		this.typeOf = typeOf;
		this.modeOf = "'*'";
	}
	
	public PatternStatus(String typeOf, String modeOf) {
		this.typeOf = typeOf;
		this.modeOf = modeOf;
	}
	
	public void updateHops() { hopsPerType++;  }
	public void updateMessages() { messagesPerType++; }
	/**
	 * @return Returns the RouteMessage's type
	 */
	public String getType() {
		return this.typeOf;
	}
	/**
	 * @return Returns the RouteMessage's mode
	 */
	public String getMode() {
		return this.modeOf;
	}
	/**
	 * @return Returns the total number of hops per RouteMessage's type.
	 */
	public int getHopsPerType() {
		return this.hopsPerType;
	}
	/**
	 * @return Returns the total number of messages per RouteMessage's type.
	 */
	public int getMessagesPerType() {
		return this.messagesPerType;
	}
}

⌨️ 快捷键说明

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